Do you remember when you were asked to solve a system of equations back in algebra class? In the case that you don’t here’s a brief reminder. The goal of these types of questions were to have you find a value of x and/or y that satisfied two equations at the same time. For example, satisfies and Or, and satisfy and simultaneously.
We are about to do something similar with modular congruences. Modular congruence is the fancy mathy way to say that we are going to find solutions (values of ) that satisfy congruences like
Let’s get started!
Solving A Linear Congruence
Theorem: (Solvability of Linear Congruences) Let and be integers and denote Then, the linear congruence has a solution if and only if .
Proof: It’s usually helpful to break up “if and only if” proofs into two parts. So let’s do that:
Forward: If there is a solution to , then
This proof mimics proofs that we saw back in Newbie at Number Theory (Part 3): ax+by = 1. Let be a solution to the linear congruence By definition of congruence we deduce,
, for some integer .
Solving for ,
Recall so that and therefore
Backward: If then, there is a solution to .
Let and hence for some integer We aim to show that there is a solution to Since we deduce using Bézout’s Identity that there are integers and such that,
Multiplying through by gives,
Letting we have found our desired solution, since the above equation is equivalent to : .
Now that we know when there is a solution, we’d like to find a general form of the solution. For this we’ll need something that we’ve seen before, but cast in a new light.
Theorem (Solution to ): Let and be integers and denote Then, the Diophantine equation has a solution if and only if . Moreover, there are infinitely many solutions of the form:
and
For this one I will refer you to the section Back to The Proof of Zero or Infinite? in the post about the equation We’ve done the work before so why do it again?
Corollary (Solution Form): Let and be integers and denote If then, the linear congruence has a solution set:
Where is the solution guaranteed by Theorem: (Solvability of Linear Congruences) and is an integer.
Proof: Observe that is equivalent to Therefore, they have the same solution set. (See the proof of Theorem: (Number of Solutions of Linear Congruences) for more details.)
Back to Linear Congruences
Not so bad huh? Well, as long as you are comfortable with Bézout’s Identity! Our new goal is to determine how many solutions there are. This might sound like a strange question since if is a solution then for every integer we also have as a solution by he above corollary. To see it explicitly observe,
So we have infinitely many solutions, one for each . So, we’re done right? There are infinitely many solutions.
Well, yes this is true, however, when we are working (mod n), we don’t really think of and as different solutions since for all integers What I should have asked is, how many different solutions are there (mod n)? In other words, we only count solutions and as distinct if they are incongruent (mod n) ie
Theorem: (Number of Solutions of Linear Congruences) Let and be integers and denote If then there are incongruent solutions (mod n) to the linear congruence
Proof: Let and be integers and denote By our first theorem we know that a solution exists, we just have to show that there are incongruent solutions (mod n). To that end, let be such a solution. Then Corollary (Solution Form) we know the form of the solution is
We therefore make the claim that the family of incongruent solutions (mod n) is given by:
So we need to show that (i) every one of the integers above is a solution, (ii) that they are incongruent solutions (mod n), (iii) and that any of the infinitely many solutions to is be congruent to one of the solutions above (mod n).
NOTE: Since we know there is a solution, we are letting be one of them for the rest of the proof.
(i) Every integer of the form is a solution to
We’ll use that is a solution to see that is a solution too,
Where we used that implies that is an integer. So, we see that every is a solution.
(ii) They are all incongruent (mod n).
Let and be two solutions from our set such that and
With a little rearranging we deduce the following,
Where and is an integer. Canceling the and moving the over to the right,
Since we chose it must be that Or, that . This implies that since and is an integer. Therefore and hence our two solutions where really the same solution.
(iii) Every solution (mod n) is in our family of solutions.
Let be a solutions to By our Corollary (Solution Form), it’s of the form:
If then is in our solution set, so let’s assume that is outside of this interval. By the division algorithm we write for Thus,
And since we conclude that is in our solution set.
We’re ready for the pièce de résistance.
The Chinese Remainder Theorem
Theorem: (The Chinese Remainder Theorem) Let be positive intergers that are pairwise relatively prime (ie when ). Then the system of linear congruences:
has a unique soltion where
Proof: We’ll not only show that there is such a solution, we will also construct an expression for the solution!
Let for Observe that for all Therefore, by our first theorem there is a solution to the linear congruence,
for all Denote this solution . We claim that,
is our solution to the system of congruences. To see this, observe that,
Recall we already showed that for all so that for
We chose so that . Thus,
This is true for all and therefore is our desired solution.
All we have left to do is show that is unique To this end, let be another solution to the set of congruences. Then, for any
Therefore, for all Recall that all the are pairwise relatively prime so that when Let’s look at when and . Then,
implying
The second line implies that or from the first line. And by Euler’s Lemma (see footnote1) . Thus, But we can apply this again with to get
implying both and by Euler’s Lemma. Thus, and We’ll do this for all and get,
Hence,
as we set out to show.
Closing Remarks
The Chinese Remainder theorem is a beautiful result that has been known for thousands of years! See Harvard’s: Historical development of the Chinese remainder theorem and Britannica: Chinese Remainder Theorem. I hope you had as much fun as I did!
Next time we will do an example of a problem that requires The Chinese Remainder theorem.
Footnote:
- Euler’s Lemma: Let
,, andbe integers. Ifand. Then,. ↩︎

Leave a comment