For $R=I\oplus J$, prove that $I= Re$ and $J= Rf$ where $e$ and $f$ are two idempotent elements Given that $R$ is a commutative unitary ring and
$I$ and $J$ are two ideals of $R$ such that $R=I\oplus J$ (as an internal direct sum), how do you show that there exists two idempotent elements $e$ and $f$ in $R$ such that $I= Re$ and $J= Rf$?

Yeah, I'll type out all the details. Since $R$ is the internal direct sum of $I$ and $J$, this means that 
$$
R = I + J = \{i+j \mid i\in I,\; j\in J\} 
\quad\text{and}\quad 
IJ = I \cap J =\{0\}
\,.$$
Since $R = I + J$, there must be some aptly named $e \in I$ and $f \in J$ such that $e+f=1$. Note that $f = (1-e)$, then since $ef \in IJ = \{0\}$ we have $ef = e(1-e) = e-e^2=0\,,$ so $e$ is idempotent. Then you can verify that $f = (1-e)$ is idempotent directly. Now you should suspect that $I=Re$ and $J = R(1-e),$ so you can write down the correspondence to confirm your suspicion. Since every element $r \in R$ can we written uniquely as a element of $I$ plus and element of $J$, we just need to find such elements using the fact that $e \in I$ and $(1-e) \in J$:
$$\begin{align*}
R &\longleftrightarrow I \oplus J
\\r &\longleftrightarrow re + r(1-e)
\\R &\longleftrightarrow Re \oplus R(1-e)\,.
\end{align*}$$
