# Prove $g$ is a generator if $g^q=1 \pmod p$

Let $$p$$ be an odd prime and let $$q=\frac{p-1}{2}$$. If $$g^q=-1\pmod p$$ and $$q$$ is a prime, show that $$g$$ is a primitive root mod $$p$$.

I want to show $$\{g,g^1,...,g^{p-1}\}=\{1,2,...p-1\}$$. I argue by contradiction that if there're $$x,y\in \{1,2,...p-1\},x. Then $$g^{y-x}=1\pmod p$$. I don't know how to use the fact that $$q$$ is prime to lead to a contradiction.

Hint

If ord$$_pg=d,d$$ must divide $$\phi(p)=2q$$

So, $$d\in[1,2,q,2q]$$

If $$d=1,g^q\equiv1^q\not\equiv-1\pmod p$$

So, $$d=2$$ or $$d=2q=p-1$$ or $$d=q$$

• Ahhh, this makes a lot of sense. The original question says that $g$ is a primitive root unless $g=1\pmod p$ or $g=-1\pmod p$ or $g^q=1\pmod p$. Now I know how these exceptions naturally arise. – Fluffy Skye Apr 16 at 7:13
• Is there anyway to go down with my method though? – Fluffy Skye Apr 16 at 7:14
• @FluffySkye The way to continue from your menthod is to used the order of $g$, i.e. the least $n$ such that $\,g^{\large n}\equiv 1\pmod{p}.\$ I explain this method carefully and rigorously in my answer. – Bill Dubuque Apr 16 at 17:19

By definition, $$\,g\,$$ is a primitive root $$\bmod p=2q+1\!\iff\! g\,$$ has order $$\,p-1 = 2q,\,$$ which, by the Theorem below, is true $$\!\iff\! a := g\not\equiv -1\pmod{p}$$

Theorem  Let $$\,q\,$$ be a prime, and $$\,a\in \rm Z,\,$$ a domain where $$\,2\neq 0\,$$ (e.g. $$\,{\rm Z} = \Bbb Z_p,\,$$ prime $$\,p>2).$$

$${\rm if}\ \ a^{\large q}= -1\ \ \ {\rm then}\ \ \ a\ \ {\rm has\ order}\ \ 2q\iff a\neq -1\qquad$$

Proof $$\,\ a^{\large 2q}\! = (a^{\large q})^{\large 2}\!=1,\,$$ so, by the Order Test, $$\,a\,$$ has order $$\,2q\iff a^{\large 2}\neq 1,\,$$ and $$\,a^{\large q}\neq 1,\,$$ since $$\,2,q\,$$ are the only prime divisors of $$\,2q\,$$ (by unique factorization). Both inequalites are true:

• $$a^{\large q} = 1 \,\Rightarrow\, 1 = a^{\large q} = -1\,\Rightarrow\, 2=0,\,$$ contra hypothesis. In particular: $$\,\ \color{#c00}{a\neq 1}$$
• $$a^{\large 2} = 1\,\Rightarrow\,\underbrace{(a\!-\!1)(a\!+\!1) = 0\,\Rightarrow\,a = \pm1}_{{\rm\large by\ \ Z\ \ a\ \ domain}}.\,$$ By hypothesis $$\,a\neq -1\,$$ so $$\,\color{#c00}{a = 1}\Rightarrow\!\Leftarrow$$
• Thanks! So the key lies in order test! – Fluffy Skye Apr 16 at 18:15
• @FluffySkye Yes, in general the Order Test is very useful for these types of problems. Here in the simple case of a product of two primes one could use an ad-hoc argument (probably what l.b. intends), but it is better to know the general argument since it is not much longer and much more widely applicable. And you should be sure to master the notion of "order" since it is the key idea in many results in number theory (which will be clarified if you study group theory) – Bill Dubuque Apr 16 at 18:24