# Show that the set of all idempotent elements of a commutative ring is closed under multiplication

I have a commutative ring $R$ and I defined $S = \{a\in R | a^2 = a\}$, and I want to show that $S$ is closed under multiplication. So far I have this:

For $x,y \in S$ we know that $x^2 = x$ and $y^2 = y$. I want to consider $x*y = y*x = x^2*y^2 = y^2*x^2$ (because $R$ is commutative). Is it logical to deduce that because $S$ is a subset of $R$ and multiplication is associative on the ring, it is also associative on this subset? This would easily allow me to do this proof.

-
thank you jim for fixing my set brackets. –  furashu Jan 30 at 3:06

If $x,y\in S$ then we have $$(xy)^2=(xy)(xy)=x^2y^2=xy$$ so $xy\in S$. Notice that we used in the above equalities the commutativity of $R$ and the fact that $x=x^2$ and $y=y^2$.