Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Characteristics: The fields where $ p \equiv 1 \pmod{4}$ has half the number from 1 to $\frac{p-1}{2}$ both in positive and the negative. There can be paired up such that when multiplied together, they equal $ -(p-1) \equiv +1 \pmod p$. Only one pair equals -1 and that is $\pm 1$.

Why does that happen?

share|cite|improve this question
up vote 5 down vote accepted

If we start from Wilson's theorem, $(p-1)! \equiv -1 \pmod{p}$ for a prime $p$, then we can write

$$\begin{align} -1 &\equiv (p-1)! = \prod_{k=1}^{\frac{p-1}{2}} k \cdot \prod_{m = 1}^{\frac{p-1}{2}} (p-m)\\ &\equiv \left(\frac{p-1}{2}\right)! \cdot (-1)^{\frac{p-1}{2}}\prod_{m = 1}^{\frac{p-1}{2}} (m-p)\\ &\equiv (-1)^{\frac{p-1}{2}} \left(\left(\frac{p-1}{2}\right)!\right)^2 \end{align}$$

for odd primes $p$. Now if $p \equiv 1 \pmod{4}$, the factor $(-1)^{\frac{p-1}{2}}$ is $1$, hence

$$\left(\left(\frac{p-1}{2}\right)!\right)^2 \equiv -1 \pmod{p}$$


It is Wilson's theorem that follows from pairing up each $1 < k < p-1$ with its inverse, leaving $(p-1)! \equiv 1\cdot(p-1) \equiv -1 \pmod{p}$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.