Euler's Criterion/Proof 2

Theorem
Let $$p$$ be an odd prime.

Let $$a \not \equiv 0 \pmod p$$.

Then:

$$ $$

Proof

 * Let $$a$$ be a quadratic non-residue of $$p$$.

Let $$b \in \left\{{1, 2, \ldots, p-1}\right\}$$.

The congruence $$b x \equiv a \pmod p$$ has a unique solution $$b'$$ such that $$b' \in \left\{{1, 2, \ldots, p-1}\right\}$$.

Note that $$b' \ne b$$ otherwise we would have $$b^2 \equiv a \pmod p$$ and $$a$$ would be a quadratic residue of $$p$$. And we'd just said it's not.

It follows that the integers in $$\left\{{1, 2, \ldots, p-1}\right\}$$ fall into $$\frac {p-1} 2$$ pairs $$b, b'$$ such that $$bb' \equiv a \pmod p$$.

Hence:
 * $$\left({p-1}\right)! = 1 \times 2 \times \cdots \times \left({p-1}\right) \equiv a \times a \times \cdots \times a \equiv a^{\frac{p-1}2} \pmod p$$

From Wilson's Theorem, we have $$\left({p-1}\right)! \equiv 1 \pmod p$$.

And so:
 * $$a^{\frac{p-1}2} \equiv -1 \pmod p$$ for any quadratic non-residue of $$p$$.


 * Now let $$a$$ be a quadratic residue of $$p$$.

This time the congruence $$x^2 \equiv a \pmod p$$ has a solution.

By Lagrange's Theorem it has at most $$2$$ solutions.

If $$c$$ is one solution in $$\left\{{1, 2, \ldots, p-1}\right\}$$ then $$p - c$$ is another, since:
 * $$\left({p - c}\right)^2 \equiv \left({- c}\right)^2 \equiv c^2 \equiv a \pmod p$$.

Also $$c \ne p - c$$ as $$p = 2 c$$ is impossible ($$p$$ is an odd prime).

Now, let us remove $$c$$ and $$p - c$$ from $$\left\{{1, 2, \ldots, p-1}\right\}$$.

The remaining integers fall into $$\frac {p - 3} 2$$ pairs $$b, b'$$ such that $$b b' \equiv a \pmod p$$.

So this time:

$$ $$ $$ $$ $$

Substituting $$-1$$ for $$\left({p-1}\right)!$$ (by Wilson's Theorem again) and dividing by $$-1$$, we get:
 * $$a^{\frac{p-1}2} \equiv 1 \pmod p$$ for any quadratic residue $$a$$ of $$p$$.


 * The "only if" part follows:

Suppose that $$a^{\frac{p-1}2} \equiv 1 \pmod p$$.

As $$a \not \equiv 0 \pmod p$$, $$a$$ is either a quadratic residue or a quadratic non-residue.

Suppose $$a$$ is a quadratic non-residue.

Then from above $$a^{\frac{p-1}2} \equiv -1 \pmod p$$.

So we would have $$1 \equiv -1 \pmod p$$ which is false for an odd prime.

So if $$a^{\frac{p-1}2} \equiv 1 \pmod p$$ then $$a$$ is a quadratic residue.

The quadratic non-residue case follows similarly.