Why does $\frac{1-y^n}{1-y^m}=\frac{y^{n-1}+y^{n-2}+\dots+y+1}{y^{m-1}+y^{m-2}+\dots+y+1}$?

The solutions for the problem booklet for my Mathematics BSc second-year module in real analysis (unpublished) use this without explanation (unless there's something in the surrounding working which I haven't realised is related). I don't recognise this equality. Where does it come from?


Solution 1:

$$ \frac{1-y^n}{1-y^m}=\frac{\frac{1-y^n}{1-y}}{\frac{1-y^n}{1-y}} $$ Now note that the numerator, $\frac{1-y^n}{1-y}$, is the formula for the sum of a geometric sequence: $1,y,y^2,\ldots,y^{n-1}$. The same applies to the denominator (with $m$ elements, this time) and the result follows.

Solution 2:

Since $a^n-b^n=(a-b)(a^{n-1}+a^{n-2}b+a^{n-3}b^2+\dots+ab^{n-2}+b^{n-1})$ for all $n\in\mathbb N$, we have $$ \frac{1-y^n}{1-y^m}=\frac{y^n-1^n}{y^m-1^m}=\frac{(y-1)(y^{n-1}+y^{n-2}+\dots+1)}{(y-1)(y^{m-1}+y^{m-2}+\dots+1)}=\frac{y^{n-1}+y^{n-2}+\dots+1}{y^{m-1}+y^{m-2}+\dots+1} \, . $$