Let $R$ be a commutative ring with unity and let $B(R)$ be the set of all idempotent elements in $R$.
Show for $b\in B(R)$, the $R$-modules $R$ and $Rb \times R(1-b)$ are isomorphic to one another.
Let $b\in R$ be idempotent. Let $c=1-b$ for convenience. Then $b+c=1$ and $bc=0=cb$. Consider now as you have suggested the natural map $f:R \to Rb \times Rc$ given by $f(x) = (xb,xc)$. It is easy to see that $f$ is an $R$-module homomorphism.
If $f(x)=0$ then $xb=0=xc$ and so $0=xb+xc=x(b+c)=x\cdot1=x$, which means that $f$ is injective.
Given $(ub,vc) \in b \times Rc$, we want $x\in R$ such that $xb=ub$ and $xc=vc$. If this is the case, then $x=x\cdot1=x(b+c)=xb+xc=ub+vc$. So, take $x=ub+vc$. Then $xb=ub^2+vcb=ub$, because $b^2=b$ and $cb=0$. Similarly, $xc=vc$. Thus, $(ub,vc)=f(ub+vc)$ and $f$ is surjective.
We have proved that $f$ is an isomorphism. (BTW, I don't think commutativity of $R$ is used here.)
I hope this hint isn't completely giving it away but to show surjectivity, you have to use the fact that b(1-b)=0 to construct a preimage for your arbitrary element. Please yell at me if I said too much.