Prove that if x≡x1(modm) is a solution to (1), then by (a,m)=1 we know (x1,m)=1. Therefore, by Theorem 5 in §2, there must be a y1 such that
x1≡gy1(modm)
Thus, we have
gny1≡a(modm)
Furthermore, by Property I in §3, we have
ny1≡γ(a)(modφ(m))
This shows that y≡y1(modφ(m)) is a solution to the linear congruence
ny≡γ(a)(modφ(m))
Conversely, if y≡y1(modφ(m)) is a solution to (5), then by Property I in §3, we can also deduce that equation (4) holds. Therefore, when x1 is given by equation (3), x≡x1(modm) must be a solution to (1). This proves that the congruence equation (1) ((a,m)=1) and the congruence equation (5) have solutions simultaneously or not. Moreover, for any
x2≡gy2(modm)
By Property IV in §1 (taking a=g), we know that x1≡x2(modm) if and only if
y1≡y2(modφ(m))
Therefore, when the congruence equation (1) ((a,m)=1) has solutions, it has the same number of solutions as the congruence equation (5). By Theorem 2 in Chapter 4, §2, the necessary and sufficient condition for (5) to have solutions is that equation (2) holds. When it has solutions, there are exactly (n,φ(m)) solutions. This, together with the previous discussion, proves the theorem.
Theorem 1 provides a method for solving equation (1) ((a,m)=1) when the modulus m has a primitive root: (i) use the index table to find the index γ(a) of a; (ii) solve the congruence equation (5); (iii) if (5) has solutions, then for each solution y1(modφ(m)), use the index table to find x1 satisfying equation (3). The resulting x1(modm) are all the solutions to (1).