Recall:
- a mod m means the remainder upon dividing by m;
this partitions the integers into equivalence classes.
- a ≡ b (mod n) means... m | a-b.
- In +,* mod m, we saw we can replace any number with
a congruent number. Not so for exponentiation.
Division:
Consider the series 0, 1*a, 2*a, 3*a, 4*a, ... mod m.
Try a=5, m=8: 0, 5, 2, 7, 4, 1, 6, 3, 0, 5, 2, 7, ...
We see we hit a cycle (of length 8).
What is 5^-1 mod 8?
That is, the multiplicative inverse of 5, mod 8?
Looking at the sequence above, we see that 5*5=1,
so 5 is its own inverse: 5^-1 = 5 (mod 8).
Try a=6, m=8: 0, 6, 4, 2, 0, 6, ...
Uh-oh, we hit a cycle (of length four).
What is 6^-1 mod 8? It doesn't exist!
(makes sense when you think about it: 6 times any number
will be even, so it will never by 1 plus a multiple of 8.
What is the difference between 5 and 6, mod 8, so that
one has an invese and the other doesn't?
...
Th'm: If ac=bc (mod m), and gcd(c,m)=1, then a=b (mod m).
["relatively prime"]
[Proof.]
Okay now that we have a handle on repeated addition (muliplication),
lets look at repeated multiplication (exponeniation):
Consider 1,a,a^2,a^3,...
As in programming, the first step is to get an internal grip
on what this means, by looking at examples.
Try a=5, m=8: 1,5,1,5,1,5,...
Try a=6, m=8: 1,6,4,0,0,0,...
Yikes!
Fermat's little th'm: For p prime, a^p-1 = 1 (mod p)
Or alternatively, a^p = a (mod p).
[Proof is in book.]