Lecture 26 - Index Arithmetic

# Summary

Today we covered the final topic of Chapter 5, and we spent the bulk of the day discussing the idea of index relatively to a given primitive root mod m. The index is akin to the logarithm functions you have seen in your pre-number theory years, and it obeys many of the same rules. We'll use index arithmetic to determine when a given number a is an nth power residue mod m — at least when m has a primitive root.

# Defining the Index Function

We have already discussed at length what it means for a residue r to be a primitive root mod m, and we've seen some important properties that primitive roots have. For instance, we've said that when r is a primitive root mod m, then the set

(1)
\begin{align} \{r,r^2,\cdots, r^{\phi(m)}\} \end{align}

gives a complete reduced residue system mod m, meaning that for every number a which satisfies $(a,m) = 1$ there is a unique $1 \leq j \leq \phi(m)$ so that $r^j \equiv a \mod{m}$. It is this exponent that we'd like to focus on today.

Definition: Suppose that r is a primitive root mod m and that a is given so that $(a,m)=1$. Then the index of a relatively to r, written $\mbox{ind}_r(a)$, is the number between 0 and $\phi(m)-1$ which satisfies

$r^{\mbox{\tiny{ind}}_r(a)} \equiv a \mod{m}$.

Notice that the index function is the number-theoretic analogue of a logarithm function: just as $\mbox{log}_{10}(1000)$ asks for the number to which you raise 10 in order to get 1000, the index function asks for the exponent to which you raise r in order to get a.

Also notice that since all the elements $r^1,r^2,\cdots,r^{\phi(m)}$ are distinct modulo m, if you can find any exponent e so that $r^e \equiv a \mod{m}$, then you'll be able to conclude

(2)
\begin{align} \ind_r(a) \equiv e \mod{\phi(m)}. \end{align}

#### Example: Indices mod 17

In class on Monday we saw that 3 is a primitive root modulo 17. Let's compute some indices relative to 3.

(3)
\begin{split} 3^1 \equiv 1 \mod{17} &\mbox{ implies that }\mbox{ind}_3(3) = 1\\ 3^2 \equiv 9 \mod{17} &\mbox{ implies that }\mbox{ind}_3(9) = 2\\ 3^3 \equiv 27 \equiv 10 \mod{17} &\mbox{ implies that }\mbox{ind}_3(10) = 3\\ 3^4 \equiv 30 \equiv 13 \mod{17} &\mbox{ implies that }\mbox{ind}_3(13) = 4. \end{split}

We also know that the inverse of 3 is given by $3^{\phi(17)-1} = 3^{16}$, and since it's easy to see that 6 is the inverse of 3 mod 17, we get $\mbox{ind}_3(6) = 16$.

Now of course 3 isn't the only primitive root mod 17: there are $\phi(\phi(17)) = 8$ such primitive roots. For instance, since $5^8 \equiv 16 \mod{17}$, we know that 5 is a primitive root mod 17 (why do we only have to do this one calculation to verify that 5 is a primitive root? Here's a hint: $8 = \frac{17-1}{2}$). Hence we can also speak of indices relative to 5 (instead of relative to 3). In this case we see that

(4)
\begin{split} 5^1 \equiv 1 \mod{17} &\mbox{ implies that }\mbox{ind}_5(5) =1\\ 5^2 \equiv 25 \equiv 8 \mod{17} &\mbox{ implies that }\mbox{ind}_5(8) =2\\ 5^3 \equiv 40 \equiv 6 \mod{17} &\mbox{ implies that }\mbox{ind}_5(6) = 3. \end{split}

Notice that the index of 6 relative to 3 is different from the index of 6 relative to 5. Just as with logarithms, the base matters!
$\square$

## Some Properties of Index

There are a few handy properties that this index function have, and many of them are similar to those found in logarithm functions. Here's a summary of the ones that will be especially useful to us:

Lemma: For a primitive root r mod m, and for numbers a,b that are relatively prime to m,

