How to show that $\sum_{i=0}^{n-1}x^i=\frac{1}{1-x}-x^n=\frac{x^n-1}{x-1}$ This is not a homework assignment, but a problem that is bothering me nonetheless. I feel like I should be able to figure this out, but either I'm missing some detail, or I'm doing something completely wrong.
The question arises because I read a theorem in my elementary number theory book that states the following:

$1+x+x^2+x^3+\cdots+x^{n-1}=\frac{x^n-1}{x-1}$

and it goes on to prove it using induction. This got me thinking, because I recall from my Calculus class over the summer that the power series $\sum_{i=0}^n x^i=\frac{1}{1-x}$. So I just decided to try and see if this is right by taking my knowledge from Calculus and using a bit of algebra to manipulate the fraction.
So what I come up with is the following:
\begin{align}
\sum_{i=0}^{n-1} x^i&=\sum_{i=0}^{n} x^i-x^n\\
&=\frac{1}{1-x}-x^n\\
&=\frac{1-x^n+x^{n+1}}{1-x}\\
&=\frac{x^n-1-x^{n+1}}{x-1}
\end{align}
I'm having trouble figuring out how to deal with the $-x^{n+1}$ in the numerator in order to make the fraction equal $\frac{x^n-1}{x-1}$. Where am I going wrong?

We do the calculation in the style you are trying to use, and then explain why one should not do that. We have
$$1+x+x^2+\cdots+x^{n-1}=(1+x+x^2+x^3+\cdots)-x^n(1+x+x^2+x^3+\cdots).$$
Using the familiar formula for the sum of an infinite geometric series, we get 
$$1+x+x^2+\cdots+x^{n-1}=\frac{1}{1-x}-x^n\frac{1}{1-x},$$
which readily simplifies to the form you want.
Caveat: The formula 
$1+x+x^2+x^3+\cdots =\frac{1}{1-x}$ holds only when $|x|\lt 1$. So if we are going to use it for our finite geometric series, we will only have shown that the desired formula holds when $|x|\lt 1$. In fact, the formula for the sum of a finite geometric series holds for all $x\ne 1$.
Another reason to eschew the infinite series argument is that the most standard proofs for the sum of an infinite geometric series use the formula for the sum of a finite geometric series. 
