# How to prove $p$ divides $a^{p - 2} + a^{p - 3} b + a^{p - 4} b^2 + \cdots + b^{p - 2}$ when $p$ is prime, $a, b \in \mathbb{Z}$ and $a,b \lt p$?

If $p$ is a prime number and $a, b \in \mathbb{Z}$ such that $a,b \lt p$, then how could we prove that $p$ divides

$\left(a^{p - 2} + a^{p - 3} b + a^{p - 4} b^2 + \cdots + b^{p - 2}\right)$?

-
Do a and b need to be distinct? Else it seems to me that a=1, b=1, p=3 is a counterexample unless I misunderstand something. –  David Spencer Jul 13 '12 at 12:57
Minor point, I think you want $a,b \in \mathbb{N},$ distinct, and both strictly between $1$ and $p.$ That is $0 < a <b <p$ with no loss of generality. If you allow negative $a$ and $b$ you can take them to be congruent (mod p) which spoils the congruence. –  Geoff Robinson Jul 13 '12 at 13:15

We have $$(a-b)(a^{p-2} + a^{p-3}b + \ldots + ab^{p-3} + b^{p-2}) = a^{p-1} - b^{p-1}.$$ If $p\nmid a$ and $p\nmid b$ then the right side is congruent to $1-1 = 0$ by Fermat's little theorem, i.e $p$ divides the product on the left. If furthermore $a \not\equiv b \pmod p$ then $p$ must already divide $a^{p-2} + a^{p-3}b + \ldots + ab^{p-3} + b^{p-2}$.

The statement becomes false if you do not assume $a \not\equiv b \pmod p$, e.g. for $a=b=1$ the sum equals $p-1$ which is not divisible by $p$. Also, if $p| a$ (w.l.o.g.) the sum is congruent to $b^{p-2}$ which is only divisible by $p$ if $p|b$.

-

$$\sum_{r=0}^{p-2}a^rb^{p-2-r}=\frac{a^{p-1}-b^{p-1}}{a-b}.$$

Now, $c^{p-1}\equiv 1\pmod p$ for $(c,p)=1$, so

$$a^{p-1}-b^{p-1}≡0\pmod p \implies \frac{a^{p-1}-b^{p-1}}{a-b}≡0\pmod p$$ as $(a-b,p)=1$ when $a,b < p$.

-
$a,b < p$ does not imply $(a-b,p) = 1$. E.g. $1,1 < 2$ but $2|(1-1)$. –  marlu Jul 13 '12 at 13:15
The condition should have been a<b<p as a=b=>the given expression becomes $(p-1)b^{p-1}$ which will be divisible by p iff p|b. –  lab bhattacharjee Jul 13 '12 at 16:23

Hint  Let $\rm\:f(x)\, =\, x^{p-1}\!- b^{p-1}\,$ in: $\rm\ a\ne b\:$ roots of $\rm\:f(x)\ \Rightarrow\, a\$ is a root of $\rm\:f(x)/(x\!-\!b),\:$ for $\rm\,f\in\Bbb Z_p[x]$

Remark $\$ This is essentially the induction step in proving that a polynomial over a domain has no more roots than its degree, via Factor Theorem. Here, by iterating this, we obtain the factorization

$$\rm\ x^{p-1}\!- 1\ =\ (x-1)\,(x-2)\,(x-3)\cdots (x-(p\!-\!1))\quad in\ \ \Bbb Z_p[x]$$

-