Showing that $(p-2)! \equiv 1 \pmod p$

93 Views Asked by At

I wish to show that $(p-2)! \equiv 1 \pmod p$ for a prime $p \ge 3$ using the fact that $(p-1)! \equiv -1 \pmod p$. (Deducing the latter is a later, and more advanced task.)

We have that $(p-1)(p-2)! \equiv -1 \pmod p$. We have that $(p-1) \equiv (p-1)\pmod p$, but this does not help. A weird thought along the lines of "What if I went to the other way around?" popped in my head, I wrote $(p-1) \equiv -1 \pmod p$ and $(-1)(p-2)! \equiv -1 \pmod p \implies (p-2)! \equiv 1 \pmod p$.

Much to my surprise, this was the right answer. I don't understand much of it, so this is a classic example of the right answer for the wrong reasons. If my methods are indeed valid; why do they work? If they are not; how would one normally go about solving this task, and how does one validate each step, basing ones arguments in elementary arithmetic?

2

There are 2 best solutions below

4
On BEST ANSWER

The focus of this answer would be on its explanation rather than its content.

Notice that for all prime (integers, more generally) $p \ge 3$, we have

$$(p - 1)! = (p-1)(p-2)!$$

Now, suppose $(p-1)! \equiv -1 \pmod{p}$. This is the assumption in the question. It is the consideration we have to make. Then, taking both sides modulo $p$, we have

$$-1 \equiv (p-1)(p-2)! \pmod p$$

But $p -1$ gives a remainder of $-1$ when divided by $p$. In other words, $$p-1\equiv -1\pmod p$$

Substituting back, we have:

$$-1\equiv -1\cdot(p-2)!\pmod p$$

Multiplying both sides by $-1$, we have

$$(p-2)! \equiv 1 \pmod p$$

What this says is that

$$(p-1)!\equiv -1 \pmod p \implies (p-2)! \equiv 1 \pmod p$$

for all prime $p \ge 3$.

Now, I believe you would have to prove $p \ge 3$ prime $\implies (p-1)! \equiv -1 \pmod p$, to prove that the above deduction is true for $p \ge 3$ prime.

0
On

For $p > 1$, the modular inverse of $(p - 1)$ is $(p - 1)$. From this, we have \begin{align*} (p-1)! &\equiv_p -1\\ \Rightarrow (p-1)(p-2)! &\equiv_p -1\\ \Rightarrow (p-1)(p-1)(p-2)! &\equiv_p 1-p\\ \Rightarrow (p-2)! &\equiv_p 1 - p \equiv_p 1 \end{align*}