Let $R$ be a ring with identity such that $r^2=r$ for all $r\in R$. Show that the characteristic of $R$ is $2$ and that $R$ is commutative.
My argument was the following. But, the thing I am not sure about is, whether we can say that $f$ has at most two roots in any ring.
So, let $f(x)=x^2-x\in R[x]$. Then $f$ has at most $2$ roots. $0,1\in R$ and they are roots of $f$. So, $R=\{0,1\}$. Hence Char $R=2$ and it is commutative.
Appreciate if point out any errors.