Docsity

Chinese Remainder Theorem: Solving Simultaneous Congruences, Exercises of English Language

Toggle sidebar
bg1
Math 127: Chinese Remainder Theorem
Mary Radcliffe
1 Chinese Remainder Theorem
Using the techniques of the previous section, we have the necessary tools to solve congruences of the form
ax ≡b(mod n). The Chinese Remainder Theorem gives us a tool to consider multiple such congruences
simultaneously.
First, let’s just ensure that we understand how to solve ax ≡b(mod n).
Example 1. Find xsuch that 3x≡7 (mo d 10)
Solution. Based on our previous work, we know that 3 has a multiplicative inverse modulo 10,
namely 3ϕ(10)−1. Moreover, ϕ(10) = 4, so the inverse of 3 modulo 10 is 33≡27 ≡7 (mod 10).
Hence, multiplying both sides of the above equation by 7, we obtain
3x≡7 (mod 10)
⇔7·3x≡7·7 (mod 10)
⇔x≡49 ≡9 (mod 10)
Hence, the solution is x≡9 (mod 10).
Example 2. Find xsuch that 3x≡6 (mod 12).
Solution. Uh oh. This time we don’t have a multiplicative inverse to work with. So what to do?
Well, let’s take a look at what this would mean. If 3x≡6 (mod 12), that means 3x−6 is divisible
by 12, so there is some k∈Zsuch that 3x−6 = 12k. Now that we’re working in the integers, we
can happily divide by 3, and we thus obtain that x−2 = 4k. Hence, we have that x≡2 (mod 4)
solves the desired congruence.
Of course, the strategy outlined here will not always work. Imagine, if instead of 3x≡6 (mod 12), we
wanted 3x≡7 (mod 12). Obviously that wouldn’t be possible, as writing out the corresp onding integer
equation yields 3x−7 = 12k, and there are no integers x, k such that 3x−12k= 7, by Bezout’s Lemma.
In general, we have that ax −b=ny for some y∈Z, and hence ax −ny =b. This implies that we can
find a solution to this congruence if and only if gcd(a, n)|b, again by Bezout’s Lemma.
Proposition 1. Let n∈N, and let a, b ∈Z. The congruence ax ≡b(mod n) has a solution for xif and
only if gcd(a, n)|b.
Moreover, the strategy we employed in Example 2 will in general work. Suppose that we have ax ≡
b(mod n), and we have that gcd(a, n) = d. Then in order that this has a solution, we know that bis
divisible by d. In particular, there exist integers a0, b0, n0such that a=a0d, b =b0d, n =n0d. We can then
work as we did in Example 2 to rewrite this equation as a0x≡b0(mod n0).
1
pf3
pf4

Partial preview of the text

Download Chinese Remainder Theorem: Solving Simultaneous Congruences and more Exercises English Language in PDF only on Docsity!

Math 127: Chinese Remainder Theorem

Mary Radcliffe

1 Chinese Remainder Theorem

Using the techniques of the previous section, we have the necessary tools to solve congruences of the form ax ≡ b (mod n). The Chinese Remainder Theorem gives us a tool to consider multiple such congruences simultaneously.

First, let’s just ensure that we understand how to solve ax ≡ b (mod n).

Example 1. Find x such that 3x ≡ 7 (mod 10)

Solution. Based on our previous work, we know that 3 has a multiplicative inverse modulo 10, namely 3ϕ(10)−^1. Moreover, ϕ(10) = 4, so the inverse of 3 modulo 10 is 3^3 ≡ 27 ≡ 7 (mod 10). Hence, multiplying both sides of the above equation by 7, we obtain

3 x ≡ 7 (mod 10) ⇔ 7 · 3 x ≡ 7 · 7 (mod 10) ⇔ x ≡ 49 ≡ 9 (mod 10)

Hence, the solution is x ≡ 9 (mod 10).

Example 2. Find x such that 3x ≡ 6 (mod 12).

Solution. Uh oh. This time we don’t have a multiplicative inverse to work with. So what to do? Well, let’s take a look at what this would mean. If 3x ≡ 6 (mod 12), that means 3x − 6 is divisible by 12, so there is some k ∈ Z such that 3x − 6 = 12k. Now that we’re working in the integers, we can happily divide by 3, and we thus obtain that x − 2 = 4k. Hence, we have that x ≡ 2 (mod 4) solves the desired congruence.

Of course, the strategy outlined here will not always work. Imagine, if instead of 3x ≡ 6 (mod 12), we wanted 3x ≡ 7 (mod 12). Obviously that wouldn’t be possible, as writing out the corresponding integer equation yields 3x − 7 = 12k, and there are no integers x, k such that 3x − 12 k = 7, by Bezout’s Lemma.

In general, we have that ax − b = ny for some y ∈ Z, and hence ax − ny = b. This implies that we can find a solution to this congruence if and only if gcd(a, n)|b, again by Bezout’s Lemma.

