Expanding $(2^b-1)\cdot(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})$ Can someone please explain to me how the following works (primarily interested in an explanation of the second step when $2^b$ is expanded?
I understand how each series cancels out to equal $2^n-1$ at the end.
$$\begin{align*}
xy&=(2^b-1) \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=2^b \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b}) - (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=(2^b + 2^{2b} + 2^{3b} + \cdots + 2^{ab})-(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})\\
&=2^{ab}-1\\
&=2^n-1
\end{align*}$$

$$\begin{align*}
xy&=(2^b-1) \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=2^b \cdot (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b}) - (1 + 2^b + 2^{2b} + \cdots + 2^{(a-1)b})\\
&=(2^b + 2^{2b} + 2^{3b} + \cdots + 2^{ab})-(1+2^b+2^{2b}+ \cdots + 2^{(a-1)b})\\
&= \left[2^{ab} - 1\right] + \left[(2^b + 2^{2b} + \cdots + 2^{
(a-1)b})-(2^b+2^{2b}+ \cdots + 2^{(a-1)b}) \right]\\
&= 2^{ab} - 1 +(2^b - 2^b) + (2^{2b} - 2^{2b}) + \cdots \\
&=2^{ab}-1\\
&=2^n-1
\end{align*}$$
