Rings with decomposition are sums of ideals generated by idempotents I'm working on a question out of T.Y. Lam's book that has me thrown.
Let $B_1 \dots, B_n$ be left ideals (resp. ideals) in a ring $R$. Show that $R=B_1 \oplus \dots \oplus B_n$ iff there exists idempotents (resp. central idempotent) $e_1, \dots ,e_n$ with sum 1 such that $e_ie_j=0$ whenever $i \neq j$, and $B_i=R e_i$ for all $i$. In the case where the $B_i$'s are ideals, if $R=B_1 \oplus \dots \oplus B_n$, then each $B_i$ is a ring with identity $e_i$, and we have an isomorphism between $R$ and the direct product of rings $B_1 \times \dots \times B_n$. Show that any isomorphism of $R$ with a finite direct product of rings arises in this was.
Attempt
Supposing we have such idempotents there is an obvious map $R \to \oplus Re_i$ since $r=r \cdot 1=r \sum e_i$. Hence, $r \mapsto r \sum e_i$. This map is easily shown to be bijective, however, demonstrating that this is a homomorphism seems to be problematic. Consider
$$r_1r_2 \mapsto r_1r_2(\sum e_i) \text{ but } r_1(\sum e_i)r_2(\sum e_i) \neq r_1r_2 \sum e_i???$$
so perhaps this isn't the correct map?
Conversely, supposing we have such a decomposition then clearly $1=\sum b_i$ so let $e_i = b_i$. I'm guessing the fact that 1 is trivially an idempotent will show that the $e_i$ are but I'm stuck there. We have
$$1=1^2=(\sum e_i)^2$$
and similar to the above the map $r=r*1=r\sum e_i$ jumps out at me.
 A: Let's try the left ideal case.
Suppose $R=B_1\oplus B_2\oplus\dots\oplus B_n$. Then $1=\sum_{j=1}^n e_j$. Moreover, for $1\le i\le n$,
$$
e_i=e_i1=\sum_{j=1}^n e_ie_j
$$
Since $e_ie_j\in B_j$, we get
$$
e_ie_j=\begin{cases}
e_i & i=j \\[4px]
0   & i\ne j
\end{cases}
$$
If $x\in B_i$, then
$$
x=x1=\sum_{j=1}^n xe_j
$$
so we get
$$
xe_j=\begin{cases}
x & i=j \\[4px]
0 & i\ne j
\end{cases}
$$
In particular, $B_j=B_je_j=Re_j$.
Suppose conversely that we have idempotents $e_1,\dots,e_n$ with $e_1+\dots+e_n=1$ and $e_ie_j=0$ for $i\ne j$.
The map $f\colon R\to Re_1\oplus Re_2\oplus\dots\oplus Re_n$ defined by
$$
f(r)=\sum_{j=1}^n re_j
$$
is clearly a homomorphism of $R$-modules. If $r\in\ker f$, then $r1=0$. What about surjectivity? Suppose $r_j\in Re_j$, for $j=1,2,\dots,n$. Then $r_je_j=r_j$ and if we set $r=r_1+r_2+\dots+r_n$, we have
$$
f(r)=\sum_{j=1}^n re_j=
\sum_{j=1}^n\biggl(\,\sum_{i=1}^n r_i\biggr)e_j=
\sum_{j=1}^n\biggl(\,\sum_{i=1}^n r_ie_ie_j\biggr)=
\sum_{j=1}^n r_je_j=\sum_{j=1}^n r_j
$$
The two-sided ideal case is similar. The map $f$, in this case, is also a ring homomorphism, with each $B_i$ being a ring with unit $e_i$.