• $\mbox{ind}_r(r) = 1$
• $\mbox{ind}_r(1) = \phi(m)$
• $\mbox{ind}_r(ab) \equiv \mbox{ind}_r(a)+\mbox{ind}_r(b) \mod{\phi(m)}$
• $\mbox{ind}_r(a^n) \equiv n\cdot \mbox{ind}_r(a) \mod{\phi(m)}$

Proof: The first two are easy: that $r^1 = r$ implies that $\mbox{ind}_r(r) = 1$, and since we know $r^{\phi(m)} \equiv 1 \mod{m}$ by Euler's Theorem, we have $\mbox{ind}_r(1) = \phi(m)$. So let's focus on the second two. We start by calculating

(5)
\begin{align} (r)^{\mbox{\tiny{ind}}_r(a)+\mbox{\tiny{ind}}_r(a)} = r^{\mbox{\tiny{ind}}_r(a)}\cdot r^{\mbox{\tiny{ind}}_r(b)} \equiv a \cdot b \mod{m}. \end{align}

The last equality comes from the definition of the indices of a and b relative to r. But this means that $\mbox{ind}_r(a) + \mbox{ind}_r(b)$ is an exponent to which you raise r in order to get back ab. Since $\mbox{ind}_r(ab)$ is another such exponent, we know that

(6)
\begin{align} \mbox{ind}_r(ab) \equiv \mbox{ind}_r(a)+\mbox{ind}_r(b) \mod{\phi(m)}. \end{align}

The proof of the last congruence is similar: since

(7)
\begin{align} (r)^{n\mbox{\tiny{ind}}_r(a)} \equiv \left(r^{\mbox{\tiny{ind}}_r(a)}\right)^n \equiv a^n \mod{m} \end{align}

we know that $n\mbox{ind}_r(a)$ is a power to which you raise r in order to get back an. But $\mbox{ind}_r(a^n)$ is another such exponent, and so we must have

(8)
\begin{align} \mbox{ind}_r(a^n) \equiv n\cdot \mbox{ind}_r(a) \mod{\phi(m)}. \end{align}

#### Example: More Indices mod 17

Using our already computed indicies mod 17, we can now solve for a few more. For instance, since $10^2 \equiv 100 \equiv 15 \mod{17}$, we know that $\mbox{ind}_3(15) \equiv \mbox{ind}_3(10^2) \equiv 2 \mbox{ind}_3(10) \equiv 6 \mod{16}$. But since we know $\mbox{ind}_3(15) \equiv \mbox{ind}_3(3)+\mbox{ind}_3(5)$, we get $\mbox{ind}_3(5) \equiv 6-1 \equiv 5 \mod{16}$. We can then use this result to prove that $\mbox{ind}_3(8) \equiv \mbox{ind}_3(25) \equiv 2 \mbox{ind}_3(5) \equiv 10 \mod{16}$.

# Using Indices to Detect Higher Order Residues

We spent a lot of time talking about quadratic residues, but not much time talking about residues of higher order. Now that we have indices, though, we can solve these problems fairly easily — at least when primitive roots exist.

#### Example: Solving a Cubic Residue Problem

Suppose that you'd like to solve the equation $15x^3 \equiv 13 \mod{17}$. We haven't done lots of problems like this before, so it might seem intimidating. However, notice that

(9)
\begin{split} 15x^3 \equiv 13 \mod{17} &\Leftrightarrow \mbox{ind}_3(15x^3) \equiv \mbox{ind}_3(13) \mod{16} \\&\Leftrightarrow \mbox{ind}_3(15)+3\mbox{ind}_3(x) \equiv \mbox{ind}_3(13) \mod{16}. \end{split}

Hence we can solve this problem by solving the linear congruence equation in the "variable" $\mbox{ind}_3(x)$. Let's try to do it. First, our work above shows that $\mbox{ind}_3(15) \equiv 6 \mod{16}$ and that $\mbox{ind}_3(13) \equiv 4 \mod{16}$. Hence our linear congruence is the same as the congruence

(10)
\begin{align} 3\mbox{ind}_3(x) \equiv -2 \mod{16}. \end{align}

Now this equation has a solution if and only if $(3,16) \mid -1$; since $(3,16) = 1$ this divisibility condition is met, and so we know we get exactly 1 solution. Our "usual" techniques for solving linear congruences tells us that $\mbox{ind}_3(x) = 10$.

