# Number of solutions of the congruence $x^p \equiv x\pmod p$

How do I show that $x^p \equiv x\pmod p$ has precisely $p$ solutions?

I can use Lagrange's theorem and Fermat's little theorem.

• Is $p{}$ prime? – punctured dusk Apr 15 '15 at 9:40
• sorry, yes p is prime – cf12418 Apr 15 '15 at 9:43
• which aspect is confusing to you? – JonMark Perry Apr 15 '15 at 9:45
• Lagranges theorem shows that x^p-x=0 (mod p) has at most p solutions, I cant figure out the next step to show it has precisely p solutions, using these two theorems, – cf12418 Apr 15 '15 at 9:46
• there are p distinct numbers between 0 and p-1, each one is a solution – JonMark Perry Apr 15 '15 at 9:55