s
NUMBER THEORY
The Theory of Congruences
Lesson 4: Linear Congruences and the Chinese Remainder Theorem
Specific Objectives
1. Apply linear congruence in finding the d values of x;
2. Accurately perform and solve for the d values of x by following the steps in solving x; and
3. Demonstrate patience and attention to details in evaluating possible values of x.
Linear congruences are like a secret code for understanding how numbers relate to each other. Instead of
focusing on their exact values, they use remainders after division. This "modular" way of thinking is like a
mini-number system, where you only care about how numbers behave within that specific system. Solving
linear congruences is connected to solving Diophantine equations, showing how different areas of math can
work together.
Discussions
Linear Congruences
In the book of Burton, Elementary Number Theory, he defined linear congruence as an equation in the form
𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑛) , and by a solution of such an equation we mean an integer 𝑥0 for which 𝑎𝑥0 ≡
𝑏 (𝑚𝑜𝑑 𝑛). By definition of congruence, 𝑎𝑥0 ≡ 𝑏 (𝑚𝑜𝑑 𝑛) if and only if 𝑛 ∣ 𝑎𝑥0 − 𝑏 or, by definition of
divisibility, what amounts to the same thing, if and only if 𝑎𝑥0 − 𝑏 = 𝑛𝑦0 for some integer 𝑦0 . Thus, the
problem of finding all integers that will satisfy the linear congruence 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑛) is identical with
obtaining all solutions of the linear Diophantine equation 𝑎𝑥 − 𝑛𝑦 = 𝑏.
It is convenient to treat two solutions of ax ≡ b (mod n) that are congruent modulo n as being "equal" even
though they are not equal in the usual sense. For example, x = 3 and x = -9 both satisfy the congruence 3x
≡ 9 (mod 12); because 3 ≡ -9 (mod 12), they are not counted as different solutions. In short, when we refer
to the number of solutions of ax ≡ b (mod n), we mean the number of incongruent integers satisfying this
congruence.
Theorem 4.7. The linear congruence has a solution if and only if d∣b, where d= gcd
(a,n). If d∣b, then it has d mutually incongruent solutions modulo n.
Proof:
𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑛)
by definition of congruence 𝑛 ∣ 𝑎𝑥 − 𝑏
by definition of divisibility 𝑎𝑥 − 𝑏 = 𝑛
for some integer q, 𝑎𝑥 − 𝑏 = 𝑛𝑞
2
NUMBER THEORY
by Addition Property of Equality lets add 𝑏 − 𝑛𝑞 to both sides resulting to,
𝑎𝑥 − 𝑛𝑞 = 𝑏
This is now in the form of Linear Diophantine equation 𝑎𝑥 + (−𝑛)𝑞 = 𝑏
At this point, notice that q is playing the same role as y in the general form of a linear Diophantine equation
𝑎𝑥 + 𝑏𝑦 = 𝑐. To be consistent with notation, we let q be equal to y:
𝑎𝑥 − 𝑛𝑦 = 𝑏
By definition of gcd, d is the largest integer that divides both a and n. Since d is a common divisor, it follows
that:
𝑑 𝑑
𝑎𝑥
and 𝑛𝑦
we see that both ax and ny are divisible by d, meaning that their difference b must also be divisible by d
which can be written as d|b. From Theorem 2.9, a solution exists if and only if d∣b.
Since d|b, there exists at least one solution (𝑥0 , 𝑦0 ) to the equation.
Since d∣a and d∣n, we can rewrite a and n as:
a=dA, n=dN
for some integers A and N such that gcd(A,N)=1.
𝑎𝑥 − 𝑛𝑦 = 𝑏
(𝑑𝐴)𝑥 − (𝑑𝑁)𝑦 = 𝑏
𝑏
Dividing both sides by d (which is valid because d∣b), we get: 𝐴𝑥 − 𝑁𝑦 = 𝑑
Since gcd(A,N)=1, this is now a linear Diophantine equation with co-prime coefficients, which we know
always has integer solutions. The key property of linear Diophantine equations is that once a particular
solution (𝑥0 , 𝑦0 ) is found, the full set of solutions is given by:
𝑛 𝑎
𝑥 = 𝑥0 + 𝑁𝑡 , 𝑦 = 𝑦0 + 𝐴𝑡 for any integer t, where 𝑁 = 𝑑 and 𝐴 = 𝑑
Rewriting in terms of d, the general solution to 𝑎𝑥 − 𝑛𝑦 = 𝑏 is :
𝑛 𝑎
𝑥 = 𝑥0 + 𝑑 (𝑡) , 𝑦 = 𝑦0 + 𝑑 (𝑡) for any integer t.
Since we are working modulo n, we only consider values of x that are distinct modulo n. By letting t as
successive values t=0,1,2…..,d-1 we generate exactly d distinct solutions:
𝑛 2𝑛 (𝑑 − 1)𝑛
𝑥0 , 𝑥0 + , 𝑥0 + , … . , 𝑥0 +
𝑑 𝑑 𝑑
Corollary. If gcd(a,n)=1, then the linear congruence has a unique solution n.
3
NUMBER THEORY
Given relatively prime integers a and n, the congruence ax ≡ b(mod n) has a unique solution. Since
gcd(a,n)=1, by Theorem 4.7, if 1|b then the congruence has only one unique solution. This solution is
sometimes called the (multiplicative) inverse of modulo.
Example 1:
Let’s consider the linear congruence 18x ≡ 30 (mod 42).
First, find the gcd(18,42) and gcd (30,42).
42=2 ∙ 18+6 → gcd
18=3 ∙ 6+0
gcd(18,42)=6
42=1 ∙ 30+12
30=2 ∙ 12+6 → gcd
12=2 ∙ 6+0
gcd(30,42)=6
Since gcd(18,42)=6 and 6|30, Theorem 4.7 guarantees the existence of exactly six solutions, which are
incongruent modulo 42.
To find the six solutions. Let us simplify the linear congruence first. We can divide the entire congruence
by 6 since 6|18 and 6|30.
18x 30 42
≡ (mod )
6 6 6
3x ≡ 5 (mod 7)
To find the first solution, let’s do substitution.
3(1) ≡ 3 (mod 7)
3(2) ≡ 6 (mod 7)
3(3) ≡ 2 (mod 7)
3(4) ≡ 5 (mod 7)
The first solution is found to be 𝑥 = 4 since 3(4) ≡ 5 (𝑚𝑜𝑑 7). To find other solutions we will use
𝑛 𝑛 (𝑑−1)𝑛
𝑥0 , 𝑥0 + 𝑑 , 𝑥0 + 2 𝑑 , … , 𝑥0 + 𝑑
when 𝑡 = 0, 1, 2, 3, 4, 5.
𝑥 ≡ 4 + 7(0)
𝑥≡4
𝑥 ≡ 4 + 7(1)
𝑥 ≡ 11
4
NUMBER THEORY
𝑥 ≡ 4 + 7(2)
𝑥 ≡ 18
𝑥 ≡ 4 + 7(3)
𝑥 ≡ 25
𝑥 ≡ 4 + 7(4)
𝑥 ≡ 32
𝑥 ≡ 4 + 7(5)
𝑥 ≡ 39
Therefore, the six solution of the linear congruence 18𝑥 ≡ 30 (𝑚𝑜𝑑 42) are
𝑥 ≡ 4,11,18,25,32,39 (𝑚𝑜𝑑 42)
Example 2: Find all integer solutions x that satisfy the congruence 9x ≡ 21 (mod 30).
➢ Check for Solvability:
The greatest common divisor (GCD) of 9 and 30 is 3. Since 3 divides 21, the congruence
has solutions.
➢ Simplify the Congruence:
Divide all terms by the GCD (3):
9 21 30
(3)x ≡ ( 3 ) (mod 3
)
3x ≡ 7 (mod 10)
➢ Find the Multiplicative Inverse:
We need to find a number y such that 3y ≡ 1 (mod 10). By testing values, we find that 3 *
7 = 21 ≡ 1 (mod 10). So, the multiplicative inverse of 3 (mod 10) is 7.
➢ Multiply by the Inverse:
Multiply both sides of the congruence by 7:
7 * (3x) ≡ 7 * 7 (mod 10)
21x ≡ 49 (mod 10)
x ≡ 9 (mod 10)
➢ General Solution (mod 10):
This means x = 9 + 10t, where t is an integer.
➢ Find Solutions (mod 30):
Since the original congruence was modulo 30, we need to find solutions in the range 0 to
29. Substitute values of t:
t = 0: x = 9
t = 1: x = 19
t = 2: x = 29
The solutions are x = 9, 19, and 29.
➢ Express Solutions in Congruence Form:
x ≡ 9 (mod 30)
5
NUMBER THEORY
x ≡ 19 (mod 30)
x ≡ 29 (mod 30)
Example 3: Solve the linear congruence: 21x ≡ 147 (mod 789)
➢ Check for Solvability:
Find the GCD(21, 789).
789 = 21 * 37 + 12
21 = 12 * 1 + 9
12 = 9 * 1 + 3
9=3*3+0
GCD(21, 789) = 3.
Since 3 divides 147 (147 / 3 = 49), the congruence has solutions.
➢ Simplify the Congruence:
Divide all terms by the GCD (3):
21 147 789
( 3 )x ≡ ( 3 ) (mod 3 )
7x ≡ 49 (mod 263)
➢ Find the Multiplicative Inverse:
We need to find a number y such that 7y ≡ 1 (mod 263). We can use the Extended Euclidean
Algorithm or trial and error.
263 = 7 * 37 + 4
7=4*1+3
4=3*1+1
1=4-3*1
1 = 4 - (7 - 4 * 1) * 1 = 4 * 2 - 7 * 1
1 = (263 - 7 * 37) * 2 - 7 * 1 = 263 * 2 - 7 * 75
Thus, 7 * (-75) ≡ 1 (mod 263). Since we need a positive inverse, -75 ≡ 188 (mod 263). The
multiplicative inverse of 7 (mod 263) is 188.
➢ Multiply by the Inverse:
Multiply both sides of the congruence by 188:
188 * (7x) ≡ 188 * 49 (mod 263)
1316x ≡ 9212 (mod 263)
➢ Simplify:
Reduce 1316x and 9212 modulo 263:
1316 = 263 * 5 + 1
1316 ≡ 1 (mod 263)
9212 = 263 * 35 + 7
9212 ≡ 7 (mod 263)
x ≡ 7 (mod 263)
➢ General Solution (mod 263):
This means x = 7 + 263t, where t is an integer.
6
NUMBER THEORY
➢ Find Solutions (mod 789):
Since the original congruence was modulo 789, we need to find solutions in the range 0 to
788. Substitute values for t:
t = 0: x = 7
t = 1: x = 270
t = 2: x = 533
The solutions are x = 7, 270, and 533.
➢ Express Solutions in Congruence Form:
x ≡ 7 (mod 789)
x ≡ 270 (mod 789)
x ≡ 533 (mod 789)
Example 4: Find all the possible values of x if 123x ≡ 456 (mod 789)
➢ Check for Solvability:
Find the GCD(123, 789).
789 = 6 * 123 + 51
123 = 2 * 51 + 21
51 = 2 * 21 + 9
21 = 2 * 9 + 3
9 = 3 * 3 +0
GCD(123, 789) = 3.
Since 3 divides 456 (456 / 3 = 152), the congruence has 3 incongruent solutions.
➢ Simplify the Congruence:
Divide all terms by the GCD (3):
123 456 789
( )x ≡ ( ) (mod )
3 3 3
41x ≡ 152 (mod 263)
➢ Find the Multiplicative Inverse:
We need to find a number y such that 41y ≡ 1 (mod 263). We can use back substitution to
the Euclidean algorithm (solution in finding gcd) to find the value of y.
3 = 21 − 2(9)
3 = 21 − 2(51 − 2(21))
3 = 5(21) − 2(51)
3 = 5(123 − 2(51)) − 2(51)
3 = 5(123) − 12(51)
3 = 5(123) − 12(789 − 6(123))
3 = 77(123) − 12(789)
The multiplicative inverse of 41x (mod 263) is 77.
➢ Multiply by the Inverse:
Multiply both sides of the congruence by 77:
77 * 41x ≡ 77 * 152 (mod 263)
3157x ≡ 11704 (mod 263)
➢ Simplify:
7
NUMBER THEORY
Reduce 3157x and 11704 modulo 263:
3157 = 263 * 12 + 1
3157 ≡ 1 (mod 263)
11704 = 263 * 44 + 132
11704 ≡ 132 (mod 263)
x ≡ 132 (mod 263)
➢ General Solution (mod 263):
This means x = 132+ 263t, where t is an integer.
➢ Find Solutions (mod 789):
Since the original congruence was modulo 789, we need to find solutions in the range 0 to
788. Substitute values for t:
t = 0: x = 132
t = 1: x = 395
t = 2: x = 658
The solutions are x = 132, 395, and 658.
➢ Express Solutions in Congruence Form:
x ≡ 132 (mod 789)
x ≡ 395 (mod 789)
x ≡ 658 (mod 789)
Example 5: Find all the possible values of x if 234x ≡ 567 (mod 1023)
➢ Check for Solvability:
Find the GCD(234, 1023).
1023 = 4 * 234 + 87
234 = 2 * 87 + 60
87 = 1 * 60 + 27
60 = 2 * 27 + 6
27 = 4 * 6 + 3
6 = 2 * 3 +0
GCD(234, 1023) = 3.
Since 3 divides 567 (567 / 3 = 189), the congruence has 3 incongruent solutions.
➢ Simplify the Congruence:
Divide all terms by the GCD (3):
234 567 1023
( )x ≡ ( ) (mod )
3 3 3
78x ≡ 189 (mod 341)
➢ Find the Multiplicative Inverse:
Find a value of y that will satisfy the congruence 78y ≡ 1 (mod 341). Use back substitution
to the Euclidean algorithm (solution in finding gcd) to find the value of y which is equal to the
value of 𝑥0 .
3 = 27 − 4(6)
3 = 27 − 4(60 − 2(27))
3 = 9(27) − 4(60)
3 = 9(87 − 1(60)) − 2(60)
8
NUMBER THEORY
3 = 9(87) − 13(60)
3 = 9(87) − 13(234 − 2(87))
3 = 35(87) − 13(234)
3 = 35(1023 − 4(234)) − 13(234)
3 = −153(234) − 35(1023)
Observe that the value of 𝑥0 is negative. If this happens, you can simply add the value of
𝑥0 to n, which is 341 in our simplified equation. Hence, the multiplicative inverse of 78x (mod 341)
is 188.
➢ Multiply by the Inverse:
Multiply both sides of the congruence by 188:
188 * 78x ≡ 188 * 189 (mod 341)
14664x ≡ 35532 (mod 341)
➢ Simplify:
Reduce 14664x and 35532 modulo 341:
14664 = 341 * 43 + 1
14664 ≡ 1 (mod 341)
35532 = 342 * 104 + 68
35532 ≡ 68 (mod 341)
x ≡ 68 (mod 341)
➢ General Solution (mod 263):
This means x = 68+ 341t, where t is an integer.
➢ Find Solutions (mod 1023):
Since the original congruence was modulo 1023, we need to find solutions in the range 0
to 1022. Substitute values for t:
t = 0: x = 68
t = 1: x = 409
t = 2: x = 750
The three incongruent values of x are 68, 409, and 750.
➢ Express Solutions in Congruence Form:
x ≡ 68 (mod 1023)
x ≡ 409 (mod 1023)
x ≡ 750 (mod 1023)
Direction: Solve for all the positive value/s of x of the following linear congruence. Show your complete
solutions on a sheet of paper.
1. 21x ≡ 14 (mod 35)
2. 13x ≡ 45 (mod 97)
3. 27x ≡ 63 (mod 101)
4. 56x ≡ 72 (mod 137)
5. 82x ≡ 36 (mod 149)
9
NUMBER THEORY
Assessment
I. Multiple Choice (10 points)
Directions: Read each question carefully and choose the best answer from the options
provided by encircling the letter. Mark only one answer per question and do not leave any
questions unanswered.
1. What does the congruence ax≡b(modm) mean?
a.) ax=b+km for all k∈Z
b.) ax and b have the same remainder when divided by m
c.) ax=b
d.) x is divisible by m
2. Which of the following congruences has no solution?
a.) 2x≡4 (mod6)
b.) 3x≡1 (mod6)
c.) 4x≡2 (mod8)
d.) 5x≡10 (mod15)
3. What is the general solution to 3x≡6(mod9)?
a.) x≡2 (mod3)
b.) x≡2 (mod9)
c.) x≡0 (mod3)
d.) No solution exists
4. Which of the following is a solution to 4x≡1(mod7)?
a.) x=2
b.) x=4
c.) x=5
d.) x=6
5. The number of solutions modulo mmm to the congruence ax≡b(modm)is:
a.) Always 1
b.) Equal to gcd (a,m)if it divides b
c.) Equal to m
d.) Zero unless a≡b(modm)
6. If ax≡b(modm) has a solution and d=gcd(a,m) what is the solution set?
a.) A unique solution modulo m
b.) d solutions modulo m
c.) m solutions
d.) No general form
10
NUMBER THEORY
7. What is the modular inverse of 3 modulo 7?
a.) 2
b.) 3
c.) 4
d.) 5
8. What is the solution to 7x≡1(mod10)?
a.) x≡3(mod10)
b.) x≡7(mod10)
c.) x≡9(mod10)
d.) x≡5(mod10)
9. The equation ax≡b(modm) is solvable if and only if:
a) a∣m
b) b∣a
c) gcd(a,m)∣b
d) m∣a
10. How many solutions modulo 20 does 4x≡8(mod20) have?
a.) 1
b.) 2
c.) 4
d.) 5
II. True or False (5 points)
Directions: Read each statement carefully. Decide whether the statement is True or False based
on your knowledge of linear congruences in number theory. Write the correct answer in the
space provided.
_____1. Every congruence of the form ax≡b(modm) has a solution.
_____2. If a⋅x≡1(modm) has a solution, then a and m are relatively prime.
_____3. For any integers a, b, and m>1, the congruence ax≡b(modm) can be solved using the
extended Euclidean algorithm.
_____4. If x≡2(mod4) and x≡3(mod5) then x has a unique solution modulo 20.
_____5. If gcd (a,m)>1, the equation ax≡b(modm) has no solution for all b.
11
NUMBER THEORY
III. Problem Solving (25 points)
Directions: Answer the following linear congruence equation. Show your complete solution and box your
final answer. Write your answer on the space provided after each item.
1. Prove 72x ≡117 (mod 153)
2. What is the linear equation of 7x≡5(mod26)?
3. Solve 8x ≡ 6 (mod 14) using Linear Diophantine Equations.
12
NUMBER THEORY
4. Find the smallest positive solution for x: 7x≡5(mod11)
5. Find all the positive value/s of x of the linear congruence 567x≡890(mod1357)
13
NUMBER THEORY
Answer Key:
I. Multiple Choice
1. B 6. B
2. C 7. D
3. C 8. C
4. A 9. C
5. B 10. C
II. True or False
1. False
2. True
3. True
4. True
5. False
III. Problem Solving
1. Prove 72x ≡117 (mod 153)
Proof:
To prove that 72x ≡117 (mod 153), we must get the gcd (72,153), then check if this
divides 153.
gcd (72,153)
153 = 2(72) + 9
72 = 8(9) + 0
(72, 153) = 9
Since 117 = 13*9+0, 9|117. Thus, 72x ≡117 (mod 153) with 9 incongruent values of x.■
2. What is the linear equation of 7x≡5(mod26)?
By definition of congruence, 26|7𝑥 − 5
By definition of divisibility, 7𝑥 − 5 = 26𝑞
By APE, adding 5 − 26𝑞 𝑡𝑜 𝑏𝑜𝑡ℎ 𝑠𝑖𝑑𝑒𝑠
7𝑥 − 26𝑞 = 5
3. Solve 8x ≡ 6 (mod 14) using Linear Diophantine Equations.
I. Find gcd (8, 14) III. Simplify the equation then multiply the inverse
14 = 1(8) + 6 8𝑥 6 14
≡ (𝑚𝑜𝑑 )
8 = 1(6) + 2 2 2 2
6 = 3(2) + 0 2[4𝑥 ≡ 3(𝑚𝑜𝑑 7)]2
II. Find 𝑥0 𝑥 ≡ 6(𝑚𝑜𝑑 7)
2 = 8 − 1(6) IV. Find all values of x
2 = 8 − 1(14 − 1 ∗ 8) If t=0, 𝑥 ≡ 6(𝑚𝑜𝑑 14)
2 = 2(8) − 1(14) If t=1, 𝑥 ≡ 6 + 7(𝑚𝑜𝑑 14)
𝑥 ≡ 13(𝑚𝑜𝑑 14)
14
NUMBER THEORY
4. Find the smallest positive solution for x: 7x≡5(mod11)
I. Find gcd (7, 11) III. Simplify the equation then multiply the inverse
11 = 1(7) + 4 Since inverse is negative, we need to add it to 11, which
7 = 1(4) + 3 will result to 8.
4 = 1(3) + 1 8[7𝑥 ≡ 5(𝑚𝑜𝑑 11)]8
3 = 3(1) + 0 𝑥 ≡ 7(𝑚𝑜𝑑 11)
II. Find 𝑥0 IV. Find all values of x
1 = 4 − 1(3) If t=0, 𝑥 ≡ 7(𝑚𝑜𝑑 11)
1 = 4 − 1(7 − 1 ∗ 4)
1 = 2(4) − 1(7)
1 = 2(11 − 1 ∗ 7) − 1(7)
1 = −3(7) + 2(11)
5. Find all the positive value/s of x of the linear congruence 567x≡890(mod1357)
Reference:
Burton, D. M. (2007). Elementary Number Theory. McGraw-Hill Science, Engineering &
Mathematics.
15