# Wilson's Theorem Question

Show that $(p-1)!\equiv 2p-p^2$ with Wilson's Theorem.

Wilson's theorem states that $(p-1)!\equiv -1\pmod p$.

I tried working off of that to get $(p-1)!\equiv -1\pmod p$

$\Rightarrow (p-1)!\equiv -1+p\pmod p$

$\Rightarrow (p)!\equiv -p+p^2\pmod p$

$\Rightarrow -(p)!\equiv p-p^2\pmod p$

$\Rightarrow -(p)!\equiv 2p-p^2\pmod p$

I don't know how to get my right side back to its original state though.

• The first line doesn't make sense, modulo what? The second and third equation are exactly equal, I don't understand what you are doing. Can you clarify your question? Oct 22, 2013 at 2:56
• In your first line, what mod are we working? It's not true that $(p-1)! \equiv 2p - p^2 \pmod p$, for instance. Secondly, to get from your second to your third line in your work, you multiply by $p$, which is the same as multiplying by $0$ here. This is why all the work below is equivalent to $0 = 0$. Oct 22, 2013 at 2:56
• Dont worry, you can post the original question and answer yourself. It is way better than leaving a post like this. Oct 22, 2013 at 3:00

We assume that the condition is verified, ie, $\left(p-1\right) !\; =\; 2p-{p}^{2}$ is true. Then, if $p>1$ is prime, we have $(p-1)! \equiv -1\bmod (p)$ for Wilson's theorem. Let there is some $k \in \mathbb{Z}$ such that
$$2p-{p}^{2} \equiv -1\bmod (p)$$ $$2p-{p}^{2}+1=kp\qquad$$ $$\frac{2p-{p}^{2}+1}{p}=k$$ $$2-p+\frac{1}{p}=k$$
but $\frac{1}{p}\, \notin \mathbb{Z}$, it's a contradic, because, the first term must be integer