1.3.1. The order of an integer modulo nn

This section is based on part of [BUR11, Sec. 8.1].

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}}. We make the following observations and recollections that are used throughout this chapter:

  • •
    ​

    Let k≥1{k\geq 1}. Suppose that ak≡1(modn){a^{k}\equiv 1\pmod{n}}. Theorem 1.2.2.2(1) applied to the linear congruence a⁢x≡1(modn){ax\equiv 1{\pmod{n}}} (which has the solution ak−1a^{k-1}) implies that gcd⁡(a,n)=1{\gcd(a,n)=1}.

  • •
    ​

    Let k≥1{k\geq 1}. Then gcd⁡(a,n)=1{\gcd(a,n)=1} if and only if gcd⁡(ak,n)=1{\gcd(a^{k},n)=1}. Indeed, Theorem 1.1.4.2 implies that aa and aka^{k} have the same set of prime divisors. Since every positive integer greater than one admits a prime divisor, the claim follows.

  • •
    ​

    Recall Euler’s Theorem (Theorem 1.2.6.2). Suppose that gcd⁡(a,n)=1{\gcd(a,n)=1}. Then aφ⁢(n)≡1(modn){a^{\varphi(n)}\equiv 1\pmod{n}}, where φ⁢(n)\varphi(n) is the number of integers 1≤k<n{1\leq k<n} that are coprime with nn.

The following definition is then natural.

Definition 1.3.1.1.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. The order of aa modulo nn is

ord⁡(a)=ordn⁡(a)≔min⁡{k∈ℤ:1≤k≤φ⁢(n)⁢ and ⁢ak≡1(modn)}.\operatorname{ord}(a)=\operatorname{ord}_{n}(a)\coloneqq\min\{k\in\mathbb{Z}% \colon{1\leq k\leq\varphi(n)\text{ and }a^{k}\equiv 1\pmod{n}}\}.

The order is well-defined: the set above contains φ⁢(n)\varphi(n) by Euler’s Theorem (Theorem 1.2.6.2).

Example 1.3.1.2.

Let n=11{n=11} and a=3{a=3}. Since 1111 is prime, φ⁢(11)=11−1=10{\varphi(11)=11-1=10}. Then

31≡3, 32≡9, 33≡5, 34≡4, 35≡1(mod11).3^{1}\equiv 3,\ 3^{2}\equiv 9,\ 3^{3}\equiv 5,\ 3^{4}\equiv 4,\ 3^{5}\equiv 1% \pmod{11}.

Therefore, ord11⁡(3)=5<10=φ⁢(11){\operatorname{ord}_{11}(3)=5<10=\varphi(11)}.

Lemma 1.3.1.3.

Let n>1{n>1} and a,b∈ℤ{a,b\in\mathbb{Z}} with gcd⁡(a,n)=gcd⁡(b,n)=1{\gcd(a,n)=\gcd(b,n)=1}. If

a≡b(modn),a\equiv b\pmod{n},

then ordn⁡(a)=ordn⁡(b){\operatorname{ord}_{n}(a)=\operatorname{ord}_{n}(b)}.

Proof.

By Proposition 1.2.1.6(6), if a≡b(modn){a\equiv b\pmod{n}}, then ak≡bk(modn){a^{k}\equiv b^{k}\pmod{n}} for all k≥1{k\geq 1}. By Proposition 1.2.1.6(2) and Proposition 1.2.1.6(3),

ak≡1(modn)⟺bk≡1(modn).a^{k}\equiv 1\pmod{n}\quad\Longleftrightarrow\quad b^{k}\equiv 1\pmod{n}.

The claim is now immediate from the definition of the order modulo nn. ∎

Example 1.3.1.4.

The following table records the order modulo 1111 of all integers 1≤a<11{1\leq a<11}:

aa 1 2 3 4 5 6 7 8 9 10
ord11⁡(a)\operatorname{ord}_{11}(a) 1 10 5 5 5 10 10 10 5 2
Theorem 1.3.1.5.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. For an integer ℓ≥0{\ell\geq 0},

aℓ≡1(modn)⟺ordn⁡(a)∣ℓ.a^{\ell}\equiv 1\pmod{n}\quad\Longleftrightarrow\quad\operatorname{ord}_{n}(a)% \mid\ell.
Proof.

Set k≔ordn⁡(a){k\coloneqq\operatorname{ord}_{n}(a)}. Suppose that

aℓ≡1(modn).a^{\ell}\equiv 1\pmod{n}.

Using the Division with Remainder Theorem (Theorem 1.1.1.8), write ℓ=q⁢k+r{\ell=qk+r} with q,r∈ℤ{q,r\in\mathbb{Z}} and 0≤r<k{0\leq r<k}; notice that q≥0{q\geq 0} since ℓ≥0{\ell\geq 0} and r<k{r<k}. Then

aℓ=aq⁢k⁢ar=(ak)q⁢ar.a^{\ell}=a^{qk}a^{r}=(a^{k})^{q}a^{r}.

Since ak≡1(modn){a^{k}\equiv 1\pmod{n}}, by Proposition 1.2.1.6(6),

(ak)q≡1(modn).(a^{k})^{q}\equiv 1\pmod{n}.

Then, by Proposition 1.2.1.6(4), the congruence

aℓ≡ar(modn)a^{\ell}\equiv a^{r}\pmod{n}

holds. Since

aℓ≡1(modn),a^{\ell}\equiv 1\pmod{n},

by Proposition 1.2.1.6(3), we have

ar≡1(modn).a^{r}\equiv 1\pmod{n}.

