Toolkit 13

General difference of powers

anbn=(ab)(an1+an2b++bn1)a^n-b^n=(a-b)\left(a^{n-1}+a^{n-2}b+\cdots+b^{n-1}\right)

Proof

Expanding the right-hand side gives

(ab)(an1+an2b++abn2+bn1)=(an+an1b++a2bn2+abn1)(an1b+an2b2++abn1+bn).\begin{aligned} &(a-b)\left(a^{n-1} + a^{n-2}b + \cdots + ab^{n-2} + b^{n-1}\right) \\ &= \left(a^n + a^{n-1}b + \cdots + a^2 b^{n-2} + ab^{n-1}\right) \\ &\quad - \left(a^{n-1}b + a^{n-2}b^2 + \cdots + ab^{n-1} + b^n\right). \end{aligned}

All intermediate terms cancel, leaving

anbn.a^n - b^n. \quad\square