Congruences
It all started a long time ago when someone noticed that when you add two integers, the remainders get added too. He probably ran and told this to a friend who asked him " Hey, what about multiplication?" They found it worked for multiplication too. Think of two integers and add them up. Now consider the remainders left by these integers when divided by another integer.
Consider 9 + 10 = 19, and consider the remainders when these numbers are divided by 7.
2 + 3 = 5.
Now try multiplication 9 . 10 = 90, and the remainders,
2 . 3 = 6.
It seems that in those times, the Greeks, Indians and Chinese talked to each other a lot about these things, and developed quite a bit of knowledge about this kind of things. The Indians and Chinese particularly enjoyed creating and solving a variety of interesting problems ( most of which had very little to do with everyday life! ), the solutions of which involved thinking about remainders. It was tough though, because they did not even have the algebraic notation that we take for granted today. Even after the advent of Algebra, it took a couple of hundred years before Gauss in Europe, came up with the notation we use today for congruences. This notation probably opened the floodgates, for in the next couple of hundred years we saw a major outpouring of discoveries, conjectures, and theorems dealing with integers that formalized and rigorized those ideas.
Gauss came up with the congruence notation to indicate the relationship between all integers that leave the same remainder when divided by a particular integer. This particular integer is called the modulus, and the arithmetic we do with this type of relationships is called the Modular Arithmetic. For example, the integers 2, 9, 16, all leave the same remainder when divided by 7. The special relationship between the numbers 2, 9, 16 with respect to the number 7 is indicated by saying these numbers are congruent to each other modulo 7, and writing,
16 º 9 º 2 ( mod7).
Thus the intuitive idea behind the congruency concept is as follows.
Intuitive idea : If two numbers a and b leave the same remainder when divided by a third number m, then we say "a is congruent to b modulo m", and write a º b ( mod m ).
The following definition formalizes this concept.
Defintion: a º b ( mod m ) if and only if m | (a - b).
Using the definition of "divides", m | (a - b) can be translated to a - b = km for some integer k.
Although some books give this as a lemma or theorem, it is always best to think of this as an immediate extension of the definition of the congruency using the definition of the divides.
Also note that the intuitive idea we mentioned at the outset can be easily derived from the formal definition above. Some texts may give this too as a theorem or lemma.
The conclusion in the next paragraph however, has far reaching implications, and for this reason we list it as our first Theorem. Though this theorem seems obvious, it needs an important theorem from Divisibility for its proof.
Theorem 1: Every integer is congruent ( mod m) to exactly one of the numbers in the list :-
0, 1, 2, . (m - 2), (m -1).
Proof: From a theorem in Divisibility, sometimes called Division Algorithm, for every integer a, there exist unique integers q and r such that a = qm + r, with 0 £ r < m. This shows a - r = qm
or m| (a - r). Hence a º r ( mod m ).
Since r is a unique integer, and 0 £ r < m, it follows that r is only one of the integers on the list.
In the above proof, we could have jumped from a = qm + r to a º r ( mod m ) using the intuitive idea. You can always do this in your proofs with a sentence like "since a = qm + r we have a º r ( mod m )". This is perfectly fine, because as I mentioned earlier many texts give the intuitive idea as a lemma.
The number r in the proof is called the least residue of the number a modulo m.
Exercise 1: Find the least residue of 100 (a) mod 3 , (b) mod 30, (c) mod 98, and (d) mod 103.
Congruences act like equalities in many ways. The following theorem is a collection of the properties that are similar to equalities. All of these easily follow directly from the definition of congruence.
Pay particular attention to the last two, as we will be using them quite often.
Theorem 2: For any integers a, b, c, and d
(a) a º a ( mod m )
(b) If a º b ( mod m ), then b º a ( mod m ).
(c) If a º b ( mod m ) and b º c ( mod m ) , then a º c ( mod m ).
(d) If a º b ( mod m ) and c º d ( mod m ) , then a ± c º b ± d ( mod m ).
(e) If a º b ( mod m ) and c º d ( mod m ) , then ac º bd ( mod m ).
Exercise 2: Verify parts (d) and (e) of the theorem in the following way. Write down two separate congruences with the same modulus that we know are true, such as 9 º 2 ( mod 7 ) and 17 º 3 ( mod 7 ). Now add and multiply these congruences to get two new congruences. Check if the new congruences are true.
Exercise 3: Prove the following statement. "If a º b ( mod m ), then a2 º b2 ( mod m )".
Hint: Do not fall back on the definition. Use the theorem above instead!
You have probably guessed that the statement in Exercise 3 can be generalized to say,
If a º b ( mod m ), then ak º bk ( mod m ), where k is any integer.
This statement is indeed true and very useful. We will be raising a congruence to the power of an integer of our choice quite often. Note this statement can be proven easily by the repeated application of the method you used in Exercise 3, or more precisely, by using Induction.
Have you ever wondered what is the use of "lame" properties like (a) in the last theorem? Well, read on. The last two properties ( (d) and (e) ) in the theorem basically say that we can add or multiply congruences. But how about adding an equation to a congruency or multiplying a congruency by an equation? Note that "adding an equation to a congruency" is a fancy way of saying adding the same integer to both sides of a congruency. Similarly the other fancy phrase means multiplying both sides of a congruency by the same number. Intuition tells us that these two operations must be permissible. In fact, not only they are allowed, but also we will be using them quite often. Let's state them as a theorem and prove it.
Theorem 3: For any integers a, b, and c
(a) If a º b ( mod m ), then a + c º b + c ( mod m ).
(b) If a º b ( mod m ), then ca º cb ( mod m ).
Proof: Let's prove (b). Proof for (a) is very similar.
From Theorem 2 part (a), c º c ( mod m ).
It is given that a º b ( mod m ). Then by Theorem 2 part (e), we have
ca º cb ( mod m ).
Even before you had a look at the proof above, you probably guessed that the "lame" properties are there for a very good reason. The proof above gives us a glimpse of this "reason".
Exercise 4: Start with a congruency that we know is true, like 9 º 2 ( mod 7 ). Now think of an integer and multiply both sides of the congruency by that integer. Check if the congruency still holds.
Repeat with another integer. Now repeat the whole process, starting with a fresh congruency, this time with a non-prime modulus.
Conspicuously missing from all the properties sated so far is the division of a congruence. Can we divide one congruency by another or by an integer? Unfortunately, the answer in general, is no. However, not all is lost. We are allowed to divide a congruency by some special numbers. But we will postpone this until the end of this chapter, as this operation is more useful when dealing with the area of the next chapter, which are linear congruences.
Now we will look at some examples to appreciate the usefulness of the congruences.
Example 1: Find the remainder when 25 100 + 115 00 is divided by 3.
We observe that 25 º 1 ( mod 3 ) and 11 º -1 ( mod 3 ). Raising these to the appropriate powers, 25 100 º 1 100 ( mod 3 ) and 11 500 º (-1) 500 ( mod 3 ). That is,
25 100 º 1 ( mod 3 ) and 11 500 º 1 ( mod 3 ). Adding these congruecies, we get 25 100 + 11 500 º 2 ( mod 3 ).
Thus the remainder is 2.
Example 2: What is the remainder when 3 5555 is divided by 80?
We notice that 3 4 = 81 º 1 ( mod 80 ). That is, we have 3 4 º 1 ( mod 80 ) ------------ (1)
We also know that 5555 when divided by 4, gives a quotient of 1388 and the remainder 3.
Hence, 3 5555 = (3 4) 1388. 3 3. Now raising congruence (1) to the power of 1388, we have
(34)1388º1(mod80).
Multiplying this by 3 3 we get (3 4) 1388 . 3 3 º 3 3 ( mod 80 ).
Which means, 3 5555 º 27 ( mod 80 ).
Thus the required remainder is 27. Unfortunately you cannot verify this by using your pocket calculator!
Exercise 5: Find the remainder when 5 1000 is divided by 126.
Example 3: Show that 3 1000 + 3 is divisible by 28.
We know that 3 3 = 27 º -1 ( mod 28 ). Further, 1000 = 3 . 333 + 1.
Now, (33)333 º (-1)333 º -1 ( mod 28 ).
3 1000 = (33)333 . 31 º -1 . 3 º -3 ( mod 28 ).
We also know that 3 º 3 ( mod 28 ). Adding the last two congruences,
3 1000 + 25 º -3 + 3 º 0 ( mod 28 ).
Thus 28 divides 3 1000 + 3 .
The problem in the following example needs a little more ingenuity to solve. It is a marvelous example of the power of congruences!
Example 4: Prove that 2 5n + 1 + 5 n + 2 is divisible by 27 for any positive integer n.
Note that 2 5n + 1 = 2 . 2 5n , and 5 n + 2 = 25. 5 n.
Now 25 = 32 º 5 ( mod 27 ) and hence (25)n º 5n ( mod 27 ), and 2 . (25)n º 2 . 5n ( mod 27 ).
Therefore 2 5n + 1 + 5 n + 2 º 2 . 5 n + 25. 5 n ( mod 27 ).
º 27 . 5 n ( mod 27 )
º 0 ( mod 27 ).
Which shows 27 divides the given expression.
Now try the next exercise without looking back at Example 4.
Exercise 6: Prove that 2 n + 4 + 3 3 n + 2 is divisible by 25 for any positive integer n.
Example 5: Prove that in the base 8 system, a number is congruent to the sum of its "digits" modulo 7.
Suppose that N is written as ak ak-1 .. a1a0 in the base 8 system.
Then N = ak.8k + ak-1.8k-1 + ...+ a1.81 + a0.1
Now 8 º 1 ( mod 7 ) and raising the power, we have 8n º 1 ( mod 7 ) for all integer n.
Thus we have
ak.8k º ak ( mod 7 ), ak-1.8k-1 º ak-1 ( mod 7 ), ... a1.81 º a1 ( mod 7 ), a0.1 º a0 ( mod 7 ).
Adding, we get N = ak.8k + ak-1.8k-1 + ...+ a1.81 + a0.1 º ak + ak-1 + ...+ a1 + a0 ( mod 7 )
Dividing a Congruence
Finally we are going to see if we can divide a congruence. Consider a simple congruency, that we know is true, for example, 14 º 4 ( mod 10 ). If we divide both sides by 2, we get 7 º 2 ( mod 10 ), which clearly is not true. On the other hand, the true congruence 33 º 3 ( mod 10 ), upon division by 3 gives 11 º 1 ( mod 10 ) which is also true. The following theorem tells us when and with what can we divide a congruence. Essentially, it says that we can divide by a number that is relatively prime to the modulus.
Theorem 3: ca º cb ( mod m ) implies a º b ( mod m ) if and only if (c, m) = 1.
Proof: Note that we already know that a º b ( mod m ) implies ca º cb ( mod m ), from Theorem 2. We will prove the other direction, which is what is new, and that allows us to divide. That is,
if (c, m) = 1, then ca º cb ( mod m ) implies a º b ( mod m ).
ca º cb ( mod m ) implies m | ( ca - cb ). That is, m | c(a - b).
Since (c, m) =1, a theorem from divisibility tells us that m | ( a- b).
Hence a º b ( mod m ).
Exercise 7: Consider the following congruences, where x is an integer. State which of these can be simplified by division, and if so, state the biggest number by which you are allowed to divide.
4x º 2 ( mod 2 ) 4x º 2 ( mod 3 ) 42x º 21 ( mod 12 ) 400x º 200 ( mod 201 )
400x º 200 ( mod 205 ) 64x º 48 ( mod 101 ) 48x º 42 ( mod 10 )