SECTION C Solving Linear Congruences

advertisement
Chapter 4: Theory of Congruences
15
SECTION C Solving Linear Congruences
By the end of this section you will be able to
 solve congruences
 determine the number of solutions
 find the multiplicative inverse
C1 Definition of a Linear Congruence
In algebra we have linear equations in one unknown x given by
2x 1  7
Solving this equation gives x  3 .
A linear congruence is an equation of the form
ax  b  mod n 
The solution of this linear congruence is the set of integers x which satisfies this:
ax  b  mod n 
Why is the solution a set of integers rather than a unique integer?
Remember ax  b  mod n  means that ax  b  kn for some integer k because by
Definition (4.1):
a  b  mod n 
 a  b is a multiple of n or there exists k  such that
a  b  kn
In mathematics we see if we can obtain a unique solution. How can we get a unique
solution out of a linear congruence?
If two solutions x0 and x1 satisfy the linear congruence
ax  b  mod n 
and they are congruent modulo n, that is x0  x1  mod n  , then we say these are the same
solution and count them as one solution. For example x  3 and x  8 satisfy
(*)
2 x  1  mod 5
because 2  3  6  1  mod 5 and 2  8  16  1  mod 5 . Hence integers 3 and 8 satisfy the
linear congruence (*). They are the same solution and we count them as one solution not
two. We obtain these solutions by trial and error by putting integers for x into the linear
congruence 2 x  1  mod 5 . In the next example we develop a more systematic way of
finding the integers x which satisfies (*).
Example 10
Determine the integers x of the following linear congruence:
2 x  1  mod 5
Solution
By the above Definition (4.1)| we know that
2x 1  5k where k is an integer
Re-arranging this gives
5k  1
x
2
Remember x must be an integer. So what values of k can we use?
Chapter 4: Theory of Congruences
16
Only the odd numbers because if we chose even then we get even plus 1 which does give a
whole number after dividing by 2.
Substituting k  1, 3, 5, ,  1,  3,  5,
gives
5k  1 5  1 15  1 25  1
5  1 15  1 25  1
x

,
,
, ,
,
,
,
2
2
2
2
2
2
2
 3, 8, 13, ,  2,  7,  12,
Clearly there are infinite integers which satisfy the given linear congruence
2 x  1  mod 5
We count all these solutions as one or the same solution because they are all congruent to
each other modulo 5. We normally write this as just one solution which is the least nonnegative residue modulo 5:
x  3  mod 5
Example 11
Solve the linear congruence:
2 x  1  mod 4 
Solution
By Definition (4.1):
a  b  mod n 
 a  b is a multiple of n or there exists k  such that
a  b  kn
we have 2x 1  4k . Transposing this equation to make x the subject yields
4k  1
x
2
4k  1
What integers x satisfy this x 
?
2
4k  1
There are no integers x such that x 
because 4k  1 is always odd. This means that
2
there is no solution to the given linear congruence 2 x  1  mod 4  .
C2 Number of solutions of a Linear Congruence
This means that there are some linear congruences which have no solution. How do we
know which congruences have a solution?
The next proposition gives the condition for a solution.
Proposition (4.12).
The linear congruence
ax  b  mod n 
has a solution  g b where g  gcd  a, n  .
Note that in Example 10 above the gcd  2, 5  1 and of course 11 so the linear
congruence 2 x  1  mod 5 has a solution. On the other hand in Example 11
2 x  1  mod 4  the gcd  2, 4   2 and 2 does not divide 1 so there are no solutions to this
linear congruence.
How do we prove this proposition (4.12)?
Chapter 4: Theory of Congruences
17
Well we use Proposition (2.9) on page 34 of Elementary Number Theory by David Burton:
The linear Diophantine equation ax  by  c has a solution  g c where g  gcd  a, b  .
Proof.
We have ax  b  mod n  which means that there is an integer k such that
ax  b  kn implies ax  kn  b
Let g  gcd  a, n  . Then by Proposition (2.9) we conclude that ax  kn  b has a solution
 g b which is our required result.
