Lecture 22 - Order Calculations

Summary

We started the class by introducing the notion of order for a given integer a modulo m, as well as what it meant for a to be a primitive root modulo m. We calculated the order of a few integers, and we began talking about one of the basic arithmetic properties of order including its relationship to $\phi(m)$ as well as how one can predict the order of a power of an integer based on the order of the integer itself. We also discussed primitive roots more deeply, counting the number of primitive roots when they exist.

Order Calculations

We're going to shift topics now, moving out of Chapter 4 and into Chapter 5. Recall from Chapter 2 that for any integer m and integer a satisfying $(a,m) = 1$, we have

(1)
\begin{align} a^{\phi(m)} \equiv 1 \mod{m}. \end{align}

The question we ask now is whether there exists some exponent smaller than $\phi(m)$ which does this same job.

Definition: For an integer m and a number a with $(a,m) = 1$, we define the order of a mod m as

$\displaystyle \mbox{ord}_m(a) = \min_{n>0}\{a^n \equiv 1 \mod{m}\}$.

Example: The order of 4 mod 9

Let's compute $\mbox{ord}_9(4)$. Since $\phi(9) = 6$ we know that $\mbox{ord}_9(4) \leq 6$, but is this actually the order? The only way to know is to try out smaller exponents and see if we ever hit 1:

(2)
\begin{split} 4^1 &\equiv 4 \not\equiv 1 \mod{9}\\ 4^2 &\equiv 16 \equiv 7 \not\equiv 1 \mod{9}\\ 4^3 &\equiv 4\cdot 7 \equiv 28 \equiv 1 \mod{9}. \end{split}

Hence we see that $\mbox{ord}_9(4) = 3$. $\square$

Example: The order of 2 mod 9

Let's try to compute $\mbox{ord}_9(2)$. Again, we know that this order is at most 6 (since $a^{\phi(9)} \equiv 1 \mod{9}$ for any $(a,9) = 1$), but perhaps it's smaller. Let's try out smaller exponents and see if we hit 1 early.

(3)
\begin{split} 2^1 &\equiv 2 \not\equiv 1 \mod{9}\\ 2^2 &\equiv 4 \not\equiv 1 \mod{9}\\ 2^3 &\equiv 8 \not\equiv 1 \mod{9}\\ 2^4 &\equiv 16 \equiv 7 \not\equiv 1 \mod{9}\\ 2^5 &\equiv 2\cdot 2^4 \equiv 2\cdot 7 \equiv 14 \equiv 5 \not\equiv 1\mod{9}\\ 2^6 &\equiv 2\cdot 2^5 \equiv 2\cdot 5 \equiv 10 \equiv 1\mod{9}. \end{split}

Hence we see that $\mbox{ord}_9(2) = 6$. $\square$

The two examples above lead us to distinguish those elements which have the "maximal order" of $\phi(m)$ from the other elements whose order is smaller than $\phi(m)$.

Definition: For an integer m and $(a,m) = 1$, we say that a is a primitive root modulo m if the order of a modulo m is $\phi(m)$.

With this new language, we see that 2 is a primitive root modulo 9 whereas 4 is not.

Example: A Modulus without Primitive Root

Let $m = 8$. Then the reduced residues are $\{1,3,5,7\}$. Notice that $1^1 \equiv 1 \mod{12}$, and that

  • $3^2 \equiv 9 \equiv 1 \mod{8}$
  • $5^2 \equiv 25 \equiv 1 \mod{8}$
  • $7^2 \equiv 49 \equiv 1 \mod{8}$

Hence we have

$a$ $\mbox{ord}_{8}(a)$
1 1
3 2
5 2
7 2

Recall, however, that $\phi(8) = 4$, so you can see that in this case there is no primitive root. $\square$

Having stated this definition and seen examples of moduli which do and do not have primitive roots, the natural question to ask is: which moduli m do have primitive roots, and which do not? We'll eventually answer this question, but first we need to understand more about order.

Some Properties of Order

We finish our discussion today by pointing out one special property of the order of an integer. We'll see more properties related to this next class period.

Lemma: For integers m and a with $(a,m) = 1$, an integer n satisfies $a^n \equiv 1\ mod{m}$ if and only if $\mbox{ord}_m(a) \mid n$.

