Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If $$a^p\equiv b^p \pmod p$$ where $p$ is prime prove that $$a^p\equiv b^p \pmod{p^2}$$ that problem was at my exam today on number theory and i just didnt have a clear mind to solve it.Although i had alot of thoughts couldnt get them together.

share|cite|improve this question
This has been asked and answered many times before on MSE. – Bill Dubuque Jun 23 '14 at 18:42
Sorry but i am not aware of what MSE stands for – Manolis Lyviakis Jun 23 '14 at 18:44
MSE is this site Math.StackExchange – Bill Dubuque Jun 23 '14 at 18:55
up vote 4 down vote accepted

The first equivalence implies that $a\equiv b\pmod{p}$. There are more clever ways of getting to the latter, but here's a direct method: Writing $b = a + np$ for some integer $n$, we have $$b^p \equiv (a + np)^p \equiv a^p + a^{p-1} n p \binom{p}{1} + \sum_{k \geq 2} \binom{p}{k} a^{n-k} (np)^k \equiv a^p + a^{p-1} n p^2 \equiv a^p \pmod{p^2}$$

share|cite|improve this answer

Hint: By Fermat's Theorem, $a^p\equiv a\pmod{p}$ and $b^p\equiv b\pmod{p}$. So $a=b+kp$ for some integer $k$. It follows that $$a^p=(b+kp)^p.$$ Expand the right-hand side using the Binomial Theorem.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.