Take the 2-minute tour ×
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.

Let $p$ be a prime. Prove that $p$ divides $ab^p−ba^p$ for all integers $a$ and $b$.

share|improve this question
Hint: It helps to think of it as $ab^p \equiv ba^p \mod p$. –  Tara B Mar 24 '12 at 12:47
Oh, I see that while I was laboriously typing my comment on an iPad, people provided actual answers. Oh well. –  Tara B Mar 24 '12 at 12:49
The variant of Fermat's Theorem that says $x^p\equiv x\pmod{p}$ makes this automatic. –  André Nicolas Mar 24 '12 at 16:54

3 Answers 3

Hint $\ $ little Fermat $\rm\Rightarrow mod\ p\!:\ n^p \equiv n\ \Rightarrow\ f(a,b^p)\equiv f(a,b)\equiv f(a^p,b)\ $ for all $\rm\:f\in \mathbb Z[x,y]$

share|improve this answer

KV Raman's answer is quite right, but I'll write my answer anyway because I find it tidier.

$\mathbb{Z}_p^* = \mathbb{Z}_p\setminus \{0\}$ is a cyclic group of order $p-1$ under multiplication, so $a^{p-1} \equiv 1 \mod p$ for all integers not divisible by $p$. If $a$ is divisible by $p$, then $a^n \equiv 0 \mod p$ for all $n$. So we have $a^p \equiv a \mod p$ for $a\in \mathbb{Z}$. (This is Fermat's Little Theorem.)

Now for any integers $a$ and $b$, \[ ab^p \equiv ab \equiv a^pb \mod p \] and so $ab^p - ba^p \equiv 0 \mod p$, which means $p$ divides $ab^p - ba^p$.

share|improve this answer
You got my vote +1 for your proof Tara. –  Kirthi Raman Mar 24 '12 at 13:19
+1. That's much easier than arranging things such that the $a^{p-1}$ form of Fermat's little theorem applies directly. –  Henning Makholm Mar 24 '12 at 13:21
up vote 12 down vote accepted

$$ab^p-ba^p = ab(b^{p-1}-a^{p-1})$$

If $p|ab$, then $p|(ab^p-ba^p)$ and also if $p \nmid ab$, then gcd$(p,a)=$gcd$(p,b)=1, \Rightarrow b^{p-1} \equiv a^{p-1} \equiv 1\pmod{p}$ (by Fermat's little theorem).

This further implies that $\displaystyle{p|(b^{p-1}-a^{p-1}) \Rightarrow p|(ab^p-ba^p)}$.


share|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.