In turn this tells us that $x = 3^{10} \mod{17}$ is the unique solution to our original equation. $\square$

#### Example: Solving a Quartic Residue Problem

We can use a similar line of attack to solve the equation

(11)
\begin{align} 8x^4 \equiv 1 \mod{17}. \end{align}

For fun, this time we'll use 5 as our primitive root. Doing so transforms the equation above into the linear equation

(12)
\begin{align} \mbox{ind}_5(8)+4\mbox{ind}_5(x) \equiv 0 \mod{16}. \end{align}

Since $\mbox{ind}_5(8) \equiv 2 \mod{16}$, our equation becomes

(13)
\begin{align} 4\mbox{ind}_5(x) \equiv -2 \mod{16}. \end{align}

Now this equation has solutions if and only if $(4,16) \mid -2$, which clearly fails. Since our linear equation in the variable $\mbox{ind}_5(x)$ has no solution, neither does our initial equation $8x^4 \equiv 1 \mod{17}$. $\square$

# Characterizing Higher Order Residues

These problems show us that index arithmetic can be used to solve higher degree equations, provided that there aren't terms besides the leading term and the constant term. The ideas we just used can be put together in a way to classify precisely those a and n for which the equation

(14)
\begin{align} x^n \equiv a \mod{m} \end{align}

have a solution — again, at least when we assume that m has a primitive root.

Theorem: Let integers a,m and n be given so that $(a,m) = 1$ and so that a primitive root mod m exists. Write $d = (n,\phi(m))$. Then the equation

$x^n \equiv a \mod{m}$

has a solution if and only if

$a^{\frac{\phi(m)}{d}} \equiv 1 \mod{m}$.

When this congruence holds, then there are precisely d solutions to the initial equation.

Proof: Suppose first that $x^n \equiv a \mod{m}$ has a solution, and let's call that solution x. Then we have

(15)
\begin{align} a^{\frac{\phi(m)}{d}} \equiv (x^n)^{\frac{\phi(m)}{d}} \equiv (x^{\phi(m)})^{\frac{n}{d}} \equiv 1^{\frac{n}{d}} \equiv 1 \mod{m}. \end{align}

To prove the other direction, suppose that $a^{\frac{\phi(m)}{d}} \equiv 1 \mod{m}$. Now let $b = \ind_r(a)$, and the previous equation becomes

(16)
\begin{align} (r^b)^{\frac{\phi(m)}{d}} \equiv r^{\frac{\phi(m)b}{d} \equiv 1 \mod{m}. \end{align}

Since $\frac{\phi(m)b}{d}$ is an exponent which takes r to 1, we know that $\phi(m) \mid \frac{\phi(m)b}{d}$. But this can hold if and only if $\frac{b}{d} \in \mathbb{Z}$, and so we have $d \mid b$. It therefore follows that

(17)
\begin{align} n \mbox{ind}_r(x) \equiv b \mod{\phi(m)} \end{align}

has exactly d solutions. Each such solution gives rise to our initial equation $x^n \equiv a \mod{m}$, and so we have proven the result. $\square$

An immediate consequence is the following

Corollary: If a primitive root exists mod m and $(n,\phi(m)) = 1$, then every reduced residue mod m is the nth power of some unique residue mod m.

Proof: For a given reduced residue a, the previous theorem says that there is exactly one solution to $x^n \equiv a \mod{m}$. $\square$

#### Example: Answering Higher Order Residue Questions

Suppose that you want to know if 3 is a 5th power mod 11. To answer this question, the previous theorem says that we only need to calculate

(18)
\begin{align} 3^{\frac{\phi(11)}{5}} \equiv 3^2 \mod{11}. \end{align}

Since $3^2 \not\equiv 1 \mod{11}$, we know that 3 is not the 5th power of any element mod 11.

Suppose that we want to know if 5 is a 3rd power mod 11. Since $(3,\phi(11)) = 1$, the previous corollary says that there is a unique solution to $x^3 \equiv 5 \mod{11}$. $\square$