TITLE: Proving Wilson's theorem
QUESTION [5 upvotes]: Wilson's theorem: if $p$ is prime then $(p-1)! \equiv -1(mod$ $ p)$
Approach: 
$$(p-1)!=1*2*3*....*p-1$$
My teacher said in class that the gcd of every integer less than p and p is 1, so every integer has a multiplicative inverse $(mod$ $ p)$. He also said that the multiplicative inverses of each integer less than p is in the same set of integers less than p (This idea seems to be right, but does it have to be proven?). the multiplicative inverses of 1 and p-1 are self inverses (Drawing different mod grids, it looks like it's right, but again how is that true?). He concluded the following:
$$1*(p-1)*(a_1a_1^{-1}*.....*a_{{p-3}/2}*{a_{{p-3}/2}}^{-1}) \equiv -1(mod\text{ } p)$$
So he is grouping all the elements with distinct multiplicative inverse. This makes sense because there are p-3 elements with distinct multiplicative inverses and p-3 is even, so we can group them in pairs. How do we know that one multiplicative inverse corresponds to just one number, so we can group them in such an easy way?.

REPLY [2 votes]: One has indeed an equivalence $$p\text{ is prime }\iff(p-1)!\equiv -1\pmod p$$
(1)$\space p\text{ is prime }\Rightarrow(p-1)!\equiv -1\pmod p$
By Fermat's little theorem and because each of $1,2,3,...(p-2),(p-1)$ is coprime with $p$ we have $(p-2)!\equiv((p-2)!)^{ p-1}\equiv 1 \pmod p\Rightarrow (p-1)!\equiv (p-1)\cdot 1\equiv -1\pmod p$.
(2)$\space (p-1)!\equiv -1\pmod p\Rightarrow p\text{ is prime }$.
Suppose $p$ is composed then its (positive) divisors are in $\{1,2,3,...,(p-2),(p-1)\}$. This implies that $\  g.c.d((p-1)!,p)\gt 1$. Now if $\space (p-1)!\equiv -1\pmod p$ then dividing by a (proper) divisor $d$ of $p$ and of $(p-1)!$ the equality 
$(p-1)!=-1+pm$ (equivalent to the congruence) one has $d$ must divide $-1$, absurde.Thus $p$ is not composed.