Units in Zn
Mark Steinberger
Abstract. We study the structure of the group of units, Z×
n , in
Zn and develop tools to compute the order of a specific unit.
Contents
1. Powers of odd primes
1.1. Units congruent to 1 mod p
1.2. Units not congruent to 1 mod p
1.3. Finding a generator for Z×
pr for r > 1
2. Powers of 2
2.1. Units congruent to 1 mod 4
2.2. Units not congruent to 1 mod 4
3. Integers divisible by more than one prime
Exercises
References
1
1
4
5
6
6
7
8
9
9
We write |ā| for the order of the unit ā ∈ Z×
n . In particular, |ā| is
the smallest positive integer k such that āk = 1̄.
1. Powers of odd primes
Here, we assume p is an odd prime and study the unit group of Zpr .
The case r = 1 is treated in [3], so we assume r > 1.
1.1. Units congruent to 1 mod p. Since p|pr there is a ring homomorphism
π : Zpr → Zp
given by π(ā) = ā for all a ∈ Z. This induces a group homomorphism
(1)
×
π : Z×
pr → Zp
We study here the units ā ∈ Z×
pr with a ≡ 1 mod p, i.e., with π(ā) =
1. This is what’s known as the kernel of the group homomorphism
Date: January 30, 2012. Copyright Mark Steinberger. All rights reserved.
1
2
MARK STEINBERGER
(1), meaning the elements carried by π to the identity element. Since
×
π(ā · b̄) = π(ā)π(b̄) for all ā, b̄ ∈ Z×
pr , this kernel is a subgroup of Zpr .
Let’s call this subgroup H = {ā ∈ Z×
pr : a ≡ 1 mod p}.
We first calculate |H|, the number of elements in H.
Lemma 1.1. |H| = pr−1 .
Proof.
|H| = |{pk + 1 : 0 ≤ pk + 1 < pr }|
pr − 1 = pk + 1 : 0 ≤ k <
p
pr 1 = pk + 1 : 0 ≤ k <
−
p
p pr
r−1 =p
= pk + 1 : 0 ≤ k <
p
= pr−1 .
Since H is abelian, the order of any of its elements must divide |H|,
so the following is now immediate:
Corollary 1.2. Let a ≡ 1 mod p. Then the order of ā in Z×
pr divides
r−1
p
and hence is a power of p.
If b ∈ Z is divisible by p, we can write b uniquely as
(2)
b = pk c with (p, c) = 1 and k > 0.
This is just uniqueness of prime decomposition: c is the product of the
prime powers in that decomposition whose primes are not p. We call
pk the p-part of b.
For ā ∈ H, a − 1 is divisible by p, as a ≡ 1 mod p. So we can write
a uniquely as
(3)
a = pk b + 1 with (p, b) = 1 and k > 0.
Note that Equation (3) is equivalent to saying that a ≡ 1 mod pk
but a 6≡ 1 mod pk+1 , as pk |(a − 1) but pk+1 6 |(a − 1). The main result
of this section is the following.
Theorem 1.3. Let r > 1 and suppose Equation (3) holds, i.e., that
a ≡ 1 mod pk but a 6≡ 1 mod pk+1 for k > 0. Of course, if k ≥ r this
r−k
says ā has order 1 in Z×
in Z×
pr . But if k ≤ r, then ā has order p
pr .
The proof makes use of the binomial theorem, which may be found
as Theorem 10 in Chapter 2 of [1], or as Theorem 4.5.16 in [2].
UNITS IN Zn
3
Theorem 1.4 (Binomial theorem). For an integer n ≥ 1, we have
n n−k k
n
n
n−1
(x + y) = x + nx y + · · · +
x y + · · · + nxy n−1 + y n ,
k
n!
where nk = k!(n−k)!
and x and y may be taken to be integers, or, more
generally, to lie in any commutative ring.
The key to applying the binomial theorem to our situation is the
following lemma.
Lemma
1.5. For i = 1, . . . , p − 1, p divides the binomial coefficient
p
.
i
Proof.
p
p!
=
.
i
i!(p − i)!
Binomial coefficients are always integers. The numerator is divisible
by p, but the denominator is not. So when we reduce the fraction, the
result will be divisible by p.
We make use of this as follows.
Corollary 1.6. Suppose a ≡ 1 mod pk but a 6≡ 1 mod pk+1 for k > 0.
Then ap ≡ 1 mod pk+1 but ap 6≡ 1 mod pk+2 .
Proof. Write a = 1 + pk b with (p, b) = 1. Then
ap = (1 + pk b)p
p
p
k 2
(4)
=1+p·p b+
(p b) + · · · +
(pk b)p−1 + (pk b)p .
2
p−1
k i
p
For i = 2, . . . , p − 1, i (p b) is divisible by p · pki = pki+1 by
Lemma 1.5. Since i > 1 and k > 0, ki + 1 ≥ k + 2, so pi (pk b)i ≡
0 mod pk+2 .
Similarly, (pk b)p ≡ 0 mod pk+2 , as p > 2. Thus,
k
ap ≡ 1 + pk+1 b mod pk+2
(the first two terms of (4)). The result follows.
Proof of Theorem 1.3. We argue by downward induction on k (i.e.,
by induction on −k). The base case is k = r, where a ≡ 1 mod pr and
hence has order 1 = p0 , so the result is true.
Now assume inductively that 0 < k < r and the result is true for all
integers of the form pk+1 c + 1 with (p, c) = 1. Then if a = pk b + 1 with
(p, b) = 1, Corollary 1.6 gives
ap = pk+1 c with (p, c) = 1.
4
MARK STEINBERGER
Thus, by the inductive assumption, āp has order pr−(k+1) = pr−k−1 in
Z×
pr . So
|ā|
pr−k−1 = |āp | =
,
(|ā|, p)
so
(5)
|ā| = pr−k−1 (|ā|, p).
But a ≡ 1 mod p, so |ā| is a power of p by Corollary 1.2. Since k < r,
|ā| =
6 1 = p0 , so p divides |ā|, hence (|ā|, p) = p. The result now follows
from (5).
Theorem 1.3 now gives the following.
Corollary 1.7. 1 + p has order pr−1 = |H| in Z×
pr , hence 1 + p generates H. In fact, any integer congruent to 1 mod p but not congruent
to 1 mod p2 generates H.
2
Example 1.8. We calculate the order of 19 in Z×
35 . 19 = 1 + 3 · 2, so
|19| = 35−2 = 27 in Z×
35 .
1.2. Units not congruent to 1 mod p. Now we consider elements
ā ∈ Z×
pr not congruent to 1 mod p. We shall compare the order of ā in
Z×
to
the order of ā in Zp . (Implicitly, we are studing the homomorr
p
×
phism π : Z×
pr → Zp .)
We write |ā| for the order of ā in Z×
pr and write d for the order of ā
×
in Zp .
Lemma 1.9. d divides |ā|.
Proof. a|a| ≡ 1 mod pr , so a|a| ≡ 1 mod p. Thus |ā| is an exponent for
ā in Z×
p.
By Fermat’s Theorem, d divides p − 1. Note that d is the smallest
positive integer such that ad ≡ 1 mod p. Thus, it is reasonably easy to
calculate by hand. Moreover, since ad ≡ 1 mod p, we can calculate its
order in Z×
pr by Theorem 1.3.
We can put these together as follows.
Theorem 1.10. Let d be the order of ā in Z×
p and let k be the order
×
of ād in Z×
.
Then
the
order,
|ā|,
of
ā
in
Z
is
given by
r
r
p
p
|ā| = dk.
Proof. We have
k = |ād | =
|ā|
,
(|ā|, d)
UNITS IN Zn
5
so
|ā| = k(|ā|, d).
By Lemma 1.9, d divides |ā|, so (|ā|, d) = d, and the result follows. Example 1.11. We calculate the order of 19 in Z×
78 . We have 19 ≡
6
×
5 mod 7, and 5 = −2 has order 6 in Z7 . So |19| = 6|19 | in Z×
78 . Now
196 = 47045881 = 1 + 73 · 137160,
6
5
and (137160, 7) = 1, so |19 | = 78−3 = 75 in Z×
78 . Thus |19| = 6 · 7
there.
1.3. Finding a generator for Z×
pr for r > 1. We shall make use of
the primitive root theorem, given, for instance, in [3].
Theorem 1.12 (Primitive root theorem). For p prime, the unit group
Z×
p contains an element ā of order p − 1, and hence is cyclic.
k
By cyclic, we mean that Z×
p = hāi = {ā | k ∈ Z}, the set of all
integer powers of ā. In this case, we say that ā generates Z×
p.
Using this, we show that Z×
is
also
cyclic.
pr
To find a generator of Z×
,
we
start by finding an integer a such that
r
p
×
ā generates Zp . We may do this by the primitive root theorem, but
not algorithmically. This is the only step that requires trial and error.
In particular, the order of ā in Z×
p is p − 1. By Lemma 1.9, p − 1
×
divides the order, |ā|, of ā in Zpr . Let |ā| = (p − 1)m. Then
|ām | =
|ā|
(p − 1)m
=
= p − 1.
(|ā|, m)
m
Let b = am so that |b̄| = p − 1. (Note that the value of m may be
calculated via Theorem 1.10, by finding the value of ap−1 mod pr and
applying Theorem 1.3.)
Theorem 1.13. With b as above, let c = (p + 1)b. Then c̄ has order
×
φ(pr ) = pr−1 (p − 1) in Z×
pr , and hence c generates Zpr .
The proof is almost immediate from the following lemma, which is
proven in [3].
Lemma 1.14. Let G be an abelian group and let a, b ∈ G of relatively
prime order. Then the order, |ab|, of ab is |a| · |b|, the product of the
orders of a and b.
Proof of Theorem 1.13. By Theorem 1.3, p + 1 has order pr−1 , and
b̄ was chosen to have order p − 1. By Lemma 1.14, their product has
order pr−1 (p − 1) = φ(pr ).
6
MARK STEINBERGER
2. Powers of 2
The situation for powers of 2 is intrinsically different from powers of
odd primes, as all units are 1 mod p, but for r > 2, Z×
2r is not generated
×
by a single element. This can be seen easily for Z8 = {1, 3, 5, 7}, where
3, 5 and 7 all square to 1, and hence have order 2.
×
×
In fact, the behavior of Z×
2 , Z4 , and Z2r with r > 2 are all distinct.
×
×
Z2 has only one element, 1. Z4 = {±1}, and for all r > 2 we’ll see
that Z×
2r has three elements of order 2.
Since all units are 1 mod 2, the key will be looking at those units
that are 1 mod 4.
2.1. Units congruent to 1 mod 4. Here, we study Z×
2r with r > 2.
For a ≡ 1 mod 4, we have
(6)
a = 2k b + 1 with (2, b) = 1 and k > 1.
As in the case of odd primes this is equivalent to a ≡ 1 mod 2k but
a 6≡ 1 mod 2k+1 , but in this case we have a clearer characterization:
since b is odd, 2k b ≡ 2k mod 2k+1 . Thus, a satisfies (6) if and only if
a ≡ 2k + 1 mod 2k+1 . (One can also see this characterization via binary
expansions.)
The key lemma here is the following analogue of Corollary 1.6.
Lemma 2.1. Let a ≡ 2k + 1 mod 2k+1 for k > 1. Then
a2 ≡ 2k+1 + 1 mod 2k+2 .
Proof. Let a = 2k b + 1 with b odd. Then
a2 = 1 + 2k+1 b + 22k b2 .
Since k > 1, 2k ≥ k + 2 and the result follows.
The restriction that k > 1 above is essential as when k = 1, a2 ≡
1 mod 8. (Check it!) In this case, the 2-part of a2 − 1 depends on the
value of b mod 4.
Here, we let
H = {ā ∈ Z×
2r : a ≡ 1 mod 4}
= {4k + 1 : 0 ≤ 4k + 1 < 2r }
2r − 1
= 4k + 1 : 0 ≤ k <
4
r
2
1
= 4k + 1 : 0 ≤ k <
−
4
4
= 4k + 1 : 0 ≤ k < 2r−2 ,
UNITS IN Zn
7
so |H| = 2r−2 . This doesn’t give any new information on orders as
φ(2r ) = 2r−1 , so the order of any unit in Z×
2r is a power of 2. But as
in the case of odd primes, we will show that H is generated by one
element. The main result of this subsection is the following.
Theorem 2.2. Let a ≡ 2k + 1 mod 2k+1 for 1 < k ≤ r. Then the order
r−k
of ā in Z×
. In particular, if a ≡ 5 mod 8 then ā generates H.
2r is 2
Proof. Again, we argue by downward induction on k. In the base
case, where k = r, ā = 1 and the result is trivial. Thus, assume that
1 < k < r and that the result is true for integers b with
(7)
b ≡ 2k+1 + 1 mod 2k+2 .
Then if a ≡ 2k + 1 mod 2k+1 , a2 satisfies (7) by Lemma 2.1. We get
|ā2 | = 2r−(k+1) = 2r−k−1 by the inductive assumption. Thus.
2r−k−1 = |ā2 | =
|ā|
,
(|ā|, 2)
so
|ā| = 2r−k−1 (|ā|, 2).
Since the order of ā is a positive power of 2, (|ā|, 2) = 2, and the result
follows.
2.2. Units not congruent to 1 mod 4. Again, r > 2.
If a 6≡ 1 mod 4 and ā ∈ Z×
2r , then a must be congruent to 3 mod 4.
So −a is congruent to 1 mod 4 and the order of −ā may be computed
by Theorem 2.2. Of course −1 has order 2 as r > 1. The orders of the
other units can be calculated as follows:
Proposition 2.3. Let a ≡ 3 mod 4 with a 6≡ −1 mod 2r . Then ā and
−ā have the same order in Z×
2r .
Proof. Let c̄ 6= 1 ∈ Z×
2r . Then since |c̄| is a positive power of 2,
(|c̄|, 2) = 2, hence
|c̄| = (|c̄|, 2)|c̄2 | = 2|c̄2 |.
Since ā and −ā have the same square and since neither is the identity,
they have the same order.
We can now determine the structure of Z×
2r .
Theorem 2.4. For r > 2, the map
µ : {±1} × H → Z×
2r
given by µ(±1, ā) = ±ā is an isomorphism.
8
MARK STEINBERGER
Proof. µ is easily seen to be a group homomorphism. The two groups
have the same order, and µ is onto as the image contains all units
congruent to either 1 or 3 mod 4.
Either of the preceding results shows that the largest order of an
r−2
r−1
element in Z×
= |5̄|. Since |Z×
we see that the
2r , r > 2, is 2
2r | = 2
prime 2 behaves quite differently from odd primes:
Corollary 2.5. Z×
2r is not generated by a single element when r > 2.
Regarding the elements of order 2, we first show the following.
Lemma 2.6. The only element of order 2 in H is 2r−1 + 1.
Proof. By Theorem 2.2, ā has order 2 in H if and only if a ≡ 2r−1 +
1 mod 2r (i.e., k = r − 1). There is only one such element in H, as 2r
is our modulus.
Proposition 2.3 now gives the following.
r−1 + 1
Corollary 2.7. The elements of order 2 in Z×
2r , r > 2, are ±2
and −1. Note that −2r−1 + 1 = 2r−1 − 1.
Example 2.8. We calculate the order of 19 in Z×
29 . Since 19 ≡ −1 mod
2
×
×
4, 19 has order 2 in Z4 . So |19| = 2|19 | in Z29 . Now, 192 = 361 =
2
1 + 23 · 45, so |19 | = 29−3 = 64 in Z×
29 , giving |19| = 128 there.
3. Integers divisible by more than one prime
When n has more than one prime divisor, we can apply the Chinese
remainder theorem to study the units in Zn . Proofs of the following
may be found as Corollary 10 in Chapter 12 of [1] or as Corollary 4.5.7
of [2]. We give here the form of the Chinese remainder theorem for
units.
Theorem 3.1 (Chinese remainder theorem). Let n = pr11 . . . prkk with
p1 < · · · < pk prime and ri > 0 for all i. Then there is an isomorphism
of abelian groups
×
×
ρ : Z×
n → Zpr1 × · · · × Zprk
1
k
ā 7→ (ā, . . . , ā).
Since we have just calculated the group structure for each Z×
pr this
tells us the group structure on the Cartesian product. In particular,
we obtain the following.
UNITS IN Zn
9
Corollary 3.2. Let n = pr11 . . . prkk with p1 < · · · < pk prime and ri > 0
for all i and let a ∈ Z. Then āk = 1̄ in Zn if and only if āk = 1̄ in
Zpri i for all i. In consequence, the order of ā in Z×
n is the least common
×
multiple of the orders of ā in the Zpri .
i
Proof. In the Cartesian product we have (ā, . . . , ā)k = (āk , . . . , āk ),
and this tuple is the (multiplicative) identity if and only if each coordinate is 1̄. Thus, āk = 1̄ in Zn if and only if k is divisible by the order
of ā in each Z×
r . And that will hold if and only if k is divisible by the
pi i
least common multiple of those orders.
9 5 8
Example 3.3. We calculate the order of 19 in Z×
n for n = 2 3 7 . By
×
Example 1.8, 19 has order 33 in Z35 . By Example 1.11, 19 has order
×
7
6 · 75 in Z×
78 . By Example 2.8, 19 has order 2 in Z29 . So the order of
19 in Z×
n is the least common multiple
[27 , 33 , 6 · 75 ] = 27 33 75 .
The factor of 6 in the order mod 78 has been absorbed by the orders
mod 29 and 35 .
Exercises
1.
2.
3.
4.
5.
6.
7.
What is the largest order of an element in Z×
60 ?
×
Find a generator of Z125 .
Find an element of order 20 in Z×
125 .
×
What is the order of 12 in Z125 ?
Find a generator of Z×
712 .
Find an element of order 5 · 312 in Z×
314 .
Find an element of order 30 in Z×
.
314
References
[1] Childs, Lindsay N. A concrete introduction to higher algebra. Third edition.
Undergraduate Texts in Mathematics. Springer, Berlin, 2009. ISBN: 978-0-38774527-5. MR2464583 (2009i:00001).
[2] Steinberger, Mark. Algebra. http://www.albany.edu/~mark/algebra.
pdf.
[3] Steinberger, Mark. The primitive root theorem. Course supplement: http:
//www.albany.edu/~mark/classes/326/primelt.pdf.
© Copyright 2026 Paperzz