The Order of a Unit
The discrete log problem may be hard, but we do know some facts about the powers of a unit . Firstly, for some : since there are finitely many units, we must have for some eventually, and since exists we find .
Let . The smallest positive integer for which is called the order of . The sequence repeats itself as soon as it reaches . (since ), and we have precisely when is a multiple of .
Example: The powers of are so the order of is .
The following theorems narrow down the possible values for the order of a unit.
Fermat’s Little Theorem
Theorem: Let be a prime. Then for any .
This theorem is often equivalently stated as for nonzero .
Proof: We first show an identity sometimes referred to as the freshman’s dream: for a prime , we have
This is immediate the binomial expansion, because divides every term except for two terms, that is
By induction we have
Thus if we write (where there are 1s), we have
Fermat’s Theorem gives an alternative way to compute inverses. For , can be computed as , since we have by the theorem.
Euler’s Theorem
Theorem: If then .
This reduces to Fermat’s Little Theorem when is prime.
Proof: Let , and label the units . Consider the sequence (we multiply each unit by ). If , then multiplying by (which exists since is a unit) shows , hence the members of the sequence are distinct. Furthermore products of units must also be units, hence must be in some order.
Multiplying all the units together gives
Rearranging yields
Similarly Euler’s Theorem also gives an alternative way to compute inverses. For , can be computed as . This is efficient as we may use repeated squaring, but Euclid’s algorithm is still faster (why?) and does not require one to compute .
These theorems do not tell us the order of a given unit but they do narrow it down: let be the order of . If we know by Euclid’s algorithm we can find such that
where . Then
thus since we must have (since is the smallest positive integer for which ), and hence must be a divisor of . Thus by Euler’s Theorem, the order of divides .
These statements are in fact trivial corollaries of Lagrange’s Theorem from group theory. Of course Fermat and Euler died long before group theory was discovered.
Multiplication and Order
Let be the order of , and be the order of . What is the order of ?
Suppose . Raising both sides to shows
Since has order we see that .
Suppose are coprime. Then we must have . Similarly , hence must be a multiple of . On the other hand, we have . Hence the order of is precisely : for elements with coprime orders, the order of their product is equal to the product of their orders.
More generally, let . Then and implies that must be a multiple of . If is the least common multiple of and , which we can compute by , then . All we can say at the moment is that the order of is a multiple of and divides .
The RSA Problem
Suppose we are given positive integers , and for some unit . How can we recover ?
One strategy is to find an integer such that . By Euler’s Theorem, will satisfy this equation if for some . In other words, we compute
and compute to recover .
However it is not known how to compute from without factoring , and it is not known how to factor large numbers efficiently.