Lecture 15
When there is a number b such that ab≡1(modm), we call it the inverse of a, modulo m (and we say that a is invertible). We write a−1 for the inverse of a.
Notice that, as a consequence modular arithmetic modulo a prime p is fantastically well-behaved: any nonzero residue a≡0(modp) has an inverse (since we have gcd(a,p)=1 unless a is a multiple of p).
Spotting inverses modulo m is quite difficult; in general the best way is to use Euclid’s algorithm.
There are a few exceptions:
The inverse of 1 modulo m is always
1.
The inverse of −1 modulo m is always
−1.
If m is odd, then 2 is invertible modulo m, because gcd(m,2)=1. The inverse is:
(m+1)/2.
Two other fairly easy, but useful, facts are as follows:
Proposition
If a is invertible modulo m, then so is a−1, with inverse given by (a−1)−1≡a(modm).
Proof
We have aa−1≡1(modm), which says that a is an inverse for a−1.
Proposition
If a and b are both invertible, then ab is too, with inverse given by (ab)−1≡b−1a−1(modm).
Proof
We have (ab)b−1a−1≡aa−1bb−1≡1⋅1≡1(modm).
As a big example of all of this, let’s find an inverse for 37, modulo 100. We want x with 37x≡1(mod100). In other words, we seek a solution to 37x+100k=1 in the integers. We’ll get one from working through Euclid’s algorithm: 100264=2×37+26=2×11+4=1×3+137113=1×26+11=2×4+3=3×1. So we have that 1=1×4−1×3=3×4−1×11=3×26−7×11=10×26−7×37=10×100−27×37.=1×4−1×(11−2×4)=3×(26−2×11)−1×11=3×26−7×(37−26)=10×(100−2×37)−7×37 That means that (−27)×37≡1(mod100), so the inverse of 37 is −27, which is congruent to 73 (mod 100).
Checking our working
And, of course, we can check this easily: 37×73=2701≡1(mod100) as claimed.
The Chinese Remainder Theorem
We’ve come to understand congruence equations: given something like 123x≡456(mod789), we can, with some effort, turn it into something nice like x≡132(mod263).
Now we’ll discuss a different sort of problem with congruences: what if we have two of them for the same number? For example, xx≡1(mod4)≡3(mod7)? These things happen all the time: two things happening periodically with different periods.
And it turns out we can solve them using exactly the same machinery as we’ve been using all along. Indeed, these equations say that x−1x−3=4a=7b, for some numbers a and b.
That means that 1+4a=3+7b, or in other words 4a−7b=2. We have lots of experience solving these, and, since gcd(4,7)=1, it’s possible.
A solution to 4a−7b=1 is given by a=2, b=1, and so a solution to 4a−7b=2 is given by doubling that to get a=4, b=2.
What’s the general solution? Well, if we have 4a−7b=2, then subtracting 4×4−7×2=2 gives 4(a−4)−7(b−2)=0. This means that 7∣4(a−4), so 7∣(a−4). Hence a is of the form 7k+4. and in fact any such a works.
Now, we had x=4a+1, which in turn is 28k+17. In other words: x≡17(mod28).
There need not always be solutions to simultaneous congruences. For example, the simultaneous congruences xx≡4(mod6)≡3(mod8) don’t have solutions. Why is this obvious?
The first equation implies x even, the second x odd.
Of course, if we go through the same solution process as above it will fail. We set xx=4+6a=3+8b and find that 4+6a=3+8b, and hence 8b−6a=1. This has no solutions because gcd(8,6)=2, and 2∤1.