Finally, since 0≤r<k{0\leq r<k}, the minimality of k=ordn⁡(a){k=\operatorname{ord}_{n}(a)} implies that r=0{r=0}. Hence, ℓ=q⁢k{\ell=qk} so that k∣ℓ{k\mid\ell}.

Conversely, suppose that k∣ℓ{k\mid\ell}. Then there exists an integer q≥0{q\geq 0} such that ℓ=q⁢k{\ell=qk}, since ℓ≥0{\ell\geq 0} and k≥1{k\geq 1}. Since aℓ=(ak)q{a^{\ell}=(a^{k})^{q}} and ak≡1(modn){a^{k}\equiv 1\pmod{n}}, Proposition 1.2.1.6(6) implies that aℓ≡1(modn){a^{\ell}\equiv 1\pmod{n}} holds. This finishes the proof. ∎

Corollary 1.3.1.6.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. Then ordn⁡(a)∣φ⁢(n){\operatorname{ord}_{n}(a)\mid\varphi(n)}.

Proof.

Immediate from Euler’s Theorem (Theorem 1.2.6.2) and Theorem 1.3.1.5. ∎

Example 1.3.1.7.

Let n=11{n=11} and a=3{a=3}. We have seen in Example 1.3.1.2 that ord11⁡(3)=5{\operatorname{ord}_{11}(3)=5}, which indeed divides φ⁢(11)=10{\varphi(11)=10}.

Corollary 1.3.1.8.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. Set k≔ordn⁡(a){k\coloneqq\operatorname{ord}_{n}(a)}. For integers i,j≥0{i,j\geq 0},

ai≡aj(modn)⟺i≡j(modk).a^{i}\equiv a^{j}\pmod{n}\quad\Longleftrightarrow\quad i\equiv j\pmod{k}.

Exercise. The proof will be added later.

Corollary 1.3.1.9.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. For integers 1≤i,j≤ordn⁡(a){1\leq i,j\leq\operatorname{ord}_{n}(a)},

ai≡aj(modn)⟺i=j.a^{i}\equiv a^{j}\pmod{n}\quad\Longleftrightarrow\quad i=j.
Proof.

Since 0≤|i−j|<ordn⁡(a){0\leq|i-j|<\operatorname{ord}_{n}(a)} by assumption, the claim is immediate from Proposition 1.2.1.2 and Corollary 1.3.1.8. ∎

Theorem 1.3.1.10.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} be such that gcd⁡(a,n)=1{\gcd(a,n)=1}. Set k≔ordn⁡(a){k\coloneqq\operatorname{ord}_{n}(a)}. For an integer ℓ≥0{\ell\geq 0},

ordn⁡(aℓ)=kgcd⁡(k,ℓ).\operatorname{ord}_{n}(a^{\ell})=\frac{k}{\gcd(k,\ell)}.
Proof.

Set d≔gcd⁡(k,ℓ){d\coloneqq\gcd(k,\ell)} and

r≔ordn⁡(aℓ)r\coloneqq\operatorname{ord}_{n}(a^{\ell})

(this is well defined: gcd⁡(a,n)=1{\gcd(a,n)=1} implies that gcd⁡(aℓ,n)=1{\gcd(a^{\ell},n)=1}). We need to prove that r=k/d{r=k/d}. Write ℓ=u⁢d{\ell=ud} and k=v⁢d{k=vd} with integers u≥0{u\geq 0} and v≥1{v\geq 1} (recall that ℓ≥0{\ell\geq 0} and k,d≥1{k,d\geq 1}) so that gcd⁡(u,v)=1{\gcd(u,v)=1} (Corollary 1.1.3.14). Then

(aℓ)v=(au⁢d)k/d=au⁢k=(ak)u.(a^{\ell})^{v}=(a^{ud})^{k/d}=a^{uk}=(a^{k})^{u}.

Since ak≡1(modn){a^{k}\equiv 1\pmod{n}} by definition, Proposition 1.2.1.6(6) implies that

(aℓ)v≡1(modn).(a^{\ell})^{v}\equiv 1\pmod{n}.

By Theorem 1.3.1.5, the order r=ordn⁡(aℓ){r=\operatorname{ord}_{n}(a^{\ell})} divides vv. On the other hand,

aℓ⁢r=(aℓ)r,a^{\ell r}=(a^{\ell})^{r},

and hence

aℓ⁢r≡1(modn).a^{\ell r}\equiv 1\pmod{n}.

Again by Theorem 1.3.1.5, the order ordn⁡(a)=k=v⁢d{\operatorname{ord}_{n}(a)=k=vd} divides ℓ⁢r=u⁢d⁢r{\ell r=udr}. Hence, u⁢d⁢r=t⁢v⁢d{udr=tvd} for some integer tt. Cancelling d>0{d>0} on both sides, we obtain u⁢r=t⁢v{ur=tv} so that vv divides u⁢rur. Since gcd⁡(u,v)=1{\gcd(u,v)=1}, Corollary 1.1.3.18 implies that vv divides rr.

We have shown that r∣v{r\mid v} and v∣r{v\mid r}. Since vv and rr are positive, Proposition 1.1.1.6(8) implies that r=v=k/d{r=v=k/d}. This finishes the proof. ∎

Corollary 1.3.1.11.

Let n>1{n>1} be an integer and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,n)=1{\gcd(a,n)=1}. For an integer ℓ≥0{\ell\geq 0},

ordn⁡(aℓ)=ordn⁡(a)⟺gcd⁡(ordn⁡(a),ℓ)=1.\operatorname{ord}_{n}(a^{\ell})=\operatorname{ord}_{n}(a)\quad% \Longleftrightarrow\quad\gcd(\operatorname{ord}_{n}(a),\ell)=1.
Proof.

Immediate from Theorem 1.3.1.10. ∎