Theorem: Chinese Remainder Theorem

Let $b_1, b_2, \ldots, b_r \in \Z$.
Let $n_1, n_2, \ldots, n_r$ be pairwise coprime positive integers.
Let $\ds N = \prod_{i \mathop = 1}^r n_i$.
Then the system of linear congruences:
{{begin-eqn}}
{{eqn | l = x
      | o = \equiv
      | r = b_1
      | rr= \pmod {n_1}
}}
{{eqn | l = x
      | o = \equiv
      | r = b_2
      | rr= \pmod {n_2}
}}
{{eqn | o = \vdots
}}
{{eqn | l = x
      | o = \equiv
      | r = b_r
      | rr= \pmod {n_r}
}}
{{end-eqn}}
has a solution which is unique modulo $N$:
:$\exists ! a \in \Z_{>0}: x \equiv a \pmod N$

Proof:
The mapping $\phi$ is indeed a ring homomorphism, because each canonical projection $\phi_i: A \to A / I_i$ is a ring homomorphism.
The kernel of $\phi$ is given by:
:$\ds \ker \phi = \set {x \in A: \forall i, 1 \le i \le n : x \in I_i} = \bigcap_{1 \mathop \le i \mathop \le n} I_i =: I$
It remains then to be proved that $\phi$ is surjective {{iff}} the ideals are pairwise coprime.
Stated explicitly, we will show that the statement:
:$\forall x_i \in A, 1 \le i \le n: \exists x \in A: x - x_i \in I_i, 1 \le i \le n$
holds {{iff}}: 
:$\forall i \ne j: I_i + I_j = A$
To reach this goal, we now define $e_i \in A / I_1 \times \cdots \times A / I_n$ so that a unity lies at the $i$th coordinate:
:$e_i := \tuple {0, \ldots, 0, 1_{A / I_i}, 0, \ldots, 0}$
=== Necessary Condition ===
We will start by showing the condition is necessary for surjectivity.
So suppose $\phi$ is surjective.
Then in particular, for each $i$, there is $a_i \in A$ such that $\map \phi {a_i} = e_i$.
Clearly, $\map {\phi_j} {a_i} = 0$ for $j \ne i$ while $\map {\phi_i} {1 - a_i} = \map {\phi_i} 1 - \map {\phi_i} {a_i} = 1 - 1 = 0$.
Hence for all $i \ne j$, we find:
:$1 = a_i + \paren {1 - a_i} \in I_j + I_i$
Since Sum of Ideals is Ideal, we can conclude $r \cdot 1 \in I_j + I_i$ for all $r \in R$.
This completes the proof that $I_i + I_j = R$.
{{qed|lemma}}
=== Sufficient Condition ===
We will now show the converse that the ideals being coprime is sufficient. 
Note that each $x \in A / I_1 \times \cdots \times A / I_n$ may then be written as:
:$x = \tuple {x_1 + I_1, \ldots, x_n + I_n} = \paren {x_1 + I_1} e_1 + \cdots + \paren {x_n + I_n} e_n$
for some choice of $x_i \in A$.
This implies that it is enough to find $a_i \in A, 1 \le i \le n$, such that:
:$\map \phi {a_i} = e_i$
because then:
{{begin-eqn}}
{{eqn | l = \map \phi {x_1 a_1 + \cdots + x_n a_n}
      | r = \map \phi {x_1} \map \phi {a_1} + \cdots + \map \phi {x_n} \map \phi {a_n}
      | c = 
}}
{{eqn | r = \tuple {\map \phi {x_1}, \ldots, \map \phi {x_n} }
      | c = 
}}
{{eqn | r = \tuple {x_1 + I_1, \ldots, x_n + I_n}
      | c = 
}}
{{eqn | r = x
      | c = 
}}
{{end-eqn}}
To construct the $a_i \in A$, we need that $a_i - 1 \in I_i$, but $a_i \in I_j$ for all $j \ne i$.
Since $I_i$ is coprime with the other ideals, we have that:
:$I_i + I_j = A, i \ne j$
In particular there exist $u_{i j} \in I_i$, $v_{i j} \in I_j$ for each pair $\tuple {i, j}$ with $i \ne j$ such that $u_{i j} + v_{i j} = 1$.
Define now $\ds a_i = \prod_{k \mathop \ne i} v_{i k}$. 
Then for $k \ne i$:
:$a_i = v_{i k} \tuple {v_{i 1} \cdots v_{i \paren {k - 1} } v_{i \paren {k + 1} } \cdots v_{i n} } \in I_k$
and:
{{begin-eqn}}
{{eqn | l = \map {\phi_i} {a_i}
      | r = \map {\phi_i} {\prod_{k \mathop \ne i} v_{i k} }
      | c = 
}}
{{eqn | r = \map {\phi_i} {\prod_{k \mathop \ne i} \paren {1 - u_{i k} } }
      | c = 
}}
{{eqn | r = \prod_{k \mathop \ne i} \map {\phi_i} {1 - u_{i k} }
      | c = 
}}
{{eqn | r = \prod_{k \mathop \ne i} \paren {1 - \map {\phi_i} {u_{i k} } }
      | c = 
}}
{{eqn | r = \prod_{k \mathop \ne i} 1
      | c = 
}}
{{eqn | r = 1
      | c = 
}}
{{end-eqn}}
Hence:
:$a_i - 1 \in I_i$
which verifies that $\map \phi {a_i} = e_i$.
This concludes the proof of the sufficiency.
{{qed|lemma}}
Now to conclude, let $\phi$ be surjective again.
Let $\tilde \phi$ be the injective homomorphism obtained by the First Isomorphism Theorem:
:$\map {\tilde \phi} {x + I} = \tuple {x_1 + I_1, \ldots, x_n + I_n}$
for all $x \in A$.
It immediately follows that $\tilde \phi$ is also surjective, and hence constitutes an isomorphism.
{{qed}}