I have proved Fermat's little theorem (F.L.T) that is "If $p$ be a prime, then $x^p=x\bmod p$ " by induction on x for $x \in \mathbb Z$ and $x \ge 0$. I want to prove the general case that is for $x \lt 0$.

Here is my attempt

Proof: Let $y =-x$. Since y is positive, thus by F.L.T we have $y^p= y \bmod p$. So $(-x)^p=-x \bmod p$. If $p \gt 2$, then $x^p=x \bmod p$ and we are done. If $p = 2$, then $x^2 =-x \bmod p$.

Here I stuck how can I proceed further to reach at $x^p = x \bmod p$ for $p=2$? Thank you.

  • 1
    $\begingroup$ If $p=2$ then $x\equiv 0 \text{ or } 1\bmod 2$ so checking both cases $x\equiv -x \bmod 2$ and similarly $x^2\equiv x \bmod 2$ $\endgroup$
    – Henry
    Jun 6, 2023 at 15:48

1 Answer 1


I'm just a 13 year old who loves maths so my answer might be wrong, but, following your work and to answer your request, notice that Fermat's little theorem indicates that $p\not|a$. Since $p=2$, $a\equiv 1 \mod [2]$
Now, the rest is quite obvious, notice that, $-1\mod[2]$ and $1\mod[2]$ are the same, since 2-1 is 1, and 2+1=3, $3\equiv 1\mod[2]$ , thus, we have proved what you sought for

  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Jun 16, 2023 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .