Find All Solutions to the System of Congruences
Chinese Remainder Theorem
Given pairwise coprime positive integers and arbitrary integers , the system of simultaneous congruences
has a solution, and the solution is unique modulo .
The following is a general construction to find a solution to a system of congruences using the Chinese remainder theorem:
-
Compute .
-
For each , compute
-
For each , compute using Euclid's extended algorithm ( exists since are pairwise coprime).
-
The integer is a solution to the system of congruences, and is the unique solution modulo .
To see why is a solution, for each , we have
where the second line follows since for each , and the third line follows since .
Now, suppose there are two solutions and to the system of congruences. Then , and since are relatively prime, we have that divides , or
Thus, the solution is unique modulo .
When a system contains a relatively small number of congruences, an efficient process exists to apply the Chinese remainder theorem.
Solve the system of congruences
Begin with the congruence with the largest modulus, Rewrite this congruence as an equivalent equation:
Substitute this expression for into the congruence with the next largest modulus:
Then solve this congruence for
Rewrite this congruence as an equivalent equation:
Substitute this expression for into the expression for
Now substitute this expression for into the final congruence, and solve the congruence for
Write this congruence as an equation, and then substitute the expression for into the expression for
This equation implies the congruence
This happens to be the solution to the system of congruences.
Process to solve systems of congruences with the Chinese remainder theorem:
For a system of congruences with co-prime moduli, the process is as follows:
Begin with the congruence with the largest modulus, Re-write this modulus as an equation, for some positive integer
Substitute the expression for into the congruence with the next largest modulus,
Solve this congruence for
Write the solved congruence as an equation, and then substitute this expression for into the equation for
Continue substituting and solving congruences until the equation for implies the solution to the system of congruences.
A box contains gold coins.
If the coins are equally divided among six friends, four coins are left over.
If the coins are equally divided among five friends, three coins are left over.
If the box holds the smallest number of coins that meets these two conditions, how many coins are left when equally divided among seven friends?
The Chinese remainder theorem can be applied to systems with moduli that are not co-prime, but a solution to such a system does not always exist.
Solve the system of congruences
Note that the greatest common divisor of the moduli is 2. The first congruence implies and the second congruence also implies Therefore, there is no conflict between these two congruences. In fact, the system of congruences can be reduced to a simpler system of congruences by dividing out the GCD of the moduli from the modulus of the first congruence:
Write the second congruence as an equation:
Substitute into the first congruence and solve for
Write this congruence as an equation, and then substitute into the equation for
This gives as the solution to the system of congruences. Note that
The number of students in a school is between 500 and 600. If we group them into groups of 12, 20, or 36 each, 7 students are always left over. How many students are in this school?
Whether or not a system of congruences has solutions depends on if there are any conflicts between pairs of congruences.
Show that there are no solutions to the system of congruences:
Note that each modulus is divisible by 3. The first and second congruences imply that However, the third congruence implies that Since these both cannot be true, there are no solutions to the system of congruences.
A system of linear congruences has solutions if and only if for every pair of congruences within the system,
Furthermore, if solutions exist, then they are of the form
for some integer
Brahmagupta has a basket full of eggs. When he takes the eggs out of the basket 2 at a time, there is 1 egg left over. When he takes them out 3 at a time, there are 2 eggs left over. Likewise, when he takes the eggs out 4, 5, and 6 at a time, he finds remainders of 3, 4, and 5, respectively. However, when he takes the eggs out 7 at a time, there are no eggs left over.
What is the least amount of eggs that could be in Brahmagupta's basket?
The real life application of the Chinese remainder theorem might be of interest to the reader, so we will give one such example here. One use is in astronomy where events may occur regularly, with periods and with the event happening at times This means that the events occur simultaneously at time where for all . A simple illustration of this is the orbit of planets and moons, as well as eclipses.
Comets 2P/Encke, 4P/Faye, and 8P/Tuttle have orbital periods of 3 years, 8 years, and 13 years, respectively. The last perihelions of each of these comets were in 2017, 2014, and 2008, respectively.
What is the next year in which all three of these comets will achieve perihelion in the same year?
For this problem, assume that time is measured in whole numbers of years and that each orbital period is constant.
Sometimes, a problem will lend itself to using the Chinese remainder theorem "in reverse." That is, when a problem requires you to compute a remainder with a composite modulus, it can be worthwhile to consider that modulus's prime power divisors. Then, the Chinese remainder theorem will guarantee a unique solution in the original modulus.
What are the last two digits of
Observe that and . Then by the Chinese remainder theorem, the value is in correspondence with the solutions to the simultaneous congruences
Now,
Then the Chinese remainder theorem gives the value
Therefore, the last two digits of are 49. Note that the above system of congruences is obtained for any odd exponent of 49, so the solution using the Chinese remainder theorem also gives that the last two digits of are 49 for any positive odd value of .
The Chinese remainder theorem can be useful for proofs.
Show that there exist consecutive integers such that each is divisible by the cube of some integer greater than 1.
Let be distinct prime numbers. Now, consider the simultaneous congruences
Since are pairwise coprime, this system of equations has a solution by the Chinese remainder theorem. Then the integers for are 99 consecutive integers such that divides .
Try these problems to test what you know.
Find the smallest whole number that, when divided by 5, 7, 9, and 11, gives remainders of 1, 2, 3, and 4, respectively.
A general counts the number of surviving soldiers of a battle by aligning them successively in rows of certain sizes. Each time, he counts the number of remaining soldiers who failed to fill a row. The general initially had 1200 soldiers before the battle; after the battle
- aligning them in rows of 5 soldiers leaves 3 remaining soldiers;
- aligning them in rows of 6 soldiers leaves 3 remaining soldiers;
- aligning them in rows of 7 soldiers leaves 1 remaining soldier;
- aligning them in rows of 11 soldiers leaves 0 remaining soldiers.
How many soldiers survived the battle?
Four friends--let's call them A, B, C, and D--are planning to go to the concert, but they realize that they are a few dollars short to buy the tickets ($50 per ticket).
We know that each of them has an integer amount of dollars and that
if borrowed $ from , then would have of 's balance;
if borrowed $ from , then would have of 's balance;
if borrowed $ from , then would have of 's balance.
At least how much more money (in $) do they need all together in order to afford 4 tickets?
Find the last three digits of the number
You are building a rainbow building from cubic unit blocks.
First, you put together 3 cubes each to form a group of columns and discard the remaining cubes.
Then, you put together 5 columns each to form a group of cubic bases and discard the remaining columns, as before.
Finally, you stack 7 bases over one another to build the desired cuboid structure, as shown above, and discard all the other bases, as usual.
If there are a total of 52 discarded cubes, and is a multiple of 11, what is the least possible value of
What is the remainder when is divided by
Find the last two non-zero digits in the number above.
-
Fermat's Little Theorem
-
Linear Diophantine Equations
-
Wilson's Theorem
Find All Solutions to the System of Congruences
Source: https://brilliant.org/wiki/chinese-remainder-theorem/