<s>[INST] Prove that $a^n-b^n = (a-b)(a^{n-1} + a^{n-2}b + \cdots + b^{n-1})$. Exercise

Prove that $a^n-b^n = (a-b)(a^{n-1} + a^{n-2}b + \cdots + b^{n-1})$.


I've posted my solution below. In case someone has a more clever solution, feel free to post it!
(TBH, I was surprised that there was no question on Math.SE regarding this equation!)
 [/INST] The result is essentially the fact that $1+x+ \cdots + x^{n-1} = {1-x^n \over 1-x}$ (for $x \neq 1$), or equivalently that
$(1-x)(1+x+ \cdots + x^{n-1}) = 1 -x ^n$ for any $x$.
If $a=b$, or $a=0$ then the result is true.
Suppose $a \neq 0$ and $a \neq b$. Then letting $x={b \over a}$ in the above
and multiplying the result by $a^n$ yields the desired result.
To see the above result, note that
$(1-x) (1+x+ \cdots + x^{n-1}) = (1+x+ \cdots + x^{n-1})-(x+x^2+ \cdots + x^{n}) = 1- x^n$.
</s>