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?
 A: In order to show that $\frac{x^n-1}{x-1}=1+x+...+x^n$ just multiply by $x-1$ both sides and observe that most terms cancel. 
The calculus result states that $\sum_{n=0}^\infty x^n=\frac{1}{x-1}$ for $|x|<1$, this follows from the previous result by noting that $\lim_{n\to\infty} x^n=0$. You seem to be confusing the series with the partial sum. 
A: 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. 
A: Hint:
$$
A=1+x+x^2+x^3+\cdots+x^{n-1}\\
xA=x+x^2+x^3+\cdots+x^{n}\\
\implies xA-A=x^n-1
$$
A: I think the difficulty here is that you have confused an infinite geometric series that converges with a finite one.
There is, indeed, a formula:
$$\sum_{i=0}^{\infty} x^i = \frac{1}{1-x}$$
where $|x| < 1$.
But you have used this formula for a finite geometric series.
Then it makes no sense.
(For example, $1/2 + 1/4 + 1/8 \neq 1$; you would need to continue with $1/16 + 1/32 + \ldots$)
