resource: evan's handout, MONT, etc.

Overview

This is a module about orders, which deals with exponents in NT.

Definition

The order of a(modp)a\pmod p, sometimes written as ordp(a)\text{ord}_p (a), is the smallest positive integer mm such that am≡1(modp)a^m\equiv 1\pmod p.

The idea is quite similar to the logarithm function, but in Number Theory.

Fermat's Little Theorem

First, you may question how do you know this value exists. After all, what if, for all integers mm, am≢1(modp)a^m \not\equiv 1 \pmod p? To do this, we must first show the famous Fermat's Little Theorem.

Fermat's Little Theorem. ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p for all integers aa and primes pp where gcd⁡(a,p)=1\gcd(a,p) = 1.

To prove this, consider two sets A={1,2,…,p−1}A = \{1,2,\ldots, p-1\} and B={a⋅1,a⋅2,…,a⋅(p−1)}B = \{a\cdot 1, a\cdot 2,\ldots, a\cdot (p-1)\}. We will show all elements of BB are distinct.

Consider two elements ϵ1,ϵ2∈A\epsilon_1,\epsilon_2 \in A. For the sake of contradiction, suppose a⋅ϵ1a\cdot \epsilon_1 and a⋅ϵ2a\cdot \epsilon_2 are the same. Then,

a⋅ϵ1−a⋅ϵ2≡a(ϵ1−ϵ2)≡0(modp).a\cdot \epsilon_1 - a\cdot \epsilon_2 \equiv a(\epsilon_1 - \epsilon_2) \equiv 0 \pmod p.

As gcd⁡(a,p)=1\gcd(a,p) = 1, then ϵ1−ϵ2≡0(modp)\epsilon_1 - \epsilon_2 \equiv 0 \pmod p, and so ϵ1≡ϵ2(modp)\epsilon_1 \equiv \epsilon_2 \pmod p. But, 0≤ϵ1,ϵ2≤p−10 \leq \epsilon_1, \epsilon_2 \leq p-1, impossible, unless ϵ1=ϵ2\epsilon_1 = \epsilon_2. Hence, all elements of BB are distinct. Nicely enough, we can multiply the elements of AA and BB, and upon taking the results modulo pp, they must be equal:

∏A≡∏B  ⟹  (p−1)!≡ap−1⋅(p−1)!(modp)  ⟹  (p−1)!⋅(ap−1−1)≡0(modp).\prod_A \equiv \prod_B \implies (p-1)! \equiv a^{p-1} \cdot (p-1)! \pmod p \implies (p-1)! \cdot \left(a^{p-1}-1\right) \equiv 0 \pmod p.

Note that pp is relatively prime to all elements of AA, and so gcd⁡(p,(p−1)!)=1\gcd(p, (p-1)!) = 1. So, ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p, as desired. ■\blacksquare

With that conclusion, it is safe to conclude there exists an integer mm such that am≡1(modp)a^m \equiv 1 \pmod p.

Power of Orders

The power of orders is its minimality. To be more precise:

Theorem 1. If kk is a nonnegative integer such that ak≡1(modp)a^k\equiv 1\pmod p, then ordp(a)∣k\text{ord}_p(a) \mid k.

Write m=ordp(a)m = ord_p(a). To prove this, note that due to Divison Algorithm, we can write k=mq+rk = mq+r for integers mm, qq, and rr where $0 \leq r < m. Notice,

ak≡1(modp)  ⟹  (am)q⋅ar≡1(modp)  ⟹  ar≡1(modp).a^k\equiv 1\pmod p \implies \left(a^{m}\right)^q\cdot a^r \equiv 1 \pmod p \implies a^r \equiv 1 \pmod p.

But, if 0<r<m0 < r < m then we contradict the minimality of order. So, r=0r = 0 and so m∣km \mid k, as desired. ■\blacksquare

In conjunction with Fermat's Little Theorem, it is clear that ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p, and so ordp(a)∣(p−1)\text{ord}_p(a) \mid (p-1).

Primitive Roots

The converse also holds for a prime: there exists an integer aa such that ordp(a)=p−1\text{ord}_p (a)=p-1. In particular, the sequence

a1(modp),  a2(modp) , …  , ap−1(modp)a^1 \pmod p, \ \ a^2 \pmod p\ , \ \ldots\ \ , \ a^{p-1} \pmod p

cycles through all elements from 11 to p−1p-1.

