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

I want to prove that for $p \geq 3$, and for $a=(\frac{p-1}{2})!$, if $p \equiv1\pmod 4$, then $a^2\equiv -1 \pmod p$, and if $p \equiv 3\pmod4$, then $a \equiv +/-1 \pmod p$.

For the first part, I used Wilson's theorem which says that for prime $p$, $(p-1)!=-1 \pmod p$. so $a^2=((\frac{p-1}{2})!)^2=(1\cdot2\cdot3\cdot\cdot\cdot(\frac{p-1}{2}))^2$ and since $p-k \equiv -k \pmod p$ we get that $a^2=(1\cdot2\cdot3\cdot\cdot\cdot(\frac{p-1}{2}))(1\cdot2\cdot3\cdot\cdot\cdot(\frac{p-1}{2}))=(1\cdot2\cdot3\cdot\cdot\cdot(\frac{p-1}{2}))((p-1)(p-2)(p-3)\cdot\cdot\cdot(-1)^{(p-1)/2}).$

so since $p \equiv 1\pmod 4$ and using Wilson I get the what I need. Is this correct? How should I prove the second part?

(what is the latex for +/- symbol?)

Thank you.

share|cite|improve this question
You want \pm, I think: $\pm$. Use \mp to get $\mp$. – Dylan Moreland Jul 3 '12 at 21:22
I think that where you write "so" you meant "then". Generally speaking, you want to pair "ifs" with "thens" grammatically. – Arturo Magidin Jul 3 '12 at 22:05
up vote 4 down vote accepted

You got the hard part. To summarize, we have $a^2\equiv (-1)^{(p+1)/2}\pmod{p}$.

If $p$ is of the form $4k+1$, then $(p+1)/2$ is odd, and therefore $a^2\equiv -1\pmod{p}$.

If $p$ is of the form $4k+3$, then $(p+1)/2$ is even, and therefore $a^2\equiv 1\pmod{p}$. It follows that $a\equiv 1\pmod{p}$ or $a\equiv -1\pmod{p}$.

This is because from $p$ divides $a^2-1$, we see that $p$ divides $(a-1)(a+1)$. Therefore either $p$ divides $a-1$, in which case $a\equiv 1\pmod{p}$ or $p$ divides $a+1$, in which case $a\equiv -1\pmod{p}$.

Remark: Note that for example when $p=3$, then $a=1$, so $a\equiv 1\pmod{p}$. It is also the case that when $p=23$, we have $a\equiv 1\pmod{p}$. But, for example, when $p=7$, and when $p=11$, we have $a=\equiv -1\pmod{p}$. So for $p$ of the form $4k+3$, both $a\equiv 1\pmod{p}$ and $a\equiv -1\pmod{p}$ can occur. Whether $a$ in this case is congruent to $1$ or $-1$ turns out to be connected with the solvability of the congruence $x^2\equiv 2\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.