Every $2$-dimensional commutative $k$-algebra with only one prime ideal is isomorphic to $k[x]/(x^2)$

There's an easier way to approach this. Suppose $A$ is a 2-dimensional $k$-algebra with exactly one prime ideal. There are two possibilities:

  1. $0$ is prime (hence $A$ is a domain)
  2. The unique maximal ideal $m$ of $A$ is not equal to $0$ (hence $\dim_k m = 1$)

In case 1, we have that $A$ is a domain. Therefore, for all $a \in A \setminus \{0\}$, $x \mapsto ax : A \to A$ is an injective $k$-linear map. Since $\dim_k A$ is finite, this implies that $x \mapsto ax$ is bijective, so $a$ is a unit in $A$. Thus, $A$ is a field, so $A$ is an extension of $k$ of degree $2$. This is impossible because $k$ is algebraically closed!

Since case 1 was impossible, we better find some way to prove that $A$ is isomorphic to $k[x]/(x^2)$ in case 2. In other words, we want to build an isomorphism $k[x]/(x^2) \to A$, so in particular we need to define a morphism $k[x]/(x^2) \to A$. The "only" way to do this is to use the universal properties of $k[x]$ and quotient rings: given an element $a \in A$ such that $a^2 = 0$, $[p] \mapsto p(a) : k[x]/(x^2) \to A$ is a well-defined $k$-algebra homomorphism, and every $k$-algebra homomorphism $k[x]/(x^2) \to A$ can be produced uniquely in this way.

If this is going to be possible, and we do end up proving that $A \cong k[x]/(x^2)$ in case 2, it must be the case that the maximal ideal of $A$ corresponds to $(x)$ via this isomorphism. Thus, the easy way to produce an element of $A$ which squares to $0$ should be to pick an element of the maximal ideal $m$! Is there a best element to choose? Well, $0$ is definitely the worst element to choose, since then the induced map $k[x]/(x^2) \to A$ is $p \mapsto p(0)$, which can't be an isomorphism because its image is $1$-dimensional! However, since in case 2 we have that $\dim_k m = 1$, we see that there is a unique choice of nonzero element of $m$, up to scaling (the scaling doesn't matter because $p \mapsto p(a)$ and $p \mapsto p(xa)$ have the same range for any $x \in k \setminus \{0\}$ and $a \in A$ – you should absolutely check this if it's not 100% clear why).

So, let's make that choice: let $a \in m \setminus \{0\}$ be arbitrary and define $f : k[x]/(x^2) \to A$ by $f(p) = p(a)$ (check that this is a well-defined $k$-algebra homomorphism if you're unfamiliar with the aforementioned universal properties). Now we want to show that $f$ is either injective or surjective ($k$-linearity will take care of the rest). Either is easy, but surjectivity is easiest. Since $0 \neq 1 \notin m$, $0 \neq a \in m$, and $\dim_k A = 2$, we must have that $A = \operatorname{span}_k\{1,a\}$. At the same time, we have $1, a \in \operatorname{img}(f)$, since $f(1) = 1$ and and $f(x) = a$. $f$ is $k$-linear, so we conclude that $f$ is surjective, and we are done.