Introduction
A fairly common situation to encounter, whether it be in daily life or during a maths Olympiad paper, is one in which we want to find a number that satisfies several modular congruences. For example, let’s say we wanted to find a number that’s one more than a multiple of four, five more than a multiple of seven, and two more than a multiple of nine. Written slightly differently, we want to find integers x such that:

x \equiv 1 \pmod{4}
x \equiv 5 \pmod{7}
x \equiv 2 \pmod{9}

Since x \equiv 1 \pmod{4}, we can write that x=4k+1, k\in \mathbb{Z}. Substituting this in to the second equation, we see that:

4k+1 \equiv 5 \pmod{7}
\implies 4k \equiv 4 \pmod{7}
\implies k \equiv 1 \pmod{7}

Hence we see that x=4k+1=4(7m+1)+1=28m+5, m \in \mathbb{Z}. Now we’ll simply repeat what we’ve done but for the third equation:

28m+5 \equiv 2 \pmod{9}
\implies 28m \equiv 6 \pmod{9}
\implies m \equiv 6 \pmod{9}

So we get that x=28(9n+6)+5=252n+173, n \in \mathbb{Z}. Setting n=0, we get the smallest positive value x can take: 173. To generate more solutions, all we have to do is add on some multiple of 252 to 173. As you may have already observed, 252 is the lowest common multiple of 4,7, and 9, which is in fact just 4 \times 7 \times 9 since the numbers are pairwise coprime. And this is not very surprising at all; once we’ve found some solution, such as 173, we can add a multiple of the LCM of the three numbers and it won’t change their value modulo 4,7 or 9, and hence gives us another solution. This suggests that for any number of modular congruences that involve the moduli n_1,n_2,...,n_k where n_1,n_2,...,n_k are pairwise coprime, we’ll get a distinct solution modulo n_1n_2...n_k. This is known as the Chinese Remainder Theorem and is typically written as the following:

Chinese Remainder Theorem: Let n_1,n_2,...,n_k \in \mathbb{N} be such that gcd(n_i,n_j)=1 \ \forall i \neq j and suppose a_1,...,a_k \in \mathbb{Z}. Then

x \equiv a_1 \pmod{n_1}
x \equiv a_2 \pmod{n_2}
.
.
.
x \equiv a_k \pmod{n_k}

has a unique solution modulo n_1n_2...n_k.

Proof
Now let’s prove this. We’ll begin by showing we can always construct a solution that satisfies all of the modular congruences.

Set N=n_1...n_k and N_i=\frac{N}{n_i}. Clearly gcd(N_i,n_i)=1 and so by Bézout’s Identity we have that:
\exists \ x_i,y_i \in \mathbb{Z} \ s.t.  \ N_ix_i+n_iy_i=1
\implies N_ix_i \equiv 1 \pmod{n_i}
\implies (N_ia_i)x_i \equiv a_i \pmod{n_i}

We set X=N_1a_1x_1+N_2a_2x_2+...+N_ka_kx_k and notice that if i \neq j then N_i \equiv 0 \pmod{n_j}. For any arbitrary j \in \{1,...,k\} we thus have that X \equiv N_ja_jx_j \equiv a_j \pmod{n_j}

\therefore \forall  \ j \in \{1,...,k\}, X \equiv a_j \pmod{n_j}.

Hence we see that this number we have constructed, X, satisfies all of the modular congruences as desired. Having shown a solution exists modulo n_1...n_k we’ll now show that the solution is unique:

Say we have a solution x and we’ll suppose that we have another solution y. Consequently, we have that:

x \equiv a_1 \pmod{n_1}
.
.
.
x \equiv a_k \pmod{n_k}

and

y \equiv a_1 \pmod{n_1}
.
.
.
y \equiv a_k \pmod{n_k}

These modular congruences imply that

x-y \equiv 0 \pmod{n_1}
.
.
.
x-y \equiv 0 \pmod{n_k}

and consequently we have that

x-y|n_1
.
.
.
x-y|n_k

From this we see that x-y|lcm(n_1,...,n_k)
\implies x-y|N
\implies x \equiv y \pmod{N} as desired.

Hence we’ve shown that a solution modulo n_1...n_k always exists and that this solution is unique. \quad \blacksquare

Example
Let’s try a problem using the method we used during the proof. Say we are trying to solve the set of modular congruences

x \equiv 1 \pmod{3}
x \equiv 4 \pmod{5}
x \equiv 9 \pmod{7}

We set N=3 \times 5 \times 7=105. We then set N_1=\frac{105}{3}=35,N_2=\frac{105}{5}=21, and N_3=\frac{105}{7}=15. Now we check what x_1, x_2, and x_3 are.

x_1 \equiv (35)^{-1} \equiv (2)^{-1} \equiv 2 \pmod{3}
x_2 \equiv (21)^{-1} \equiv (1)^{-1} \equiv 1 \pmod{5}
x_3 \equiv (15)^{-1} \equiv (1)^{-1} \equiv 1 \pmod{7}

So, defining X=N_1a_1x_1+N_2a_2x_2+N_3a_3x_3 we get that X= (35)(1)(2)+(21)(4)(1)+(15)(9)(1)=289 and we observe that 289\equiv 79 \pmod{105} so we get that our solutions must be 79 \pmod{105}.

Trending