Proposition 1. Let n ∈ N, and let a, b ∈ Z. The congruence ax ≡ b (mod n) has a solution for x if and only if gcd(a, n)|b.

Moreover, the strategy we employed in Example 2 will in general work. Suppose that we have ax ≡ b (mod n), and we have that gcd(a, n) = d. Then in order that this has a solution, we know that b is divisible by d. In particular, there exist integers a′, b′, n′^ such that a = a′d, b = b′d, n = n′d. We can then work as we did in Example 2 to rewrite this equation as a′x ≡ b′^ (mod n′).

Example 3. Find x, if possible, such that

2 x ≡ 5 (mod 7), and 3x ≡ 4 (mod 8)

Solution. First note that 2 has an inverse modulo 7, namely 4. So we can write the first equiva- lence as x ≡ 4 · 5 ≡ 6 (mod 7). Hence, we have that x = 6 + 7k for some k ∈ Z. Now we can substitute this in for the second equivalence:

3 x ≡ 4 (mod 8) 3(6 + 7k) ≡ 4 (mod 8) 18 + 21k ≡ 4 (mod 8) 2 + 5k ≡ 4 (mod 8) 5 k ≡ 2 (mod 8).

Recalling that 5 has an inverse modulo 8, namely 5, we thus obtain

k ≡ 10 ≡ 2 (mod 8).

Hence, we have that k = 2 + 8j for some j ∈ Z. Plugging this back in for x, we have that x = 6 + 7k = 6 + 7(2 + 8j) = 20 + 56j for some j ∈ Z. In fact, any choice of j will work here. Hence, we have that x is a solution to the system of congruences if and only if x ≡ 20 (mod 56).

Example 4. Find x, if possible, such that

x ≡ 3 (mod 4), and x ≡ 0 (mod 6).

Solution. Let’s work as we did above. From the first equivalence, we have that x = 3 + 4k for some k ∈ Z. Then, the second equivalence implies that 3 + 4k ≡ 0 (mod 6), and hence 4 k ≡ − 3 ≡ 3 (mod 6). However, this is impossible, since we know that gcd(4, 6) = 2 and 2 6 |3.

Ok, so not every system of congruences will have a solution, but our strategy of trying to solve them will reveal when there is no solution also.

Notice the problem that occurred here: when we considered the first equivalence, we ended up with a coefficient of 4 in front of the k. Since 4 is not relatively prime to 6, there was a chance that the next equivalence would not have a solution, and indeed that is what happened. In general this will be the case: if we consider two equivalences of the form

x ≡ b 1 (mod n 1 ) x ≡ b 2 (mod n 2 ),

then the method we developed above will take the following approach: first, write x = b 1 + kn 1. Plug that in to the second equation to obtain kn 1 ≡ b 2 − b 1 (mod n 2 ). If n 1 and n 2 share factors, then we may not be able to solve this equivalence, per Proposition 1. Hence, we can demand that n 1 and n 2 are relatively prime, and this should solve that problem.

Continuing, then, if we assume that n 1 and n 2 are relatively prime, we have reduced this system to kn 1 ≡ b 2 − b 1 (mod n 2 ). Then we obtain kn 1 − b 2 + b 1 = jn 2 for some j ∈ Z. Rearranging, we have kn 1 − jn 2 = b 2 − b 1. Since n 1 and n 2 are relatively prime, we know from Bezout’s Lemma that we will be

Example 6. Find all solutions x, if they exist, to the system of equivalences:

2 x ≡ 6 (mod 14) 3 x ≡ 9 (mod 15) 5 x ≡ 20 (mod 60)

Solution. As in Example 2, we first wish to reduce this, where possible, using the strategy outlined following the statement of Proposition 1. Since gcd 2, 14 = 2, we can cancel a 2 from all terms in the first equivalence to write x ≡ 3 (mod 7). Likewise, we simplify the other two equivalences to reduce the entire system to

x ≡ 3 (mod 7) x ≡ 3 (mod 5) x ≡ 4 (mod 12).

We can now follow the strategy of the Chinese Remainder Theorem. Following the notation in the theorem, we have

m 1 = 5 ∗ 12 = 60 ≡ 4 (mod 7); y 1 ≡ 45 ≡ 1024 ≡ 2 (mod 7) m 2 = 7 ∗ 12 = 84 ≡ 4 (mod 5); y 2 ≡ 43 ≡ 64 ≡ 4 (mod 5) m 3 = 7 ∗ 5 = 35 ≡ 11 (mod 12); y 3 ≡ 113 ≡ (−1)^3 ≡ − 1 ≡ 11 (mod 12).

Hence, we have x = y 1 m 1 b 1 + y 2 m 2 b 2 + y 3 m 3 b 3 = 2 ∗ 60 ∗ 3 + 4 ∗ 84 ∗ 3 + 11 ∗ 35 ∗ 4 = 2908. Hence, we have any solution x ≡ 2908 ≡ 388 (mod 420).