Partial Sums of Geometric Series This may be a simple question, but I was slightly confused.  I was looking at the second line $S_n(x)=1-x^{n+1}/(1-x)$.  I was confused how they derived this.  I know the infinite sum of a geometric series is $1/(1-x)$.  I just can't figure out how the partial sums, $S_n(x)$, have $1-x^{n+1}$ on the numerator.  How was this derived?
Thank you.

Example 5.20.
  The geometric series
  $$
    \sum_{n=0}^\infty x^n
  = 1 + x + x^2 + x^3 + \dotsb
$$
  has partial sums
  $$
    S_n(x)
  = \sum_{k=0}^n x^k
  = \frac{1 - x^{n+1}}{1 - x} \cdotp
$$
  Thus, $S_n(x) \to 1/(1-x)$ as $n \to \infty$ if $|x| < 1$ and diverges if $|x| \geq 1$, meaning that
  $$
    \sum_{n=0}^\infty x^n
  = \frac{1}{1-x}
  \qquad
  \text{pointwise on $(-1,1)$}.
$$
  (Original image here.)

 A: It's from the sum of a (finite) geometric series. But you can derive it from first principles.
$$S_n(x) = 1 + x + x^2 + \dotsb + x^n$$
$$xS_n(x) = x + x^2 + x^3 + \dotsb + x^{n+1}$$
Subtracting the second from the first (and noting the telescoping nature, which I'm making explicit here),
$$(1-x)S_n(x) = 1 - x + x - x^2 + x^2 + \dotsb - x^n + x^n - x^{n+1} = 1- x^{n+1}.$$
Rearranging,
$$S_n(x) = \frac{1-x^{n+1}}{1-x}.$$
A: Observe that
$$
\frac{1}{x-1}(x^{k+1}-x^{k})=x^k\quad (x\neq 1)
$$
whence
$$
\sum_{k=0}^n x^k=\sum_{k=0}^n\frac{1}{x-1}(x^{k+1}-x^{k})=\frac{1}{x-1}(x^{n+1}-1)
=\frac{1-x^{n+1}}{1-x};\quad (x\neq 1)
$$
since the sum telescopes.
A: $S_n(x)=1+x+x^2+x^3+ . . .x^n=1+x+x^2+x^3+ . . .x^n +x^{n+1}-x^{n+1}=1-x^{n+1} + x(1 +x+x^2+x^3 . . .+x^n)=1-x^{n+1} +x S_(n)$
⇒ $(1-x)S_n(x)=1-x^{n+1}$
⇒ $S_n(x)=\frac{1-x^{n+1}}{1-x}$
A: Deepak's excellent answer is the standard argument.  I will give (essentially) the same argument here, but a slightly different presentation.  What I like about this argument, in comparison to Deepak's, is that it eliminate the ellipses and makes the computations a little more precise.  There is a cost—I think that some of the intuition is lost, since we don't see the term-by-term cancelation—but I think that this is a price which can be paid without too much difficulty.

Given any real (or complex) number $x$ and any natural number $n$, let $S_n(x)$ denote the $n$-th partial sum of the series $\sum_{j=0}^{\infty} x^j$.  That is,
$$ S_n(x) = \sum_{j=0}^{n} x^j. $$
Observe that
\begin{align}
xS_{n}(x) - S_{n}(x)
&= x\sum_{j=0}^{n} x^j - \sum_{j=0}^{n} x^j \\
&= \sum_{j=0}^{n} x^{j+1} - \sum_{j=0}^{n} x^j &&\text{(distribution over finite sums)} \\
&= \sum_{k=1}^{n+1} x^{k} - \sum_{j=0}^{n} x^j &&\text{(CoV: let $k=j+1$)} \\
&= \left[ \sum_{k=1}^{n} x^k + x^{n+1}\right] - \left[1 + \sum_{j=1}^{n} x^j \right] && \text{(pull out a couple of terms)} \\
&= x^{n+1} + \color{red}{\sum_{k=1}^{n} x^k} - \color{red}{\sum_{j=1}^{n} x^j} - 1 && \text{(the red terms cancel)} \\
&= x^{n+1} - 1.
\end{align}
Supressing the intermediate steps, this reduces to
\begin{align}
x S_n(x) - S_n(x) = x^{n+1} - 1
&\implies (x-1)S_n(x) = x^{n+1} - 1 \\
&\implies S_n(x) = \frac{x^{n+1}-1}{x-1} = \frac{1-x^{n+1}}{1-x},
\end{align}
which is the claimed identity.

Another alternative to Deepak's appeal to telescoping sums is the following.  Again, we start with
\begin{align} (x-1)S_n(x)
&= xS_n(x) - S_n(x) \\
&= \left[ x + x^2 + x^3 + \dotsb + x^n + x^{n+1} \right]
- \left[ 1 +  x + x^2 + x^3 + \dotsb + x^n \right].
\end{align}
If we write this subtraction in the style that is taught in American elementary schools, it looks something like
\begin{array}{r}
&&& \color{red}{x} &+& \color{blue}{x^2} &+& \color{green}{x^3} &+& \dotsb &+& \color{orange}{x^{n}} &+& x^{n+1} \\
-{\quad} & 1 &+& \color{red}{x} &+& \color{blue}{x^2} &+& \color{green}{x^3} &+& \dotsb &+& \color{orange}{x^{n}}  \\\hline
& -1 &+& \color{red}{0} &+& \color{blue}{0} &+& \color{green}{0} &+& \dotsb &+&  \color{orange}{0} &+& x^{n+1}.
\end{array}
Lining up "like terms" (that is, aligning terms with the same exponent) makes it a little easier to see where the cancelations are happening.  The rest of the argument is identical.
A: For completeness let me add one, also very usual, argumentation. Partial sum can be derived from formula:
$$a^{n}-b^{n}=(a-b)(a^{n-1} + ba^{n-2}+ \cdots + b^{n-1}) $$
Taking $b=1$ we obtain
$$a^{n}-1=(a-1)(a^{n-1} + a^{n-2}+ \cdots + 1) \Rightarrow a^{n-1} + a^{n-2}+ \cdots + 1 = \frac{a^{n}-1}{a-1}$$
