Calculations modulo an integer can sometimes be used to show that
an equation has no integer solutions. By working in Z/4Z
for example, we can show that a multiple of four plus three cannot be written
as a sum of two (integer) squares. In Z/4Z the elements
0 and 1 are precisely the squares of some element: 02
= 0, 12
= 1, 22
= 0, en 32
= 1.
If
m is an integer, then m 2
= 0 or 1 mod 4.
Now if m and n are integral, then m2
+ n2 =
0, 1 or 2 mod 4.
So m2
+ n2 is not a multiple of four plus three.
Suppose x = (an an-1 ... a1 a0 )10. The well-known `nine test'
9 | x if and only if 9 | an + ··· + a0
is based on modular arithmetic. For this we have to work modulo 9. We have 10 = 1 mod 9, so 10n = 1n mod 9 = 1 mod 9. In general we find that the decimal number
x = (an an-1 ... a1
a0 )10
(so x = an 10n
+ an - 1 10n - 1 + ··· +
a1
10 + a0)
modulo 9 equals
x = (an an - 1 ... a1 a0)10 mod 9
= an 10n + an - 1 10n - 1 + ··· + a110 + a0 mod 9
= an + ··· + a0 mod 9.
In particular:
9 | x if and only if 9 | an + ··· + a0.
Modular arithmetic can
greatly reduce the amount of work if we have to compute with powers. For
example, we show that 109 + 1 is divisible by 19 as
follows. Working modulo 19 we find successively: 10 = -9 mod 19,
102 = 81 = 5 mod 19, 104 = 25 = 6 mod 19,
108 = 36 = -2 mod 19. So 109 = -2 · 10 =
-20 = -1 mod 19. But this means that 19 | 109 + 1.