■
Next we show that the linear congruence ax  b  mod n  of Proposition (4.12) has exactly
g incongruent solutions. What does incongruent mean?
Not congruent. For example
6 x  2  mod 4
has solutions x  1  mod 4  and x  3  mod 4 but
3  1  mod 4 [Not congruent]
We say x  1  mod 4  and x  3  mod 4 are two incongruent solutions of the given linear
congruence 6 x  2  mod 4 .
Proposition (4.13).
The linear congruence
ax  b  mod n 
If g b where g  gcd  a, n  then this linear congruence has exactly g incongruent
solutions modulo n.
How do we prove this result?
Again we use Proposition (2.9) on page 34 of Elementary Number Theory by David
Burton:
If x0 and y0 are any particular solutions of
ax  by  c
then all the other solutions are given by
b
a
x  x0    t , y  y0    t
g
g
where t is an arbitrary integer.
Proof.
From ax  b  mod n  we know there is an integer k such that
ax  kn  ax  n  k   b
Let x0 be a particular solution to this then by Proposition (2.9)
n
x  x0    t where t is an arbitrary integer
g
is also a solution. Substituting t  0, t  1, t  2, , t  g  1 we have
n
n
n
n
x  x0 , x0    , x0  2   , x0  3   , , x0   g  1  
g
g
g
g
Need to show that these are not congruent modulo n. How?
(*)
Chapter 4: Theory of Congruences
18
Use proof by contradiction.
Suppose any two in the list (*) are congruent modulo n:
n
n
x0  m2    x0  m1    mod n 
g
g
where 0  m1  m2  g  1 . By using Definition (4.1) from page 1 on this congruence:
a  b  mod n 
 a  b is a multiple of n or there exists k  such that
a  b  kn
This means there is an integer k1  1 such that
n 
 n 
x0  m2     x0  m1     k1n
g 
 g 
n
  k1n
g
 m2  m1  
m2  m1  k1 g  m2  m1  k1 g
We have m2  m1  k1 g  m1  g  g (because k1  1 ) and earlier we had m2  g  1 . This is
a contradiction. Hence none of the congruences in the above list (*) are congruent to each
other modulo n. This means that the list
n
n
n
n
x  x0 , x0    , x0  2   , x0  3   , , x0   g  1  
g
g
g
g
are incongruent modulo n.
n
Any other solution x  x0    t is congruent to one of these in the list modulo n. Why?
g
We use the Division Algorithm on integers t and g.
The Division Algorithm which is on page 17 of Elementary Number Theory by Burton:
Let a, b  0 be given. Then there are unique integers q and r such that
a  bq  r
0r b
Applying this on t and g means there are integers q and r such that:
t  qg  r 0  r  g
n
Substituting this into x  x0    t gives
g
n
n
x  x0    t  x0     qg  r   mod n 
g
g
n
 x0  nq  r    mod n 
g
n
 x0    r  mod n 
g
n
Since 0  r  g so this x  x0    t is in the above list.
g
■
Chapter 4: Theory of Congruences
19
C3 Solving Linear Congruences
The list produced in the proof of the above Proposition (4.13) is used to find the g solutions
of ax  b  mod n  . Hence
n
n
n
n
x  x0 , x0    , x0  2   , x0  3   , , x0   g  1  
g
g
g
g
are the g solutions of ax  b  mod n  provided g b .
Example 12
Find all the solutions of the linear congruence:
7 x  35  mod 70
Solution
First we determine the gcd of 7 and 70:
gcd  7, 70   7
What next?
Need to check that 7 divides into 35. Since 7  5  35 we have 7 incongruent solutions to
the given linear congruence.
We can find the first solution by trail and error. Is there an obvious solution?
x  5  mod 70 . How do we find the other six solutions?
Using the list in the proof
n
n
n
n
x  x0 , x0    , x0  2   , x0  3   , , x0   g  1    mod n 
g
g
g
g
n 70
With x0  5  mod 70  , n  70 and g  7 we have 
 10
g 7
x  5, 5  10, 5  2 10  , 5  3 10  , , 5   7  110   mod 70 
x  5, 15, 25, 35, 45, 55, 65
 mod 70 
