The set is a group, called the group of units of the ring ; it will be of great interest to us. Each element of this group has an order, and Lagrange's theorem from group theory implies that each element of has order that divides the order of . In elementary number theory this fact goes by the monicker ``Fermat's Little Theorem'', and we reprove it from basic principles in this section.
Since , Proposition 2.1.9 implies that we can cancel 's and conclude that
sage: R = Integers(10) sage: a = R(3) # create an element of Z/10Z sage: a.multiplicative_order() 4Notice that the powers of are periodic with period , i.e., there are four powers and they repeat:
sage: [a^i for i in range(15)] [1, 3, 9, 7, 1, 3, 9, 7, 1, 3, 9, 7, 1, 3, 9]The command range(n) we use above returns the list of integers between 0 and , inclusive.
For example,
In Section 2.2.1, we will prove that is a multiplicative function. This will yield an easy way to compute in terms of the prime factorization of .
sage: euler_phi(2007) 1332
which has order . The theorem then asserts that the order of an element of divides the order of . This is a special case of the more general fact (Lagrange's theorem) that if is a finite group and , then the order of divides the cardinality of .
We now give an elementary proof of the theorem. Let
In the same way that we proved Lemma 2.1.11, we see that the reductions modulo of the elements of are the same as the reductions of the elements of . Thus
since the products are over the same numbers modulo . Now cancel the 's on both sides to get
as claimed.
sage: n = 20 sage: k = euler_phi(n); k 8 sage: [Mod(x,n)^k for x in range(n) if gcd(x,n) == 1] [1, 1, 1, 1, 1, 1, 1, 1]
William 2007-06-01