Prove that $6p$ is always a divisor of $ab^{p} - ba^{p}$. [closed]

$ab^p$ and $ba^p$ are both odd if $a,b$ are both odd, and both even otherwise, so $ab^p-ba^p$ is divisible by $2.$

$b^p-b$ is divisible by $p$ for any $b$, so $ab^p-ab$ is divisible by $p$. Similarly, $ba^p-ba$ is divisible by $p$. So $ab^p-ba^p=(ab^p-ab)-(ba^p-ba)$ is divisible by $p$.

The last thing you need to show is that $3\mid ab^p-ba^p$. For this case, you need $p$ odd. I'll leave that to you.

(You need $p>3$ only because once you have $p\mid x$, $2\mid x$ and $3\mid x$, you need $p\neq 2,3$ to get that $6p\mid x$.)


It's a special case of the following homogeneous generalization of the Euler-Fermat theorem.

Theorem $ $ Suppose that $\rm\ n\in \mathbb N\ $ has the prime factorization $\rm\:n = p_1^{e_{\:1}}\cdots\:p_k^{e_k}\ $ and suppose that for all $\rm\,i,\,$ $\rm\ e\ge e_i\ $ and $\rm\ \phi(p_i^{e_{\:i}})\mid f.\ $ Then $\rm\ n\mid (ab)^e\,(a^f-b^f)\ $ for all $\rm\: a,b\in \mathbb Z.$

Proof $\ $ Notice that if $\rm\ p_i\mid ab\ $ then $\rm\:p_i^{e_{\:i}}\ |\ (ab)^e\ $ by $\rm\ e_i \le e.\: $ Else $\rm\:a\:$ and $\rm\:b\:$ are coprime to $\rm\: p_i\:$ so by Euler's phi theorem, $\rm\ mod\ q = p_i^{e_{\:i}}\!: \ a^{\phi(q)}\equiv 1\equiv b^{\phi(q)} \Rightarrow\ a^f\equiv 1\equiv b^f\: $ by $\rm\: \phi(q)\mid f.\ $ Thus since all $\rm\ p_i^{e_{\:i}}\ |\ (ab)^e\ (a^f - b^f\:)\ $ so too does their lcm = product = $\rm\: n.$

Corollary $\, \rm[e_i=1]\quad\ \ \ n\mid ab(a^f\,-\,b^f)\ $ if $\,n\,$ is squarefree and prime $\,\rm p\mid n\,\Rightarrow\, p\!-\!1\mid f$

Corollary $\,\rm[OP]\quad 2\cdot 3\cdot p\mid ab(a^{p-1}\! - b^{p-1})\: $ for all $\rm\:a,b\in \mathbb Z,\:$ prime $\rm\:p>3$

Corollary $3\ $ $ $ If we restrict the theorem to all $\,a,b\,$ such that $\,p_1\mid a\!\iff\! p_1\mid b\,$ then we can relax $\,e\ge e_1$ to $\,2e+f\ge e_1$ since then we get $\,p_1^{2e+f}\mid (ab)^e(a^f-b^f)$ in the case one (so both) of $\,a,b\,$ are divisible by $\,p.\,$ Instead of Euler $\phi$ we we can use Carmichael $\,\lambda$ (= half of $\phi$ for $2^e\ge 8),\,$ e.g. if $e=1,f = 2, n = 2^3\cdot 3\,$ then $\,24\mid ab(a^2-b^2)\,$ when $\,2\mid a\!\iff\! 2\mid b\,$ since $\,4=2e+f \ge e_1 = 3,\,$ and $\lambda(2^3)=2\mid f$.