If $p$ is a prime, then $(p-1)! \equiv -1 (mod p)$. Hint: $(p-1)!$ is the product of elements in $Z_p$. Match each element to its inverse.

I can understand by testing some primes that for any prime $(p-1)!+1$ is a multiple of that prime, but I'm not sure how to prove it in general or how inverses play into it.

  • 2
    $\begingroup$ What about the hint given to you? "How do inverses play into it" well, inverses cancel each other out, so you need to locate the inverses in the product $(p-1)!$, and see what cancels out, and what does not. Some elements in that product have an inverse in that product. Some, do not. $\endgroup$ Oct 2 '20 at 3:29
  • 4
    $\begingroup$ Look up Wilson's Theorem either via google or in any intro number theory book. [that's the displayed statement] $\endgroup$
    – coffeemath
    Oct 2 '20 at 3:29
  • 1
    $\begingroup$ There are only even number amount of elements in the group, and $a=a^{-1}$ iff $a=\pm1$. $\endgroup$ Oct 2 '20 at 3:31
  • 1
    $\begingroup$ It is Wilson's Theorem and the converse is also true $\endgroup$
    – user824627
    Oct 2 '20 at 3:31
  • 2
    $\begingroup$ i made it too complicated for myself. thank you everyone $\endgroup$
    – d.v.
    Oct 2 '20 at 3:50