Every $2$-dimensional commutative $k$-algebra with only one prime ideal is isomorphic to $k[x]/(x^2)$ Let $k$ an algebraically closed field.
I want to prove the following:

*

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

*Not every $3$-dimensional $k$-algebra with only one prime ideal is isomorphic to $k[x]/(x^3)$.

For the $2$-dimensional case my attempt goes as follows:
If $A$ is a $2$-dimensional $k$-algebra with exactly one prime ideal then there is a polynomial ring $S$ such that $A=S/I$ for some ideal $I$. Also $A$ is spanned by equivalence classes of monomials, so we can refine it to a basis of two elements $m_1, m_2$. Because $1\in A$ we need one of the monomials to be a unit, and in that case we can replace it by $1$. So, we have that $A$ has a basis of the form $\{1,m\}$ where $m$ is the equivalence class of a monomial. Here I find a fork on the road. There are some possibilities about how to proceed

*

*I can argue that the ideal generated by $m$ is maximal, so $m$ is in fact the class of a variable, and then $S$ must be a polynomial ring in exactly that variable. I'm not sure of how to prove this but I have a hunch it's true. Then, $S$ being a polynomial in one variable I should prove that $x^2\in I$; I'm not sure how to do it. I know that there would be some $n$ such that $x^n\in I$. I think I could use some argument on the dimension that if $x^2$ is not in $I$ then it cannot be expressed in the form $a+bx+I$, a contradiction.

*In the case that's not true, then I should find a way to make sure that still $x^2\in I$ and that the obvious map $k[x]/(x^2)\to A$ mapping $x$ to itself is an isomorphism. I'm not sure if I can guarantee that. This would be wishful thinking, I think.

For the $3$-dimensional case, I'm not sure how to start. I think that if $A$ is a quotient of a polynomial ring in $1$ variable an argument like the one in 1 should make it isomorphic to $k[x]/(x^3)$, so I think I need a multivariate counterexample. But I'm not sure where to start.
Edit: As diracdeltafunk comments, it's not necesarily true that $S$ must be a polynomial in exactly one variable, but can something similar be said still? Something like that if $S$ has more than one variable, then $I$ is an ideal in which the remaining variables are generators? I mean, there could still be a counterexample.
 A: 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:

*

*$0$ is prime (hence $A$ is a domain)

*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.
A: This is about the case when $\dim_k A=3$.
Consider the $k$-algebras $A_1=k[x]/(x^3)$ and $A_2=k[x,y]/(x^2,xy,y^2)$.
As vector spaces, $A_1$ is generated by $1,x,x^2$ and $A_2$ is generated by $1,x,y$ so they're both $3-$dimensional. The prime ideals of $A_1$ and $A_2$ are $(x)/(x^3)$ and $(x,y)/(x^2,xy,y^2)$ respectively (since $\text{rad}(x^2,xy,y^2)=(x,y)$, a maximal ideal).
I claim these two algebras are nonisomorphic. To prove it I'll just prove their ideal lattices are nonisomorphic.
First, the ideals of $A_1$ are in a $1-1$ lattice-preserving correspondence (which also preserves prime ideals) with the ideals $(f)$ of $k[x]$ containing $(x^3)$. The generator $f$ of any such ideal must divide $x^3$, so, up to a scalar the choices are $f\in \{1,x,x^2,x^3\}$. This means that the ideal lattice of $A_1$ is just a chain
$$\begin{matrix} A_1\\
\uparrow\\
(x)/(x^3)\\
\uparrow\\
(x^2)/(x^3)\\
\uparrow\\
0
\end{matrix}$$
Similarly, the ideals of $A_2$ are in a $1-1$ lattice-preserving correspondence (which also preserves prime ideals) with the ideals of $k[x,y]$ containing $I=(x^2,xy,y^2)$. The primary decomposition of $I$ is
$$I=(y^2,x)\cap (x^2,y).$$
Since $y\notin (y^2,x)$ and $x\notin (x^2,y)$ those ideals form an antichain, which wouldn't be possible if the ideal lattice of $A_2$ were a chain. This is, the ideal lattice of $A_2$ contains the following sublattice:
$$\begin{matrix}  & &(x,y)/I& & \\
&\nearrow & & \nwarrow&\\
(x^2,y)/I & & & & (x,y^2)/I\\
& \nwarrow & & \nearrow&\\
 & &0 & &  \end{matrix}$$
