Let $(R, +, \cdot)$ be a commutative ring with $2n+1$ elements, for some $n\neq 4$ a positive integer. Suppose also that $R$ also satisfies the following condition: If an element $x\in R$ is non-invertible, then $x^2 \in \{\pm x\}$. Prove that $(R,+,\cdot)$ is a field.
Here it's my attempt: Suppose $x\in R$ is a non-invertible element, with $x\neq 0$. Then also, $2x$ is non-invertible, so we have that $x^2 \in \{\pm x\}$ and $4x^2 \in \{\pm 2x\}$. It follows that $3x=0$, so $3$ is non-invertible which means that $9\in \{\pm 3\}$ $\Rightarrow$ $3=0$. How can i continue? I am trying to prove that the ring should have $9$ elements in this case.
Firstly, observe this: If $F_3$ is the field of three elements, the ring $R=F_3\times F_3$ has $9$ elements, and its nonunits are precisely of the form $(\alpha, 0)$ or $(0, \alpha)$ for $\alpha\in F_3$, and elements of this form manifestly still satisfy the condition $x^2\in\{-x,x\}$. And it is not a field. This is an exceptional case which is why $n=4$ was left out.
Now, note that the condition implies $x^3=x$ for all nonunits. That precludes the existence of any nonzero nilpotent elements, so by the Artin-Wedderburn theorem$^\ast$ this ring is a finite product of finite fields. A different way to see this is that in a finite ring the prime ideals must be maximal, and only finitely many. With the Chinese Remainder Theorem, you can conclude, since there are no nonzero nilpotent elements, that $R$ is isomorphic to a finite product of $R/M_i$ where $M_i$ are maximal ideals.
Suppose for a moment there was more than one ring in the product.
Each factor field is a subset completely made up of nonunits, and therefore must satisfy $x^3-x=0$. Since they are each fields, that means each one is either $F_2$ or $F_3$. None can be $F_2$ because that would make the order of the ring even.
What eliminates a product of more than two $F_3$'s? Well, the thing is that you can't get $x^2=x$ or $x^2=-x$ for all the coordinates at once. For example, $(1,2,0\ldots)^2=(1,1,0\ldots)$ which is neither $(1,2,0\ldots)$ nor $(-1, -2,0\ldots)$.
So the ring has to be a field.
$^\ast$ The Artin-Wedderburn theorem states that a right Artinian ring with Jacobson radical zero is a finite product of matrix rings over division rings. A finite ring is of course Artinian. Since the Jacobson radical of a right Artinian ring is nilpotent, its elements are nilpotent elements, so ruling out nonzero nilpotent elements makes the Jacobson radical zero. Finally, commutativity rules out the matrix rings having dimension anything other than $1$. That's why you are only left with a finite product of finite fields in this case.