How do you prove set with modulo? Given any prime $p$. Prove that $(p-1)! \equiv -1 \pmod p$.
How to prove this?

Consider the set of residues $\{1, 2, 3, \cdots , p-1\}$, and consider an arbitrary element $\alpha$. 
Lemma 1: There exist $\gamma$ such that $\alpha \gamma \equiv 1 \pmod p$
Proof: Consider $$1, p+1, 2p+1, 3p+1, \cdots , (\alpha-1)p + 1$$ If two are equivalent modulo $\alpha$, we would have $\alpha|\beta p$ with $\beta$ the difference between two integers among $0, 1, \cdots , \alpha - 1$. Since $\alpha < p$, $\gcd(\alpha, p) = 1$, so we must have $\alpha | \beta$, impossible because $\beta < \alpha$. Therefore, all are distinct modulo $\alpha$. Since there are $\alpha$ numbers, one must be divisible by $\alpha$. We have $\alpha | \delta p + 1$. Take $\gamma = \dfrac{\delta p + 1}{\alpha}$, and we have $\alpha \gamma \equiv 1 \pmod{p}$ as desired.
Lemma 2: There exists exactly one $\gamma$ between $1$ and $p-1$ such that $\alpha \gamma \equiv 1 \pmod p$
Proof: We know there exists at least one. Suppose $x$ and $y$ satisfied $x\alpha \equiv 1 \pmod{p}$ and $y\alpha \equiv 1 \pmod{p}$, with both between $1$ and $p-1$. Therefore, we would have $(x-y)\alpha \equiv 0 \pmod{p}$. Since $\alpha$ is less than $p$, we have $x \equiv y \pmod{p}$, impossible given that $x,y \in [1, p-1]$.
Remark: We denote this $\gamma$ as $\alpha^{-1}$ or the inverse of $\alpha$
Main Proof
If $\alpha = \alpha^{-1}$, we have $\alpha^2 \equiv 1 \pmod p$ or $(\alpha + 1)(\alpha - 1) \equiv 0 \pmod{p}$. Therefore, at least one must be divisible by $p$, so $\alpha \equiv \pm 1 \pmod{p}$. All other values of $\alpha$ have inverses not equal to themselves.
When calculating $(p-1)! = \displaystyle\prod_{i=1}^{p-1} i$, pair each residue other than $1$ and $p-1$ with their inverses. By definition, they cancel to result in $1$. We are left with $$ (p-1)! \equiv 1 \cdot (p-1) \equiv 1 \cdot (-1) = -1 \pmod{p}$$ which is our result
Remark: this is called Wilson's Theorem.
