# Let $p$ be an odd prime. Prove that if $a\equiv b\pmod{p}$, then $a^p\equiv b^p\pmod{p^2}$

Let $p$ be an odd prime. Prove that if $a\equiv b\pmod{p}$, then $a^p\equiv b^p\pmod{p^2}$

I know how to prove this if we are given $a^p$ is congruent to $a$ mod p, but not when we start with this.

$(a-b)^p = a^p-b^p+pa^{p-1}b-pb^{p-1}a+\cdots + \dbinom{p}k \left(a^{p-k}b^k-b^{p-k}a^k \right)$
Now $p$ divides of the the binomial coefficients besides the first. Then $a^{p-k}b^k-b^{p-k}a^k \equiv 0 \pmod p$ since $a^{n} \equiv b^n \pmod p$ for any $n$.
Now $(a-b)^p \equiv 0 \pmod{p^2}$ sicne $p > 2$. Then $0 \equiv a^p-b^p \pmod {p^2}$ and the result follows.
Let $b = a + kp$. Then $b^p = ( a + kp)^p$. Expand using the binomial theorem, to get
$$a^p + {p \choose 1} a^{p-1} kp + {p\choose 2} a^{p-2} (kp)^2+ \ldots + (kp)^p$$
Every term except $a^p$ is a multiple of $p^2$. Thus $b^p \equiv a^p \pmod{p^2}$.