Fun with financial returns and Geometric Series
I was enjoying my morning “Mate” (pronounced “mah-teh”) today and being lazy between news sites and social media when I came across an Instagram reel from some Investor Guru sharing some “magical” investment strategy. The guy basically said:
If you save $1,500/mo and invest it in a certain bond scheme (I think it was USA vs non-USA), after 20 years you’ll end up with $1,000,000 (1 million dollars).
My reaction was just a “meh, that doesn’t seem like much”. After all, $1,500/mo for 20 years is $360,000 just of saved capital (or principal). That means you’re tripling your capital in 20 years. Is not that 3X is not appealing, but in finance, we’re usually looking the magic of “Compound Interests”, and 3X doesn’t look like CRAZY returns after 20 years.
But then it hit me… what IS the actual monthly return rate in this case?
If, each month, I reinvest all my capital plus add $1,500 on top, what’s the real return rate I’m getting?
Well, it was Saturday morning, I had some time to focus on something extra aside from more traditional data science projects, so I decided to take a stab at it.
If you’re into Data Science, programming, math, this is a VERY interesting problem to solve. Stop right here and try to solve it in ANY way possible.
Dusting my old calculus books
The first thing I did was taking a look at the equation that I wanted to solve. I have the following information:
- Capital invested (C): $1,500/mo
- Total return (S): $1,000,00
- Number of periods (n): 240 months, 20 years
I need to find r, the “monthly investment return”.
Writing down the equations for each month as a function of the previous month helps understand the problem. Here, M₀ is the total capital at period 0, just the initial investment C ($1,500). M₁ is the total capital of M₀ plus interests (r), plus another $1,500 on top, and so on:

We know that by M₂₄₀, we’ll have a total return of $1,000,000 . So the formula to calculate r is:

But the issue is that this is a recursive function, to solve it, we should write down 240 equations one after the other.
We can “unfold” all the terms in a more generic way, let’s do it just for the first 3 terms:

I also put M4 as it’d be the start of Month 4
Which is a little bit hard to read, but it can be simplified in the following form:

We can now see a clear pattern emerge:

I know this form! It’s a Geometric Series. In hindsight I should have spotted a lot earlier, but I’m definitively rusty. Now it gets interesting.
Geometric Series and Solving for r
Now that I was able to identify that I was dealing with a Geometric Series, I could easily find the formula to compute the partial sum at the nₜₕ term, and then just solve for r. Geometric Series are usually covered in calculus classes, and they’re extensively studied, so half my work was done already.
If it helps, a Geometric Series is the sum of an infinite number of terms that have a constant ratio between successive terms. The sum, (Sn), for the nₜₕ term is defined in this way:

The closed-form formula for the partial sum is derived in this way:

With this information, we just need to find r. That is, solve the equation for r.
Numerical Approximation Methods to the rescue
But there’s a problem. If we try to resolve for r, we end up with something like:

Which is impossible to solve analytically!
To solve for this, we need to use some sort of numeric approximation methods.
There are a lot of numerical approximation methods to find the “zeroes” or roots of functions. They’re usually called “optimization” methods. A very common one used is the Newton method, which involves getting the derivative of the function to approximate the roots, similar to Gradient Descent (extensively used in Machine Learning).
But we could start with something simpler: just a bisection method, the same concept as Binary Search.
Let’s start with a VERY LOW value for r, for example a 0.001% monthly return. 0.001% is equivalent of 0.00001, or an interest of 1.00001. The partial sum Sn after 240 months, with a capital of $1,500 and a 0.001% monthly interest rate is:

We can write a quick Python function to calculate this:

We see that with 0.001% the total return is just $430 (on top of the $360K of investment). We’re clearly WAY off. Let’s jump to the extreme, setting our return as high as 1% monthly:

We’re getting closer, but this time we went beyond the expected return. Now, we’ll start “bisecting” the problem. Let’s try now with 0.5%:

That’s also close! But lower than $1,000,000. We can now get to the “middle point” between 1% and 0.5%, which is 0.75%:

That’s A LOT closer! We’re off by just $1,830.
Batteries included: solving with SciPy
The reality is that after 240 months, a small error in the calculation of r quickly adds up. We were off by $1,830 dollars with r = 0.75%, getting to the REAL value is going to take a lot of iterations.
Enter SciPy, a library that contains algorithms and functions to solve a wide variety of scientific problems. In particular, we’re interested in the fsolve function, that helps you find the root of a function. Here’s the implementation to find r:

We can see that r is really closer to: 0.7488% (we weren’t THAT off with our initial 0.75% estimate).
If we plug that into a spreadsheet, we can validate that the result is correct:

The importance of models in Data Science
When I first thought of the problem I was a bit worried because it seemed more complicated than what I expected, even computational intensive. But once I spotted the underlying model (the Geometric Series), it immediately became a simple step by step process.
This is very common in Data Science, you start with a problem that seems extremely hard, but once you’re able to spot the underlying model, you immediately unlock it.
For example, it happens a lot when dealing with data that seems to be erratic, until you can spot some underlying probability distribution that explain the behavior.
It’s important to keep in mind these “theoretical” models because, even though it seems we won’t use them in a day to day basis, they’ll give you the foundation to tackle other (seemingly unrelated) problems.
Is it a good investment?
So, finally, is a 0.0748% monthly a good return? Well, it depends. If we annualize it, we get that 1.007488¹² = ~9.3% annual, which is not bad at all.
But, considering the historical average yearly return of the S&P for the past 20 years is 9.66%, an accumulated inflation of ~65%, and T-bills at around ~6% (at the time of this writing), the 9.3% doesn’t seem like A CRAZY return. We could calculate the Sharpe ratio, but I assume it’s gonna be floating around ~0.6.
So, I’d say it’s an interesting return if it could be maintained constantly for 20 years, but it’s not something out of this world, specially considering all the bonds that the guy recommends buying (and the broker commissions).
Definitively, not an investment worth doing a reel for. But thanks for the inspiration.
This post was automatically migrated from Medium. It still lives at: https://medium.com/@santiagobasulto/fun-with-financial-returns-and-geometric-series-aed1656580ed