You can check that each of these is a solution by substituting these into 7 x  35  mod 70 .
Example 13
Find all the solutions of the linear congruence:
7 x  34  mod 70
Solution
First gcd  7, 70   7 but 7 does not divide into 34. What does this mean in relation to
solutions of 7 x  34  mod 70 ?
There are no solutions because by Proposition (4.12) which says:
The linear congruence
ax  b  mod n 
has a solution  g b where g  gcd  a, n  .
Hence no solutions to 7 x  34  mod 70 .
Example 14
Find all the solutions of the linear congruence:
5x  34  mod 7 
Chapter 4: Theory of Congruences
20
Solution
The gcd of 5 and 7 is 1, that is gcd  5, 7   1 and 1 divides into 34. How many solutions do
we have to the given linear congruence?
One solution which means this linear congruence has a unique solution. How can we find
this?
Well 5x  34  mod 7  means that there is an integer k such that
34  7k
5
We need to substitute an integer for k which results in x being an integer. k  3 will do:
34  7  3 34  21
x

 11
5
5
We have 11  4  mod 7  . Hence the least non-negative residue modulo 7 is 4:
5 x  34  7k 
x
x  4  mod 7 
Checking that this solution is correct:
5  4  20  6  34  mod 7 
To solve the linear equation
6x 15  0
It will easier to divide through by 3 and solve 2x  5  0 . Can we divide through by a
common factor for congruences?
Need to be careful because we are dealing with integers. The next example demonstrates
this.
Example 15
Find all the solutions of the linear congruence:
6 x  15  mod 21
Solution
The gcd  6, 21  3 and 3 15 so there are 3 incongruent solutions modulo 21.
If you only have paper and pen then modulo 21 is too hard to work with. Can we convert
this to a smaller modulus and work with that?
Yes. From page 10 of the last section we have:

n
Proposition (4.8). If ac  bc  mod n  then a  b  mod  where g  gcd  c, n  .
g

We can write 6 x  15  mod 21 as
3 2 x  5  3  mod  7  3
By Proposition (4.8) we have
2 x  5  mod 7 
By inspection we have x  6  mod 7  . From this we have
x  6  7k where k is an integer
What are values of k?
Since we only have 3 solutions so k  0, 1 and 2 . By substituting these values we have
x  6, 13, 20  mod 21
Chapter 4: Theory of Congruences
21
These are the 3 incongruent solutions modulo 21. You can check these by substituting these
into the given linear congruence 6 x  15  mod 21 .
It is generally easier to divide through by the gcd  a, n  to find solutions of
ax  b  mod n  because then we are dealing with a smaller modulus.
C4 Unique Solutions
How many solutions does the general linear congruence
ax  b  mod n 
have if gcd  a, n   1 ?
Unique solution because g is the number of solutions of ax  b  mod n  provided g divides
b. We can write this as a general result.
Corollary (4.14).
If gcd  a, n   1 then the linear congruence
ax  b  mod n 
has a unique solution modulo n.
Proof.
Applying the above Proposition (4.13) on page 17 with g  1 :
Proposition (4.13). The linear congruence
ax  b  mod n 
If g b where g  gcd  a, n  then this linear congruence has exactly g incongruent
solutions modulo n.
■
Example 16
Solve the linear congruence:
6 x  1  mod 13
Solution
gcd  6, 13  1 so we have a unique solution modulo 13. The congruence 6 x  1  mod 13
means that
1  13k
6 x  1  13k  x 
where k 
6
We chose k so that x is an integer. Let k  5 then x  11 . Hence
x  11  mod 13
1
and this is the inverse or 6.
6
Similarly the unique solution of the above linear congruence 6 x  1  mod 13 is
In ordinary algebra when we have 6 x  1 which gives x 
x  11  mod 13
We call this x  11  mod 13 the (multiplicative) inverse of 6 modulo 13. We can write this
as the general result.
Chapter 4: Theory of Congruences
22
C5 Multiplicative Inverse
Definition (4.15).
If ax  1  mod n  and gcd  a, n   1 then the unique solution of this congruence is called
the multiplicative inverse of a modulo n.
Example 17
Determine the inverse of 3 modulo 14.
Solution
To find the inverse means we need to solve 3x  1  mod 14 . By inspection
x  5  mod 14
Inverse of 3 modulo 14 is 5 modulo 14.
Example 18
Determine the inverse of 3 modulo 15.
Solution
In this case we need to solve 3x  1  mod 15 . Note that the gcd  3, 15  3 but 3 does not
divide into 1 so there are no solutions to this congruence 3x  1  mod 15 .
Hence 3 modulo 15 has no inverse.
SUMMARY
(4.12) ax  b  mod n  has a solution  g b where g  gcd  a, n  .
The multiplicative inverse of a modulo n is the unique solution of ax  1  mod n  provided
gcd  a, n   1 .
Download