Recap & Summary
Last class period we talked about solving linear congruence equations. Among other techniques, we discussed multiplicative inverses and how they can be used to help solve equations. Along the way we made the statement
if and only if
We did this because 27 is the multiplicative inverse of 5. But recall that we have
Lemma:
if and only if
.
In light of this result, our multiplication by 27 on both sides of the equivalence above requires that we have
. We could have checked this by using the Euclidean Algorith, but we claim that we could instead prove
If b is the multiplicative inverse of a modulo m, then
.
To see that this is true, notice that if b is the multiplicative inverse of a, then a must be the multiplicative inverse of b. Now since b has a multiplicative inverse modulo m, we know that we must have
.
In today's class, we'll be discussing the Chinese Remainder Theorem and Wilson's Theorem. The former is a technique for finding simultaneous solutions to multiple congruence equations, whereas the latter is a congruence equation which characterizes primes.
The Chinese Remainder Theorem
Recall that in the last class period we showed that the congruence equations
(1)
has integer solutions
. The way we came about these solutions was simply by using a "guess and check" technique. What we'd like to do is to develop a more systematic way of coming at this problem. For that, we have
The Chinese Remainder Theorem: If
are pairwise relatively prime integers, then the congruence equations
for each
have a unique solution modulo
.
Proof: We'll break the proof into two pieces: first we'll construct a simultaneous solution to the given congruences, and then we'll show this solution is unique in the given modulus.
To start, we'll define
, and for each
we'll write
for
. Now since the
are pairwise relatively prime, you showed in your homework (in the course of #43(c) in chapter 1) that
. Hence for every i, there exists an integer
which satisfies
.
With the
so constructed, we claim that

is a solution to all the congruences
. To see this is true, fix an integer i, and we'll show that
. Notice that for every
we have
, since
is the product of all the moduli except for
— in particular,
shows up in the product which defines N_j$]]. Hence we have

But now recall that
, and so the previous equation becomes
as desired.
Hence we've constructed a solution. To show that all solutions are equivalent modulo
, notice that if
are two solutions to the congruence equations, then we have
for every i/. It follows that
for every i, and so
. By homework 43(c) in Chapter 1, since the
are relatively prime we can conclude that
. 
Example: CRT in Action
Suppose that we're given the simultaneous congruences
(4)
Our proof of the CRT says that we need to start by computing
, which in this case are given as
,
and
. With these numbers in hand, we now need to solve the congruence equations
for each i.
To solve
, notice that
. Hence we're really trying to solve
. Now we could solve this equation by using the Euclidean Algorithm to express the gcd of 10 and 3 as a linear combination of the two, but since the modulus is so small, we can just use "guess and check" to find this inverse. For this, notice that
, and that
. Hence we have
.
To solve
, we'll do a similar trick: since
, we're really trying to solve
. But this makes it clear that we can take
.
Finally, we need to solve
. Since
, we're trying to solve
. Using "guess and check", we see that
is the solution we're after.
Now that we've computed all the appropriate terms, our desired solution modulo
is therefore

You can expand that out and see what its least non-negative residue is, but you don't need to if you don't want.
The Chinese Remainder Theorem is a really powerful tool for solving simultaneous congruences, but it only tells us how to solve problems where the given moduli are pairwise relatively prime. There are plenty of "real life" scenarios in which the moduli for your system of congruences won't be so nice, though, in which case it's handy to know this stronger version of the CRT:
Strengthened Chinese Remainder Theorem: For arbitrary integers
and congruence equations
, there exists a simultaneous solution if and only if
for every
. When a solution exists, it is unique modulo the least common multiple of the
.
We won't worry about proving this for now, but it is good to have in mind.
Example: The Strengthened CRT
Suppose someone asks you to solve the simultaneous equations
(6)
Since you know that
and since
, you know that this simultaneous system has no solutions.
Wilson's Theorem
We'll end class today by discussing Wilson's Theorem. This shows us another reason that modular arithmetic is powerful: it gives a modular criterion for determining whether an integer is prime or not. The statement of the theorem is as follows:
Wilson's Theorem: An integer n satisfies
if and only if n is prime.
In order to prove the theorem, we'll start with the following
Lemma: For a prime p, the only congruence classes which are their own inverses (modulo p) are
. That is to say, the only a such that
are those a which satisfy
.
Proof: It isn't hard to see that if
, then we must have
. So suppose we're told that
, and we'll show that
.
Notice that the congruence
means that
. Euclid says that either
— in which case
— or
— in which case
. In either case, then, we get the desired conclusion.
Example: The prime 11
To see why this is handy, let's compute the inverses of each congruence class modulo 11. These are given by
| The number | Its Inverse mod 11 |
|---|---|
| 1 | 1 |
| 2 | 6 |
| 3 | 4 |
| 4 | 3 |
| 5 | 9 |
| 6 | 2 |
| 7 | 8 |
| 8 | 7 |
| 9 | 5 |
| 10 | 10 |
This means when I compute
modulo 11, I get


With this as our motivating example, we're ready to prove
If p is prime, then [{$(p-1)! \equiv -1 \mod{p}$]].
Proof: If p is prime, then we know that every integer between 1 and p-1 is relatively prime to p. We'll take the integers between 1 and p-1 and put them into groups by pairing a number a with its multiplicative inverse modulo p. According to our lemma, only 1 and -1 can't be paired with another (different) integer in this way. Hence we can rearrange the numbers between 2 and p-2 so that they sit in a sequence where every pair of numbers multiplies to 1 modulo p. Hence we have
(8)







if and only if 
if and only if
.
are pairwise relatively prime integers, then the congruence equations
.
for every
. When a solution exists, it is unique modulo the least common multiple of the
if and only if n is prime.
. That is to say, the only a such that
are those a which satisfy