( ) + y z ( )n

Math 546 – Congruence
The relation x ! y mod n means that x ! y is a multiple of n (or equivalently that n
divides x ! y ).
For any integer n >1, the relation x ! y mod n is an equivalence relation on the set of all
integers.
x ! y mod n is reflexive since for any integer m, n|(m ! m) and so m ! m mod n .
x ! y mod n is symmetric since if x ! y mod n then x ! y = kn for some integer k and
hence, y ! x = (!k ) n and so y ! x mod n .
x ! y mod n is transitive since if x ! y mod n and y ! z mod n , then
x ! y = kn, y ! z = qn for some integers k and q.
But then x ! z = (x ! y ) + ( y ! z) = kn + qn = (k + q)n , and so x ! z mod n .
Properties of x ! y mod n .
I.
Suppose that x ! y mod n and k is any integer. Then
(i). k + x ! k + y mod n
(ii). kx ! ky mod n
i.e., The result of adding or multiplying on both sides of a congruence by the
same constant is also a congruence. Make sure that you can verify this result.
II.
Suppose that x ! y mod n and a ! bmod n . Then
(i). a + x ! b + y mod n
(ii). ax ! by mod n
i.e., the result of adding or multiplying corresponding sides of a congruence is
again a congruence.
Proof. (i). Since x ! y mod n and a ! bmod n , there exist integers k and q
such that x ! y = kn, a ! b = qn , and so (a + x ) ! (b + y ) = kn ! qn = ( k ! q) n
and hence a + x ! b + y mod n .
(ii). Since x ! y mod n , then by I(ii), we get ax ! ay mod n .
Also since a ! bmod n , we get from I(ii) that ay ! by mod n .
But now, since congruence modulo n is transitive, it follows from
ax ! ay mod n and ay ! by mod n that ax ! by mod n .
III.
For every positive integers n and m there exist integers q and r such that
m = nq + r. 0 ! r < n . (This effectively just says that if m is divided by n,
then we get some quotient q and remainder r.) So it is clear that if a and b are
integers that leave the same remainder when divided by n, then a ! bmod n .
Conversely, if a ! bmod n , then a and b leave the same remainder when
divided by n.
IV.
Suppose that x y mod n and k is any positive integer. Then x k y k mod n .
Proof. This follows from II(ii) by induction. For the result is clearly true when
k = 1. And if, for some k ≥ 1, it is true that x k y k mod n , then since
x ! y mod n it follows that n n k x x k mod n
n k + 1 x k +1 .
Example
So now suppose that we want to find the remainder when 21000 is divided by 7.
We note that 3 7 2 mod 7 and so (23 )
But then 2 !2
999
" 2 !1mod 7 # 2
1000
333
1333 mod 7
2999
1mod 7.
" 2 mod 7 . So the remainder is 2.
A Harder Example
What is the remainder when 7100 is divided by 17? This is harder but not too bad. We
2
2 mod 17 since 51 = 17 3. But now squaring both sides of
might notice first that 7
the last congruence we get, 74 ! 4 mod 17. Now squaring both sides again we get.
78 16 mod 17 and since 16
1 mod 17 we get by transitivity that 78
1 mod 17.
16
But now squaring both sides of this last congruence gives us 7
1 mod 17 .
Hence we get (716 )
6
16 mod 17
7 96
1 mod 17. And now since 796 ! 6 mod 67
and 74 4 mod 17, we get 7100 ! d moo 17. So the remainder when 7100 is divided by
17 is 4.
Equivalence Classes
For the relation x y mod n , the equivalence class of an integer m is simply the set of all
those integers that leave the same remainder as m when divided by n.
Example: For x y mod 6 ,
[ 5 ] = { , 7, 1, 5, 11, 17, 23,
},
[ 2 ] = {!, ! 10, ! 4, 2, 8, 14, 20, !}
Polynomials
If P(c) = c 0 + c1 c + c 2 c 2 + !c k c k is any polynomial with integer coefficients, then if
a b mod n , it follows that P(a) ! P(b) mod n . This follows directly from properties I
and IV above.
Example. Since 3m d mod 33 it follows that 135 + 6 133 + 7
(In this case the polynomial is P(x) + x 5 6x 3 7 .
2 5 + 6 2 3 + 7 mod 11.