Notice that we have already seen this lemma in our calculation of $\mbox{ord}_9(4)$. In that case we knew that $4^6 \equiv 1 \mod{9}$ since $\phi(9) = 6$, but we saw that $\mbox{ord}_9(4) = 3$.

Proof: First suppose that $\mbox{ord}_m(a) \mid n$; we'll show that $a^n \equiv 1 \mod{m}$. In this case we know there exists an integer k so that $k\cdot\mbox{ord}_m(a) = n$. Now we'll just compute $a^n$ directly:

(4)
\begin{split} a^n &\equiv a^{k\cdot \mbox{ord}_m(a)} = \left(a^{\mbox{ord}_m(a)}\right)^{k}. \end{split}

Now we know that $a^{\mbox{ord}_m(a)} \equiv 1 \mod{m}$ by definition, and so the right hand side of the equation becomes

(5)
\begin{align} \left(a^{\mbox{ord}_m(a)}\right)^{k} \equiv 1^k \equiv 1. \end{align}

Hence we have shown $\mbox{ord}_m(a) \mid n$ implies $a^n \equiv 1 \mod{m}$

Now suppose that $a^n \equiv 1 \mod{m}$. Write $n = k\cdot \mbox{ord}_m(a) + r$, where r is a remainder term in the range $0 \leq r < \mbox{ord}_m(a)$. Then we have

(6)
\begin{align} 1 \equiv a^n \equiv a^{k\cdot \mbox{ord}_m(a) + r} \equiv a^{k\cdot \mbox{ord}_m(a)} a^r \equiv \left(a^{\mbox{ord}_m(a)}\right)^ka^r \equiv 1^ka^r \equiv a^r. \end{align}

But then r is an exponent which is less than $\mbox{ord}_m(a)$ so that $a^r \equiv 1 \mod{m}$. By the minimality of order, this means that r cannot be positive, and so we must have $r=0$. This in turn tells us that $n = k\cdot \mbox{ord}_m(a)$, so that $\mbox{ord}_m(a) \mid n$.
$\square$

One of the important consequences of this result is the following

Corollary: For integers m and a with $(a,m) = 1$, the order of a mod m is a divisor of $\phi(m)$.

Proof: From the last lemma we know that whenever $a^n \equiv 1 \mod{m}$ then we have $\mbox{ord}_m(a) \mid n$. Since Euler's Theorem tells us that $a^{\phi(m)} \equiv 1 \mod{m}$, this gives us the desired result. $\square$

Example: Calculating an order mod 11

Suppose that you want to calculate $\mbox{ord}_{11}(2)$. Normally we'd need to calculate $2^j \mod{11}$ for all j in the range $1 \leq j \leq 10$, but according to the last corollary we don't need to hit all these j: it's enough to try out those j which are divisors of 10. So let's do it:

(7)
\begin{split} 2^1&\equiv 2 \not\equiv 1 \mod{11}\\ 2^2&\equiv 4 \not\equiv 1 \mod{11}\\ 2^5&\equiv 32 \equiv -1 \mod{11}\\ 2^{10}&\equiv (2^5)^2 \equiv (-1)^2 \equiv 1 \mod{11}. \end{split}

Hence we see that $\ord_9(2) = 10$. $\square$

Example: Calculating an order mod 47

Let's use the same idea to calculate $\mbox{ord}_{47}(2)$. To do this, we need to know that the prime factorization of $\phi(47)$ is $\phi(47) = 2\cdot 23$. Then we only need to check the value of $2^j \mod{47}$ when $j \in \{1,2,23,47\}$.

(8)
\begin{split} 2^1 &\equiv 1 \notequiv 1 \mod{47}\\ 2^2 &\equiv 4 \notequiv 1 \mod{47}\\ 2^{23} &\equiv 2^{16}2^{4}2^{2}2^{1} \equiv 18 \cdot 16 \cdot 4\cdot 2 \equiv 1 \mod{47}. \end{split}

Hence we see that $\mbox{ord}_{47}(2) = 23$. Notice that this means that 2 is not a primitive root for this prime number. $\square$

Primitive Roots as Generators

This is not the only useful corollary to come out of our lemma.

