Algebraic manipulation help I'm self-teaching geometric progressions and was asked to find the sum to $n$ terms of $$x + 1 + \frac{1}{x} + \cdots$$ so I used the formula $$\frac{a(r^n - 1)}{r - 1}$$ with $a = x$ and $r = \frac{1}{x}$, and I arrived at $$\frac{x^{1-n} - x}{x^{-1} - 1}$$ The answer in the book is $$\frac{x^n-1}{x^{n-2}(x - 1)}$$
I cannot see how to manipulate my answer to get to the one in the book (though I know they're equivalent as Wolfram Alpha says so). Hope someone can show me how to approach this?

Here’s a computational verification.
$$\begin{align*}
\frac{x^{1-n}-x}{x^{-1}-1}&=\frac{x^{1-n}-x}{x^{-1}-1}\cdot\frac{x^{n-1}}{x^{n-1}}\\
&=\frac{1-x^n}{x^{n-2}-x^{n-1}}\\
&=\frac{1-x^n}{x^{n-2}\left(1-x\right)}\\
&=\frac{1-x^n}{x^{n-2}\left(1-x\right)}\cdot\frac{-1}{-1}\\
&=\frac{x^n-1}{x^{n-2}(x-1)}
\end{align*}$$
Had I been confronted with your result, however, I’d automatically have turned negative exponents into positive ones and then simplified the four-storey fraction:
$$\begin{align*}
\frac{x^{1-n}-x}{x^{-1}-1}&=\frac{\frac1{x^{n-1}}-x}{\frac1x-1}\\
&=\frac{\frac1{x^{n-1}}-x}{\frac1x-1}\cdot\frac{x^{n-1}}{x^{n-1}}\\
&=\frac{1-x^n}{x^{n-2}-x^{n-1}}\\
&=\frac{1-x^n}{x^{n-2}(1-x)}\;.
\end{align*}$$
Whether I leave it like that or flip the differences around depends on whether I expect to be dealing with $x<1$ (leave it) or $x>1$ (flip it).
