Here is my problem, I want to compute the $$\sum_{i=0}^n P^i : P\in ℤ_{>1}$$ I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?


  • $\begingroup$ Note to the casual reader: the way P to the power of i is rendered with smaller font sizes, makes it look like this is a lowercase p. But no, there is only one, capital P and this can be verified by zooming in with the browser. (I almost asked, what's the capital P vs. the small p?) $\endgroup$ – Irfy Feb 5 at 22:35

If we call the sum $S_n$, then $$P \cdot S_n = P + P^2 + P^3 + \cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$

Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = \frac{P^{n+1}-1}{P-1}$$

This is a partial sum of a geometric series.

  • 3
    $\begingroup$ Thank you very much. What a dump I was! Back to elementary mathematics. $\endgroup$ – sasanj Oct 13 '14 at 14:56
  • $\begingroup$ I am glad I could help $\endgroup$ – Joel Oct 13 '14 at 14:56
  • $\begingroup$ Wikipedia has the operands of the subtractions in the numerator and denominator reversed from this, $\frac{1-r^n}{1-r}$. Are they wrong or is this wrong or am I missing a difference that reconciles them? Link: en.m.wikipedia.org/wiki/Geometric_series $\endgroup$ – Joseph Garvin Feb 7 at 3:00
  • 1
    $\begingroup$ Answering my own question: the numerator and the denominator always end up having the same sign. $\endgroup$ – Joseph Garvin Feb 7 at 3:12
  • $\begingroup$ @JosephGarvin These two quantities are the same as $$\frac{1-r^n}{1-r} = \frac{(-1)(r^n-1)}{(-1)(r-1)} = \frac{r^n-1}{r-1}$$ $\endgroup$ – Joel Mar 14 at 16:58

The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :

$$\sum_{i=0}^n P^i = \dfrac{P^{n+1} -1}{P-1}$$

EDIT : Let's prove this !

$(P-1)(P^n +P^{n-1}+...+1)= (P^{n+1} -P^n) +(P^n -P^{n-1})+(P^{n-1}-P^{n-2}) +...+(P-1) = P^{n+1} -1$

You have the result by dividing both sides by $P-1$.

  • $\begingroup$ Thanks for answering that fast. But is there a mathematical proof you can point me to? $\endgroup$ – sasanj Oct 13 '14 at 14:50

We have $$\begin{array}{l} S_n&=1+P+P^2+P^3+\cdots+P^n\\ P\cdot S_n&=0+P+P^2+P^3+\cdots+P^n+P^{n+1} \end{array}$$ Subtracting two above equations gives $$ S_n-P\cdot S_n=1-P^{n+1} $$ divide by $S_n$ $$ 1-P=\dfrac{1-P^{n+1}}{S_n}\\ S_n=\dfrac{1-P^{n+1}}{1-P} $$

  • $\begingroup$ This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions? $\endgroup$ – Ethan Bolker Oct 21 '17 at 13:50

That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $\displaystyle \frac{P^{n+1}-1}{P-1}$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.