For example, 22 is a primitive root modulo 33 as 21≡2(mod3)2^1 \equiv 2 \pmod 3 and 22≡1(mod3)2^2 \equiv 1 \pmod 3, and so ord3(2)=2\text{ord}_3(2) = 2. To sum, primitive roots always exist for a prime pp, oftenly denoted by gg. However, to our surprise, we do not know how to determine the exact value of gg.

I will leave it to you to check that 22 is a primitive root modulo 1111 and 1313.

Warm-Up Examples

Example 1: Product of Primitive Roots (worth remembering!)

Your goal is to prove that the product of all primitive roots mod an odd prime pp is congruent to 1(modp)1 \pmod p.

Pair each primitive root gkg^k with gp−1−kg^{p-1-k} since gcd⁡(k,p−1)=1  ⟺  gcd⁡(p−1−k,p−1)=1\gcd(k, p-1) = 1 \iff \gcd(p-1-k, p-1) = 1. The product of each pair is gk+(p−1−k)=gp−1≡1(modp)g^{k + (p-1-k)} = g^{p-1} \equiv 1 \pmod p. Since ϕ(p−1)>1\phi(p-1) > 1, we pair them into distinct terms, giving a total product of 1(modp)1 \pmod p.

Example 2: Primitive Roots + Euler's Criterion

Your job is to find all primes p≡1(mod4)p \equiv 1 \pmod 4 such that 22 is a primitive root modulo pp, and also pp divides 2(p−1)/2+12^{(p-1)/2} + 1.

Realize that since 22 is a primitive root, its order is p−1p-1. This satisfies the condition 2(p−1)/2≡−1(modp)2^{(p-1)/2} \equiv -1 \pmod p. Via Euler's criterion, we get: p≡5(mod8)p \equiv 5 \pmod 8.

Example 3: Interesting Property (also worth remembering!)

Let nn be a positive integer such that the order of 22 modulo nn is n−1n-1. Your goal is to prove that nn must be a prime number.

By ETT, we know that 2ϕ(n)≡1(modn)2^{\phi(n)} \equiv 1 \pmod n, and so the order n−1n-1 must divide ϕ(n)\phi(n). Now, because ϕ(n)≤n−1\phi(n) \le n-1 always holds, we must have ϕ(n)=n−1\phi(n) = n-1. This holds if and only if nn is prime (why?).

Example 4: Skibidi Characterization of primitive roots

Let pp be an odd prime. Your goal is to prove that gg is a primitive root mod pp if and only if g(p−1)/q≢1(modp)g^{(p-1)/q} \not\equiv 1 \pmod p for all prime divisors qq of p−1p-1.

Firstly, you can assume the order dd is less than p−1p-1. Then the quotient p−1d>1\frac{p-1}{d} > 1 must have some prime factor qq. This means that dd divides p−1q\frac{p-1}{q}, which would force g(p−1)/q≡1(modp)g^{(p-1)/q} \equiv 1 \pmod p. However, this contradicts the problem statement, meaning the order must equal p−1p-1.

Example 5: Product of Quadratic Residues (also also worth remembering!)

Let p≡3(mod4)p \equiv 3 \pmod 4 be a prime greater than 3. Your job is to prove that the product of all quadratic residues modulo pp is congruent to 1(modp)1 \pmod p.

We can represent all the quadratic residues as the even powers of a primitive root: g2,g4,…,gp−1g^2, g^4, \dots, g^{p-1}. The sum of these exponents simplifies to p−12⋅p+12\frac{p-1}{2} \cdot \frac{p+1}{2}. Now, because p≡3(mod4)p \equiv 3 \pmod 4, p+12\frac{p+1}{2} is an even integer, which means the sum is a multiple of p−1p-1 and the final product ≡1(modp)\equiv 1 \pmod p.

Example 6: Fun Problem

Let pp be an odd prime. Your job is to prove that a primitive root gg modulo pp is also a primitive root modulo p2p^2 if and only if gp−1≢1(modp2)g^{p-1} \not\equiv 1 \pmod {p^2}.

First observe that the order dd modulo p2p^2 must divide ϕ(p2)=p(p−1)\phi(p^2) = p(p-1) and also satisfy gd≡1(modp)g^d \equiv 1 \pmod p, meaning (p−1)∣d(p-1) \mid d. This means the possible values ared=p−1d = p-1 or d=p(p−1)d = p(p-1). Since gp−1≢1(modp2)g^{p-1} \not\equiv 1 \pmod {p^2}, the order cannot be p−1p-1, leaving p(p−1)=ϕ(p2)p(p-1) = \phi(p^2).

Module Progress:

Join the Discord Community!

Stuck on a problem, or don't understand a module? Join the Discord and get help with your doubts while making more math friends.