How Do I Use Logarithms to calculate the sum of a Geometric Series

exponential functiongeometric serieslogarithms

I've run into a problem while trying to program something and I'm not much of a mathematician, so I'm hoping someone can jog my memory on how to handle this.

I'd like to know how much time it would take for each amount at each discrete time interval to summate to a specific value if those additive sums decrease exponentially over time. Knowing the initial amount ($a = 0.125$), the decay rate($1 – r = 0.98$), and the final sum ($\sum i = 5$), I need to solve for time ($t$).

I'd imagine the equation would look something like:

$\sum i = a(1-r)^t$

$5 = 0.125(0.98)^t$

Though it's been nearly two decades since I've had to use this notation, so I may be off. I understand how to solve for time if I'm just trying to solve for a lower value at some later point (i.e., $t$ = $\ln(f(x)/a)/\ln(1-r))$. However, if I am to more or less sum the product of each iteration of $a(1-r)^t$ until it reaches value $\sum i$, I'm lost. Someone else had instructed me that I just need to use logarithms, but after looking for a few hours, I'm frankly confused as to how to apply a logarithm to the equation above to solve for time. Any help is truly appreciated it.

Best Answer

Let me take you through a complete solution, especially now that you've clarified you're interested in the sum as well. I an going to be focussing on your edited final "target" sum of $5$.

A geometric sequence (or progression) is one that goes like this:

$a, ar, ar^2, ar^3, ..., ar^{n-1}, ...$

You start with the initial term $a$, and to go from one term to the next, you multiply by the common ratio $r$. The $n$-th term is $ar^{n-1}$, which makes sense since you're starting with a first term of $a = ar^0$.

However, your conventions are slightly different. You're starting at an initial time $t=0$, and your common ratio seems to be denoted $(1-r)$ (instead of $r$), so your sequence is going:

$a, a(1-r), a(1-r)^2, ..., a(1-r)^t, ...$

and the amount at time $t$ is $a(1-r)^t$.

Now I'll show you how to derive an expression for the sum of this series (up to time $t$).

The sum to time $t$ is given by $S_t = a + a(1-r) + a(1-r)^2 + ... + a(1-r)^t$

If you did something really interesting, i.e. multiply by $(1-r)$, this is what you get:

$(1-r)S_t = a(1-r) + a(1-r)^2 + a(1-r)^3 + ... + a(1-r)^t + a(1-r)^{t+1}$

Now try subtracting the new expression from the original:

$S_t - (1-r)S_t = a + a(1-r) + a(1-r)^2 + ... + a(1-r)^t - (a(1-r) + a(1-r)^2 + a(1-r)^3 + ... + a(1-r)^t + a(1-r)^{t+1})$

$rS_t = a - a(1-r)^{t+1}$

$S_t = \frac{a(1 - (1-r)^{t+1})}{r}$

And there's your formula.

(You will note that the formula looks somewhat different from "standard" formulae for geometric sums. This is because the way you defined the parameters in your question is different. For the record, the standard formula for the geometric sum is $S_n = \frac{a(1 - r^n)}{1 - r}$, but the parameters mean something different in that formula, so don't confuse yourself).

Anyway, working with this formula that I've derived, you have $1-r = 0.98 \implies r = 0.02$. You have $a = 0.125$. You want to find the value of $t$ at which the sum $S_t$ reaches $5$ (the value you put in after your edit).

We have:

$5 = \frac{0.125(1 - (0.98)^{t+1})}{0.02}$

Rearranging, $\frac{(5)(0.02)}{0.125} = 1 - (0.98)^{t+1})$

$\frac 45 = 1 - (0.98)^{t+1}$

$(0.98)^{t+1} = \frac 15$

Taking logarithms of both sides by before and exploiting the same property of logs (bringing the index down, we get:

$(t+1)\log 0.98 = \log 0.2$

$t \approx 79.66$

So it would take at least $80$ units of time for the sum to just exceed your target of $5$.

Interestingly, if you put in "target" sums of $10$ or $30$ like you had before your final edit, you will not be able to get a sensible (real) value for $t$. This is because the infinite series (sum to an infinite number of terms) of a progression starting out at $0.125$ and being iteratively multiplied by $0.98$ each time will still only sum to $6.25$, so that's the maximum bound for a sum for any finite number of terms. So it's good that you amended the question to an answerable one with your edit.