Corollary: For integers m and a with $(a,m) = 1$, then $a^i \equiv a^j \mod{m}$ if and only if $i \equiv j \mod{\mbox{ord}_m(a)}$.

Proof: Suppose first that $i \equiv j \mod{\mbox{ord}_m(a)}$. This tells us that

(9)
\begin{align} i = j+k\cdot \mbox{ord}_{m}(a) \end{align}

for some integer k. Hence we get

(10)
\begin{align} a^i \equiv a^{j+k\cdot \mbox{\tiny{ord}}_m(a)} \equiv a^j \left(a^{\mbox{\tiny{ord}}_m(a)}\right)^k = a^j (1)^k \equiv a^j \mod{m}. \end{align}

On the other hand, suppose that we know $a^i \equiv a^j \mod{m}$. Without loss of generality, assume additionally that $i>j$. Then we have

(11)
\begin{align} a^j a^{i-j} \equiv a^i \equiv a^j \mod{m}. \end{align}

Now since $(a,m) = 1$ we know $(a^j,m) = 1$, and hence we can "cancel" the appearance of $a^j$ from both sides of the above equation to conclude

(12)
\begin{align} a^{i-j} \equiv 1 \mod{m}. \end{align}

But our previous corollary says that this is only possible if $\mbox{ord}_m(a) \mid i-j$, which is what we wanted to prove. $\square$

This lemma doesn't wind up being especially useful for computing the order of a given element, since typically one doesn't have access to two integers i and j so that $a^i \equiv a^j \mod{m}$. It is, however, quite useful from a theoretical standpoint, as we're abou to see.

Lemma: Suppose that a is a primitive root mod m. Then the set $\{a,a^2,\cdots,a^{\phi(m)}\}$ is a complete set of reduced residues mod m.

Recall that a residue r is said to be reduced mod m if $(r,m) = 1$. Hence the content of the above corollary is that for any number n which has $(n,m) =1$ there is some exponent $1 \leq k \leq \phi(m)$ so that

(13)
\begin{align} a^k \equiv n \mod{m}. \end{align}

Proof: Certainly since $(a,m) = 1$ we know that $(a^k,m) =1$ for all $k \geq 1$. Hence we only need to show that if i and j are integers between 1 and $\phi(m)$, then $a^i \not\equiv a^j \mod{m}$. To do this, suppose instead that we had distinct i and j between 1 and $\phi(m)$ such that $a^i \equiv a^j \mod{m}$. According to the previous result, this would imply that $\mbox{ord}_m(a) \mid i-j$. But since $\mbox{ord}_m(a) = \phi(m)$, this means $\phi(m) \mid i-j$. This, however, is impossible because $1 \leq |i-j| \leq \phi(m)-1$. $\square$

This theorem is really quite powerful, because it tells us that if we can get a hold of a primitive root mod m, then we can use this element to express all other reduced residues. This is especially useful in light of the following

Lemma: Suppose that m and a are integers satisfying $(a,m) = 1$. Then we have

$\displaystyle \mbox{ord}_m(a^i) = \frac{\mbox{ord}_m(a)}{(\mbox{ord}_m(a),i)}$

We'll hold off on proving this result for now, instead contenting ourselves with seeing a few examples that it generates.

Example: Computing orders modulo 11

We already know that 2 is a primitive roots mod 11, so let's use this fact to compute the order of other elements mod 11.

$j$ $2^j \mod{11}$ $\mbox{gcd}(\mbox{ord}_{11}(2),j)$ $\mbox{ord}_{11}(2^j)$
1 2 1 10
2 4 2 5
3 8 1 10
4 $2\cdot 8 \equiv 5$ 2 5
5 $2\cdot 5 \equiv 10$ 5 2
6 $2\cdot 10 \equiv 9$ 2 5
7 $2\cdot 9 \equiv 7$ 1 10
8 $2\cdot 7 \equiv 3$ 2 5
9 $2\cdot 3 \equiv 6$ 1 10
10 $2\cdot 6 \equiv 1$ 10 1

Counting Primitive Roots

A nice consequence of the previous result is that we can count primitive roots — at least when they exist.

Corollary: Suppose that a primitive root exists mod m. Then there are $\phi(\phi(m))$ many primitive roots.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License