In my algebraic structures textbook there is a proof for the theorem if $p$ is a prime then $(p-1)!\equiv -1\pmod p\ $.

Proof: Since p is prime, each element $1,2,3...(p-1)$ in $\Bbb Z_p $ has an inverse, hence the pairs of inverses will cancel out leaving only the self-inverse elements 1 and -1 and thus $(p-1)! = 1(-1) = -1 $ in $\Bbb Z_p $.

My question is how is that possible when the elements of $(p-1)! $ are all positive? I must be confusing something...

  • $\begingroup$ Do you know what the symbol $-1$ means in the context of $\mathbb{Z}_p$? It's something about divisibility, not negativity. $\endgroup$ – user296602 Jan 26 '16 at 2:54

"Positive" and "negative" don't make sense as comparisons to zero in $\mathbb{Z}_p$ - after all, if you add $1$ to itself $p$ times you get zero. And if you do it $p - 1$ times, you get something congruent to $-1$ modulo $p$. The statement that $(p - 1)! \equiv -1 \pmod p$ means that

$$p \mid (p - 1)! + 1$$

as a statement about divisors. What the proof is doing is collecting a bunch of pairs that multiply to $1$ modulo $p$ - that is, if you divide the product by $p$ you get a remainder of $1$.


$$(p-1)!\equiv -1\pmod p\ $$ is the same as $$(p-1)!\equiv p-1\pmod p\ $$ In $\pmod p$ negative doesn't mean what it does in your regular everyday arithmetic.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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