Professional Documents
Culture Documents
Chinese Remainder Theorem PDF
Chinese Remainder Theorem PDF
NANEH APKARIAN
x ≡ a1 (mod n1 )
x ≡ a2 (mod n2 )
..
.
x ≡ ak (mod nk )
For every 1 ≤ i ≤ k, we will use Berlekamp on (ni , nNi ) to construct xi , pi such that
N N
xi + pi ni = gcd ni , =1
ni ni
xi N
Once we have ei = ni for all i, we can find a value for x:
k k
X X ai xi N
x= ai e i =
ni
i=1 i=1
xi Ni + pi ni = gcd(Ni , ni ) ⇒ xi Ni ≡ 1 (mod ni )
So we’re really looking for a bunch of inverses. When we have those, we see that
X
x≡ ai xi Ni (mod N ).
1.1. Problems.
(1) Find an integer x for which x ≡ 1 (mod 13) and x ≡ 11 (mod 23)
(2) Jessica breeds rabbits. She’s not sure exactly how many she has today, but as she was
moving them about this morning, she noticed some things. When she fed them, in groups
of 5, she had 4 left over. When she bathed them, in groups of 8, she had a group of 6 left
over. She took them outside to romp in groups of 9, but then the last group consisted of
only 8. She’s positive that there are fewer than 250 rabbits - but how many does she have?
1
2 NANEH APKARIAN
1.2. Solutions.
(1) (Using the first method and the Euclidean Algorithm) Note that N = 13 · 23 = 299, so
all possible solutions will be congruent mod 299. Since 13, 23 are relatively prime, they
have gcd -1, and so we can use the CRT to construct a solution x. Note that in this case
N/n1 = n2 and vice versa, so that we can set up and solve the equations
x1 · 23 + p1 · 13 = 1 x2 · 13 + p2 · 23 = 1
Getting x1 = 4 and x2 = 16, we then have the candidate solution
2
X ai xi N
x= = a1 x1 n2 + a2 x2 n1 = 1 · 4 · 23 + 11 · 16 · 13 = 2380
ni
i=1
Now we mod out by N to see that all solutions
x ≡ 287 (mod 299).
11
(3) Calculate the Legendre symbol 31 .
2.2. Solutions.
(1) We need only calculate the squares of {1, ..., 18 = 36/2} to come up with all quadratic
residues.
x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 35 36
x2 mod 37 1 4 9 16 25 36 12 27 7 26 10 33 21 11 3 34 30 28 28 30 ... 4 1
(3) There are a few ways of calculating the Legendre symbol. Note that 11, 31 are both primes,
so
11 (31−1)/2 15 1 if 11 ∈ QR[31]
= 11 = 11 mod 31 =
31 −1 if 11 ∈ / QR[31]
So we can calculate the modular exponentiation, or establish if 11 ∈ QR[31]. Or, note that
11 31
= (−1)(11−1)(31−1)/4 = (−1)10·30/4 = (−1)5·15 = −1.
31 11
(4) This is asking 11 ∈ QR[31]? Since we know the Legendre symbol, we know the answer is
no.
4 NANEH APKARIAN
(6) Here we want to use the iterative method - since we’re unsure how to factor 866731.
J(17, 866731) = (866731 (mod 17), 17)(−1)866730·16/4
= J(3, 17)
= J(17 (mod 3), 3)(−1)2·16/4
(∗) = J(2, 3)
2
=J , 3 (−1)8/8
2
= J(1, 3)(−1)
= −1
Note that at (∗), we could also reasonably establish QR[3] and check for 2. Either works.
(7) Note how all of the following involve 24 and 601.
(a) We can easily factor 24 = 23 · 3. Since 601 is odd, it cannot share any power of 2 with
24, and also 601 is not divisible by 3. So, gcd(24, 601) = 1.
(b) We don’t know about the primality of 601, so we use the iterative process:
J(24, 601) = J(12, 601)(−1)(361200/8) = J(12, 601)
= J(6, 601)(−1)(361200/8) = J(6, 601)
= J(3, 601)(−1)(361200/8) = J(3, 601)
= J(601(mod 3), 3)(−1)(600)(2)/4
= J(1, 3)
=1