Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MATH10040 Chapter 3: Congruences and the Chinese Remainder Theorem 1. Congruence modulo m Recall that Rm (a) denotes the remainder of a on division by m. Thus, by the division algorithm, 0 ≤ Rm (a) < m and a = mt + Rm (a) for some t ∈ Z; The condition a = mt + Rm (a) for some t can be re-written a − Rm (a) = mt for some integer t; i.e. m|a − Rm (a). Thus Rm (a) is the unique integer satisfying m|a − Rm (a) and 0 ≤ Rm (a) < m. Lemma 1.1. Fix an integer m ≥ 1. Let a, b ∈ Z. The following are equivalent: (1) m|a − b (2) a = b + ms for some s ∈ Z (3) Rm (a) = Rm (b) Proof. (1) ⇐⇒ (2): m|a − b if and only if there exists s ∈ Z with a − b = ms if and only if a = b + ms for some s ∈ Z. (2)=⇒ (3): Suppose that a = b + ms for some s ∈ Z. Now, b = mt + Rm (b) for some t ∈ Z. Thus a = m(t + s) + Rm (b) and 0 ≤ Rm (b) < m. By the uniqueness part of the division algorithm, Rm (a) = Rm (b). (3)=⇒ (2): Suppose that Rm (a) = Rm (b). Call this number r. Then a = mt + r and b = ms + r for some s, t ∈ Z. It follows that a − b = m(t − s) is a multiple of m. Definition 1.2. We say that a is congruent to b modulo m and write a ≡ b (mod m) if m|a − b (i.e. if any of the equivalent conditions of the Lemma hold). Here the number m is called the modulus of the congruence. Example 1.3. 17 ≡ 3 (mod 7). 17 ≡ 10 (mod 7). 10 ≡ 3 (mod 7). 10 ≡ 87 (mod 7). Example 1.4. Which numbers are congruent to 13 modulo 6? Answer: a ≡ 13 (mod 6) if and only if a = 13 + 6t for some t ∈ Z; i.e. if and only if a is one of the numbers . . . , 13 − 12, 13 − 6, 13, 13 + 6, 13 + 12, 13 + 18, . . . 1 2 So a ≡ 13 (mod 6) if and only if a is one of the numbers . . . , 1, 7, 13, 19, 25, 31, . . . (Note: Since 13 ≡ 1 (mod 6), this is also the list of numbers which are congruent to 1 modulo 6; i.e. this is the list of numbers which leave remainder 1 on division by 6.) Remark 1.5. Observe that if m ≥ 1 and a ∈ Z, then the set of numbers which are congruent to a modulo m are the numbers in the list . . . , a − 2m, a − m, a, a + m, a + 2m, a + 3m, . . . This is a (doubly) infinite sequence of numbers. The difference between successive terms is always m. (Thus this is an arithmetic progression with common difference m.) Remark 1.6. Of course, we always have that a ≡ Rm (a) (mod m) since a = Rm (a) + mt for some t ∈ Z. Thus Rm (a) is the unique number satisfying 0 ≤ Rm (a) < m and a ≡ Rm (a) (mod m). Definition 1.7. Given m > 1 and any integer a, the set of all integers which are congruent to a modulo m is called the congruence class of a modulo m. Thus the congruence class of a modulo m is the set consisting of the integers . . . , a − 2m, a − m, a, a + m, a + 2m, a + 3m, . . . Remark 1.8. Observe that, from the definition, m|a if and only if a ≡ 0 (mod m). We will use this repeatedly below; problems about divisibility can be rephrased as problems about congruences and vice versa. What turns the notion of congruence into a very powerful mathematical tool is the following crucial Theorem: Theorem 1.9 (Algebra of Congruences). Let m ≥ 1. (1) If a ≡ b (mod m) and b ≡ c (mod m) then a ≡ c (mod m). (2) If a ≡ a0 (mod m) and b ≡ b0 (mod m) then a + b ≡ a0 + b 0 (mod m). (3) If a ≡ a0 (mod m) and b ≡ b0 (mod m) then ab ≡ a0 b0 (mod m). (4) If a ≡ a0 (mod m) then an ≡ (a0 )n Proof. (mod m) for any n ≥ 1. (1) Rm (a) = Rm (b) and Rm (b) = Rm (c) =⇒ Rm (a) = Rm (c). 3 (2) m|a − a0 and m|b − b0 =⇒ m|(a − a0 ) + (b − b0 ) = (a + b) − (a0 + b0 ) =⇒ a + b ≡ a0 + b0 (mod m). (3) We have a = a0 + mt, b = b0 + ms for some s, t ∈ |Z. But then ab = (a0 + mt)(b0 + ms) = a0 b0 + m(a0 s + b0 t + mst) so that ab ≡ a0 b0 (mod m). (4) We’ll use induction on n ≥ 1. The case n = 1 is clear. Suppose the result is known for n. Then an ≡ (a0 )n (mod m) and a ≡ a0 (mod m) =⇒ an · a ≡ (a0 )n · a0 (mod m) by (3) =⇒ an+1 ≡ (a0 )n+1 (mod m). This theorem says that when doing algebra ‘modulo m’, at any stage we can replace a number a with another (usually smaller) number a0 whenever a ≡ a0 (mod m). 2. Algebra of congruences: Examples Remark 2.1. The algebra of congruences is often called modulo arithmetic. Example 2.2. Calculate the remainder of 14 · 37 on division by 11. Solution: 14 ≡ 3 (mod 11) and 37 ≡ 4 (mod 11). Therefore, using properties (3) and (1) of the algebra of congruences, 14 · 37 ≡ 3 · 4 ≡ 12 ≡ 1 (mod 11). Therefore the remainder is 1. Example 2.3. Calculate the remainder of 351000 on division by 17. Solution: 35 ≡ 1 (mod 17) =⇒ 351000 ≡ 11000 ≡ 1 (mod 17) (using properties (1) and (4) of the algebra of congruences). So the answer is 1. Example 2.4. Calculate the remainder of 2549 on division by 13. Solution: 25 ≡ 12 ≡ −1 (mod 13). Thus 2549 ≡ (−1)49 ≡ −1 (mod 13). Since −1 ≡ 12 (mod 13), 2549 ≡ 12 (mod 13), so the remainder is 12. 4 Example 2.5. Calculate the remainder of 1655 on division by 7. Solution: First, 16 ≡ 2 (mod 7) =⇒ 1655 ≡ 255 (mod 7). The strategy now is to find a small power of 2 which is congruent to ±1 modulo 7: In this case, we have 23 ≡ 1 (mod 7). It follows that for any integer m, 23m = (23 )m ≡ 1m ≡ 1 (mod 7); i.e. if n is a multiple of 3 then 2n ≡ 1 (mod 7). Now we wish to calculate 255 (mod 7). 55 is not a multiple of 3. But 55 = 54 + 1 and 54 is a multiple of 3. Thus 255 = 254+1 = 254 · 21 ≡ 1 · 2 ≡ 2 (mod 7). So the answer is 2. Example 2.6. Find the remainder of 1484 + 3791 on division by 11. Solution: We first calculate 1484 (mod 11) and 3791 (mod 11) using the strategy from the last example: 1484 : First 14 ≡ 3 (mod 11). Now look at small powers of 3 to find one congruent to ±1 modulo 11. 32 = 9 ≡ −2 (mod 11). Thus (32 )5 ≡ (−2)5 ≡ −32 ≡ 1 (mod 11); i.e. 310 ≡ 1 (mod 11). It follows (as in the last example) that 3n ≡ 1 (mod 11) whenever n is a multiple of 10. So 1484 ≡ 384 ≡ 380 · 34 ≡ 34 ≡ 81 ≡ 4 (mod 11). 3791 : 37 ≡ 4 ≡ 22 (mod 11). Now 25 ≡ −1 (mod 11) =⇒ 45 = (25 )2 ≡ (−1)2 ≡ 1 (mod 11). So 4n ≡ 1 (mod 11) whenever n is divisible by 5. So 3791 ≡ 491 ≡ 490 · 4 ≡ 1 · 4 ≡ 4 (mod 11). Finally, using property (2) of the algebra of congruences, 1484 + 3791 ≡ 4 + 4 ≡ 8 (mod 11). So the answer is 8. n Example 2.7. Show that for every n ≥ 1 the number 22 + 5 is composite. Solution: We look at a few examples for small n to see if we can make any useful observations or conjectures: n=1 n=2 n=3 22 + 5 = 9 = 3 · 3 24 + 5 = 21 = 3 · 7 28 + 5 = 261 = 3 · 87 . . . After this the numbers grow too fast. However, based on our evidence so far we might guess that these numbers are always divisible by 3 (and hence are not prime). 5 n n Thus, our guess is 3|22 + 5 for all n ≥ 1. This can be rewritten 22 + 5 ≡ 0 n (mod 3) or 22 ≡ −5 ≡ 1 (mod 3). n So we must prove that 22 ≡ 1 (mod 3) for all n: n n But 2 ≡ −1 (mod 3) =⇒ 22 ≡ (−1)2 ≡ 1 (mod 3) for all n (since 2n is even). Congruences often give us a means to prove that an equation has no integer solutions: Example 2.8. Show that the equation x2 = 3y + 2 has no integer solutions x and y. Solution: Note that numbers of the form 3y + 2 are precisely the numbers which are congruent to 2 modulo 3. Thus we are required to show that the congruence x2 ≡ 2 (mod 3) has no solutions. Now x leaves either remainder 0, 1 or 2 on division by 3. So x ≡ 0, 1 or 2 (mod 3). We consider each of these possibilities in turn: If x ≡ 0 (mod 3) then x2 ≡ 02 ≡ 0 (mod 3), and so x2 6≡ 2 (mod 3). If x ≡ 1 (mod 3) then x2 ≡ 1 (mod 3), and so x2 6≡ 2 (mod 3). If x ≡ 2 (mod 3) then x2 ≡ 22 ≡ 1 (mod 3), and so x2 6≡ 2 (mod 3). In general, we can often use the algebra of congruences to show that some equation has no integer solutions. The idea is the following: Note that if a, b ∈ Z then a = b =⇒ a ≡ b (mod m) for any modulus m: To prove that a 6= b it is enough to find a modulus m for which a 6≡ b (mod m). Thus if we wish to prove that an equation of the form f (x, y) = g(x, y) has no integer solutions, it is enough to find a single modulus m for which the congruence f (x, y) ≡ g(x, y) (mod m) has no solutions. Caution: There are circumstances under which this strategy does not work: it can happen that f (x, y) ≡ g(x, y) (mod m) is solvable for every modulus m even though the integer equation f (x, y) = g(x, y) has no solutions. Even when an appropriate modulus m does exist, it may require some ingenuity to find it. Example 2.9. Show that no number of the form 4t + 3 (t ∈ Z) can be written as a sum of two squares. Solution: We wish to show that the equation x2 +y 2 = 4t+3 has no integer solutions. 6 The numbers of the form 4t + 3 are precisely the numbers congruent to 3 modulo 4. So we are required to prove that the congruence x2 + y 2 ≡ 3 (mod 4) has no solutions. Now, for n ∈ Z, n ≡ 0, 1, 2 or 3 (mod 4) and so n2 ≡ 0, 1, 0, 1 (mod 4). So any square is congruent either to 0 or 1 modulo 4. Thus x2 , y 2 ≡ 0 or 1 (mod 4) and hence x2 + y 2 ≡ 0 + 0, 0 + 1, 1 + 0, 1 + 1 (mod 4). Thus x2 + y 2 ≡ 0, 1 or 2 (mod 4), and hence x2 + y 2 6≡ 3 (mod 4). Example 2.10. Show that the equation x2 − 2y 2 = 10 has no integer solutions. Solution: We attempt to find a modulus m for which x2 − 2y 2 ≡ 10 (mod m) has no solutions. There is no golden rule for choosing such a modulus; in general it may require some experimentation. However, one possibility worth exploring is the divisors of the numbers of coefficients occurring in the equation. Since 10 = 2 · 5 it is worth trying m = 2 or m = 5. If we try m = 2, we obtain the congruence x2 ≡ 0 (mod 2) which has solutions (take x to be any even number), so this is inconclusive. If we try m = 5 we get the congruence x2 − 2y 2 ≡ 0 (mod 5). Now if n is any integer then n ≡ 0, 1, 2, 3 or 4 (mod 5) and hence n2 ≡ 0, 1, 4 ≡ 0, 1, −1 (mod 5). If 5 6 |x, y then x2 , y 2 ≡ ±1 (mod 5) and x2 − 2y 2 ≡ (±1) − 2(±1) 6≡ 0 (mod 5). This shows there are no solutions to the congruence (and hence to the original equation) satisfying 5 6 |x, y. So if there is a solution, we must have 5|x or 5|y, and hence 5|x and 5|y (since 5|10). Modulo 5 we then get 0 ≡ 0 (mod 5), which does not tell us anything about the solvability of the original equation. However, observe that if 5|x, y then 52 |x2 , y 2 and hence 25 = 52 |x2 − 2y 2 . Since 25 6 |10 the equation x2 − 2y 2 = 10 has no solutions in this case either. (In other words, if we take 25 = 52 as our modulus we get the contradiction 0 ≡ 10 (mod 25).) 2.1. Divisibility by 9. Let N be a natural number. Suppose that the (standard) decimal – i.e. base 10 – representation of N has the form ak ak−1 · · · a0 (where a0 , . . . , ak ∈ {0, 1, . . . , 9} are decimal digits). Then, by definition, N = a0 + 10a1 + 100a2 + · · · + 10k ak . 7 (i.e. this is meaning of the decimal representation). (For example, if the decimal representation of N is 678325, then N = 5 + 10 · 2 + 100 · 3 + 1000 · 8 + 10000 · 7 + 100000 · 6.) Since 10 ≡ 1 (mod 9), 10n ≡ 1 (mod 9) for any n. Thus N = a0 + 10a1 + 100a2 + · · · + 10k ak ≡ a0 + a1 + · · · + ak (mod 9). Example 2.11. What is the remainder of 57846 on division by 9? Solution: 57846 ≡ 5 + 7 + 8 + 4 + 6 ≡ 30 ≡ 3 (mod 9). So the answer is 3. Exercise 2.12. If N has decinal representation ak · · · a0 show that N ≡ a0 − a1 + · · · + (−1)k ak (mod 11). 3. Decomposing moduli Lemma 3.1. Suppose that m, n are nonzero integers satisfying (m, n) = 1. Suppose a is any integer. Then mn|a ⇐⇒ m|a and n|a. Proof. =⇒: If mn|a then a = mnt = m(nt) = n(mt) for some integer t, and thus a is a multiple of m and of n. ⇐=: Since m|a we have a = mb for some integer b. Since n|mb and (n, m) = 1 we have n|b. Thus b = nc for some integer c and hence a = mb = mnc. Remark 3.2. Of course, the hypothesis (m, n) = 1 is crucial here. For example 6|60 and 4|60 but 6 · 4 6 |60. The best that can be said in general is that if m|a and n|a then the least common multiple of m and n must divide a (see last problem on Homework 2.) Corollary 3.3. Suppose that m, n are positive integers satisying (m, n) = 1 and that a, b ∈ Z. Then a ≡ b (mod mn) ⇐⇒ a ≡ b (mod m) and a ≡ b (mod n). Proof. a ≡ b (mod mn) ⇐⇒ mn|(a − b) ⇐⇒ m|(a − b) and n|(a − b) (by Lemma 3.1) ⇐⇒ a ≡ b (mod m) and a ≡ b (mod n). Example 3.4. Show that 871003 ≡ 3 (mod 20). Since 20 = 4 · 5 and (4, 5) = 1, by Corollary 3.3, it is enough to show that 871003 ≡ 3 (mod 4) and 871003 ≡ 3 (mod 5). Now 87 ≡ −1 (mod 4) =⇒ 871003 ≡ (−1)1003 ≡ −1 ≡ 3 (mod 4). 8 87 ≡ 2 (mod 5) =⇒ 874 ≡ 24 ≡ 1 (mod 5). Thus 871000+3 ≡ 21000 · 23 ≡ 23 ≡ 3 (mod 5). Example 3.5. Find the last two digits of 5755 . We wish to calculate the remainder of 5755 on division by 100; i.e. what is 5755 (mod 100)? Since 100 = 4 × 25 (and (4, 25) = 1) we can look at 5755 (mod 4) and 5755 (mod 25) separately. 5755 (mod 4): 57 ≡ 1 (mod 4) =⇒ 5755 ≡ 155 ≡ 1 (mod 4). 5755 (mod 25): 57 ≡ 7 (mod 25). Now 72 ≡ −1 (mod 25) and hence 74 ≡ 1 (mod 25). Thus 5755 ≡ 755 ≡ 752 · 73 ≡ 73 ≡ −7 ≡ 18 (mod 25). Let r be the remainder of 5755 on division by 100. We’ve shown r ≡ 1 (mod 4) and r ≡ 18 (mod 25). So we just have to find the number smaller than 100 which satisfies both of these conditions. From the second condition r ∈ {18, 43, 68, 93}. Of these only 93 is congruent to 1 modulo 4. So r = 93. We can generalize this useful result to the situation where the modulus is a product of three or more (relatively prime) factors: First we need the following observation. Lemma 3.6. Suppose that m1 , . . . , mt , m are nonzero integers with (m, mi ) = 1 for i = 1, . . . , t. Then (m, m1 · · · mt ) = 1. Proof. Suppose FTSOC that (m, m1 · · · mt ) > 1. Then there is a prime number p satisfying p|m and p|m1 · · · mt . Since p is prime, p|mi for some i and hence (m, mi ) 6= 1, a contradiction. Lemma 3.7. Suppose that m1 , . . . , mt are positive integers satisfying (mi , mj ) = 1 whenever i 6= j (we say that the list of numbers is pairwise relatively prime). Let m = m1 · · · mt . If a, b ∈ Z, then a ≡ b (mod m) ⇐⇒ a ≡ b (mod mi ) for all i = 1, . . . , t. Proof. =⇒ is clear. ⇐=: We’ll proceed by induction on t ≥ 2. When t = 2 this is just Corollary 3.3. Suppose the result is known for t, and that we are given m1 , . . . , mt , mt+1 pairwise relatively prime. Let m = m1 · · · mt · mt+1 . Since (mt+1 , mi ) = 1 for i = 1, . . . , t it follows that (mt+1 , m1 · · · mt ) = 1 by Lemma 3.6. Now m = (m1 · · · mt ) · mt+1 and 9 therefore a ≡ b (mod m) ⇐⇒ a ≡ b (mod m1 · · · mt ) and a ≡ b (mod mt+1 )(by the case t = 2) ⇐⇒ a ≡ b (mod mi ) for all i ≤ t and a ≡ b (mod mt+1 ) (by ind. hyp.) ⇐⇒ a ≡ b (mod mi ) for all i ≤ t + 1. Corollary 3.8. Let m > 1 and suppose that m = pa11 · · · pat t is the prime factorization of m. If a, b ∈ Z we have a ≡ b (mod m) ⇐⇒ a ≡ b (mod pai i ) for all i = 1, . . . , t. Example 3.9. Let n be any integer not divisible by 2, 3 or 5. Prove that n4 ≡ 1 (mod 30) (i.e. 30|n4 − 1). Solution: Since 30 = 2 · 3 · 5 we just have to prove that n4 ≡ 1 (mod m) for m = 2, 3 and 5. Now n ≡ 1 (mod 2) =⇒ n4 ≡ 1 (mod 2). Also n ≡ ±1 (mod 3) =⇒ n4 ≡ (±1)4 ≡ 1 (mod 3). Finally n ≡ ±1, ±2 (mod 5). So n4 ≡ (±1)4 or (±2)4 (mod 5) =⇒ n4 ≡ 1 (mod 5). Remark 3.10. Lemma 3.7 requires that the moduli are pairwise relatively prime. For example, the three numbers 6, 10, 15 satisfy (6, 10, 15) = 1 but no pair of them is relatively prime. Not that 31 ≡ 1 (mod 6), 31 ≡ 1 (mod 10) and 31 ≡ 1 (mod 15) but 31 6≡ 1 (mod 6 · 10 · 15). So the conclusion of Lemma 3.7 does not hold in this case. 4. Solving ax ≡ b (mod m) Fix a modulus m and let a, b be any integers. We say that s ∈ Z is a solution of the congruence ax ≡ b (mod m) if as ≡ b (mod m). We want to determine when such a congruence has a solution, and , if so, to find all solutions. Note that as ≡ b (mod m) ⇐⇒ ⇐⇒ as = b − mt for some t ∈ Z as + mt = b for some t ∈ Z. 10 Thus the congruence ax ≡ b (mod m) has a solution s if and only if the equation ax + my = b has solutions s and t. But we have already seen (in Chapter 2, section 4) how to find all integer solutions of ax + my = b: (1) The equation has integer solutions if and only if (a, m)|b. (2) Let g = (a, m) and suppose that g|b. Then the equation ax+my = b has the same solutions as the equation m b a x+ y = . g g g Therefore, ax ≡ b (mod m) has the same solutions as a b x≡ g g (mod m ). g (3) Dividing across by g if necessary (as in (2)) we can reduce to the case (a, m) = 1: Using Euclid’s algorithm or otherwise we find s, t ∈ Z with as+mt = b (and thus as ≡ b (mod m)). The general solution of the equation ax + my = b is x = s + mk, y = t − ak, k ∈ Z. Therefore the general solution the congruence ax ≡ b (mod m) is x = s + mk, k ∈ Z; i.e. x ≡ s (mod m). (4) To conclude: When (a, m) = 1, first find a solution s of ax ≡ b (mod m) (using Euclid’s algorithm or otherwise). The general solution is then the set of all integers congruent to s modulo m (we call this the congruence class of s modulo m). Example 4.1. Find all integer solutions of the congruence 111x ≡ 9 (mod 69). Solution: First (111, 69) = 3 and 3|9, so the congruence has solutions. We divide across by 3 to get the simpler congruence 37x ≡ 3 (mod 23) (which has exactly the same solutions by our arguments above). By Euclid’s algorithm we find 1 = 37 · 5 + 23 · (−8) and so 3 = 37 · 15 + 23 · (−24). Thus s = 15 is a solution of the congruence. The general solution is x = 15 + 23k, k ∈ Z (i.e. the congruence class of 15mod23). 11 5. The Chinese Remainder Theorem Example 5.1 (From a thirteenth century Chinese manuscript). Three farmers divide their rice equally. One goes to the market where an 83kg weight is used, another to a market where a 110kg weight is used and the third to a market where a 135kg weight is used. Each farmer sells as many full measures as they can. On returning, there remains 32, 70 and 30 kg respectively. Q: What is the total amount of rice? Let x denote the amount of rice each farmer has. So the total amount is 3x. So we know x ≡ 32 x ≡ 70 x ≡ 30 (mod 83) (mod 110) (mod 135) (Caution: The moduli are not pairwise relatively prime here: (110, 135) 6= 1.) The Chinese Remainder Theorem tells us how to solve a system of congruences like the one in this example. Theorem 5.2 (Chinese Remainder Theorem). Suppose that m1 , . . . , mt are positive and pairwise relatively prime. Let m = m1 · · · mt . Let a1 , . . . , at ∈ Z. (1) There exists c ∈ Z satisfying c ≡ a1 (mod m1 ), c ≡ a2 (mod m2 ), . . . , c ≡ at (mod mt ) (2) If c is one solution then the general solution is x = c + ms, s ∈ Z. Proof. (1) For i = 1, 2, . . . , t let ni = m/mi . So m = mi ni . Note that (mi , ni ) = 1 for all i by Lemma 3.6, since the numbers m1 , . . . , mt are pairwise relatively prime. Therefore, for each i the congruence ni x ≡ 1 (mod mi ) is solvable; i.e. for each i there exists an integer bi satisfying (1) n i bi ≡ 1 (mod mi ). 12 On the other hand if j 6= i then nj bj ≡ 0 (2) (mod mi ) since mi |nj . Now let c := a1 n1 b1 + · · · + at nt bt . Fix some i. By congruence (2) aj n j b j ≡ 0 (mod mi ) whenever j 6= i and hence c ≡ ai n i b i (mod mi ). However, by congruence (1) ni bi ≡ 1 (mod mi ) and hence c ≡ ai (mod mi ) as required. (2) Suppose that d is any other solution of the system of congruences. Then c ≡ d (mod mi ) ∀i =⇒ c ≡ d (mod m)(by Lemma 3.7) so that d = c + ms for some s. Conversely, if d = c+ms for some s, then d ≡ c (mod m) and hence, for each i, d ≡ c ≡ ai (mod mi ) so that d is a solution. Remark 5.3. Note that in the proof of the first part of the theorem we provide a recipe for calculating c. Example 5.4. Find all solutions of the system of simultaneous congruences x≡3 (mod 5), x ≡ 5 (mod 7), x ≡ 7 (mod 11). Solution: We use the recipe described in the proof of the CRT. Here a1 = 3, m1 = 5, a2 = 5, m2 = 7, a3 = 7 and m3 = 11. So n1 = 7 · 11 = 77, n2 = 5 · 11 = 55, n3 = 5 · 7 = 35. To find b1 , solve 77x ≡ 1 (mod 5); i.e. 2x ≡ 1 (mod 5). So we can take b1 = 3. To find b2 , solve 55x ≡ 1 (mod 7); i.e. −x ≡ 1 (mod 7) (since 55 ≡ −1 (mod 7)). So we can take b2 = −1. To find b3 , solve 35 ≡ 1 (mod 11); i.e. 2x ≡ 1 (mod 11). So we can take b3 = 6. Then a solution of our simultaneous congruences is c = a1 n1 b1 + a2 n2 b2 + a3 n3 b3 = 77 · 3 · 3 + 55 · 5 · (−1) + 35 · 7 · 6 = 693 − 275 + 1470 = 1888. 13 Now m = m1 m2 m3 = 5 · 7 · 11 = 385. So the general solution x = 1888 + 385t, t ∈ Z. This is the congruence class of 1888 modulo 385. Since 1888 ≡ 348 (mod 385), this is the same as x = 348 + 385t, t ∈ Z Note that it follows 348 is the smallest positive solution of the simultaneous congruences; i.e. 348 is the smallest positive number which leaves remainder 3 on division by 5, 5 on division by 7 and 7 on division by 11. Example 5.5. We’ll solve the thirteenth century Chinese problem above. The problem is to find the smallest positive integer solution of the simultaneous congruences x ≡ 32 (mod 83), x ≡ 70 (mod 110), x ≡ 30 (mod 135). We begin by recalling that the moduli in this problem are not pairwise relatively prime – since (110, 135) = 5 – so we cannot yet apply the procedure of the last example. First, we have to decompose the moduli. Since 110 = 5 · 22 the second congruence is equivalent to x≡0 (mod 5) and x ≡ 4 (mod 22) and the third congruence is equivalent to x≡0 (mod 5) and x ≡ 3 (mod 27). So the original system is equivalent to the system x ≡ 32 (mod 83), x ≡ 4 (mod 22), x ≡ 0 (mod 5) and x ≡ 3 (mod 27) and hence (recombining the last two) to the system x ≡ 32 (mod 83), x ≡ 4 (mod 22), and x ≡ 30 (mod 135) So we now apply the method of the proof: To find b1 : Solve 22 · 135x ≡ 1 (mod 83). Now modulo 83 we have 22 · 135 ≡ 22 · 52 ≡ 8 · 11 · 13 ≡ 5 · 13 ≡ 65 (mod 83). So we must solve 65x ≡ 1 (mod 83). We use Euclid’s algorithm: 83 65 18 11 7 4 = = = = = = 65 + 18 3 · 18 + 11 11 + 7 7+4 4+3 3+1 14 which gives 1 = 65 · 23 + 83 · (−18). Thus we can take b1 = 23. To find b2 : We must solve 83 · 135x ≡ 1 (mod 22). Now 83 · 135 ≡ 7 (mod 22). So the congruence is 7x ≡ 1 (mod 22). We can take b2 = −3. To find b3 , we must solve the congruence 83 · 22x ≡ 1 (mod 135). Now 83 · 22 ≡ 71 (mod 135). So we must solve 71x ≡ 1 (mod 135). Applying Euclid’s algorithm to the pair 71, 315 we find the solution b3 = −19. Thus a solution of the system of congruences is c = 32 · 22 · 135 · 23 + 4 · 83 · 135 · (−3) + 30 · 83 · 22 · (−19) = 1010640. Now 83 · 22 · 135 = 246510, so the general solution is x = 1010640 + 246510t, t ∈ Z; i.e. the set of all numbers congruent to 1010640 modulo 246510. Now the remainder of 1010640 on division by 246510 is 24600. So 24600 is the smallest positive solution of the system. Therefore each farmer had 24600 kg of rice and the total amount of rice was 3 · 24600 = 73800 kg. Example 5.6. Find all positive integers less than 5000 which leave remainders 2, 4, 8 when divided by 9, 10, 11 respectively. Solution: First we find the general solution of the system x≡2 (mod 9), x ≡ 4 (mod 10), x ≡ 8 (mod 11). To find b1 , solve 110x ≡ 1 (mod 9); i.e. 2x ≡ 1 (mod 9). We can take b1 = 5. To find b2 , we solve 99x ≡ 1 (mod 10); i.e. −x ≡ 1 (mod 10). So we let b2 = −1. To find b3 , we solve 90x ≡ 1 (mod 11); i.e. 2x ≡ 1 (mod 11). So let b3 = 6. This gives the solution c = 2 · 110 · 5 + 4 · 99 · (−1) + 8 · 90 · 6 = 5024. Since m = 9 · 10 · 11 = 990, and since 5024 ≡ 74 (mod 990) the general solution is the set 74 + 990t, t ∈ Z. Thus the positive solutions which lie below 5000 are 74, 1064, 2054, 3044, 4034. 15 Example 5.7. Find the smallest positive integer leaving remainder 4, 5, 6 on division by 5, 6, 7 respectively. Solution: This is similar to the previous example. However, this time we don’t have to work so hard. There is an obvious solution to the system of congruences, namely, c = −1. Thus the general solution is −1 + 210t (since 5 · 6 · 7 = 210). Therefore the smallest positive solution is −1 + 210 = 209.