Proof $\displaystyle \binom{p-1}{k}\equiv (-1)^k \mod{p}$

Proof that if $p$ is a prime odd and $k$ is a integer such that $1≤k≤p-1$ , then the binomial coefficient

$$\displaystyle \binom{p-1}{k}\equiv (-1)^k \mod p$$

This exercise was on a test and I could not do!!

Solutions Collecting From Web of "Proof $\displaystyle \binom{p-1}{k}\equiv (-1)^k \mod{p}$"

Let $a=\binom{p-1}{k}$. Then
$$a k!=(p-1)(p-2)(p-3)\cdots (p-k).$$
The $i$-th term on the right-hand side is congruent to $-i$ modulo $p$.
Thus
$$ak!\equiv (-1)^k k!\pmod{p}.$$
Now since $k!$ is not divisible by $p$ we can cancel.

In characteristic $p$, where $p$ is odd,

$$(1+X)^{p-1} = \frac{(1+X)^p}{1+X} = \frac{1+X^p}{1+X} = \frac{1-(-X)^p}{1-(-X)} = 1 -X + X^2 – \dots +X^{p-1}.$$

$$\binom{p-1}k=\frac{(p-1)\cdots(p-k)}{k!}=\prod_{r=1}^k\frac{p-r}r$$

Now $p-r\equiv-r\pmod p\implies\dfrac{p-r}r\equiv-1$

You can prove it by induction on $k$.
If $ k=1$ $\to$ $\displaystyle \binom{p-1}{k} = p-1$ that $p-1 \equiv -1 \mod p$.
For $k= n +1$ use this
$\displaystyle \binom{m}{n+1} =\displaystyle \binom{m}{n} +\displaystyle \binom{m}{n+1}$