Show that the congruence $x^{p-1} \equiv 1 \pmod {p^2}$ has precisely $p-1$ solutions modulo $p^2$ Let $p$ be a prime number. Show that the congruence $x^{p-1} \equiv 1 \pmod {p^2}$ has precisely $p-1$ solutions modulo $p^2$
I know the statment above is true for modulo $p$, but how is this imply to modulo $p^2$
 A: The unit group $\bmod{p^2}$ is cyclic, i.e. generated by a primitive root $g$, which has order $\phi(p^2) = p(p-1)$. Units $x$ fulfilling $x^{p-1} = 1$ are precisely those with order dividing $p-1$, these have to be of the form $g^{kp}$.
Set $x_k = g^{kp}$. Then $x_j\neq x_k$ if and only if $j\neq k \pmod{p-1}$, so there are precisely $p-1$ distinct solutions that are units. What remains is to exclude non-units, that is, showing that $p$ cannot divide $x$, which is easy since $x^{p-1}$ would be divisible by $p$ otherwise, wheras $1$ is not.
A: For $4$ check directly. For $p>2$, by Hensel's lemma, more results modulo $p^2$ would have more results modulo $p^n$ for $n>2$ which would produce more results in $\Bbb Q_p$. But $\Bbb Q_p$ is a field so $\Bbb Q_p[x]$ is a UFD, hence there are only $p-1$ $(p-1)^{st}$ roots of unity in $\overline{\Bbb Q_p}$, so it is impossible for there to be more than $p-1$ solutions mod $p^2$.
A: One can do this by direct calculation: take any $a \not \equiv 0 \pmod p$ and compare $(a+p)^{p-1}$ to $a^{p-1}$ mod $p^2$ by binomial expansion: you'll see that the residue of $a^{p-1}$ mod $p^2$ shifts by a predictable amount every time you add $p$ to it.  This makes it easy to see that the set $\{(a + kp)^{p-1} : 0 \le k < p\}$ cycles uniquely through all possible residues mod $p^2$ that are $1$ mod $p$.
A: A more elaborated version will be ... from Euler's th. $y^{p(p-1)} \equiv 1 \pmod{p^2}$, where $\gcd(y,p^2)=1$. $\gcd(y,p^2)=1 \Leftrightarrow \gcd(y,p)=1$. So $y^{p(p-1)} \equiv 1 \pmod{p^2}$, where $\gcd(y,p)=1$.
This works for any $y \in \{1, 2, 3, ..., p-1\}$. By noting $x=y^{p}$ we have $x \in \{1,2^p,3^p,...,(p-1)^p \}$ and all these are different $\pmod{p^2}$, otherwise if we assume $i^p \equiv j^p \pmod{p^2}$ for $i\neq j$, then $i^p \equiv j^p \pmod{p}$ too, which is wrong of course because $i^p \equiv i \pmod{p}$ (this is Fermat's little th. by the way) and $j^p \equiv j \pmod{p}$ respectively, which would mean $i \equiv j \pmod{p}$ - contradiction. So we found $p-1$ solutions at least.
Any other solution $x_{0}^{p-1} \equiv 1 \pmod{p^2}$ is $x_{0}^{p} \equiv x_{0} \pmod{p^2}$. Writing $x_0=qp+r$, $0<r<p$ reveals $(qp+r)^{p} \equiv x_{0} \pmod{p^2}$ or (binomial expantion) $(pq)^p + ... + \binom{p}{1}\cdot qp\cdot r^{p-1} +r^p \equiv x_{0} \pmod{p^2}$ or $r^p \equiv x_{0} \pmod{p^2}$. Which means exactly $p-1$ modulo $p^2$.
