How do you calculate your mortgage payment?
A look at geometric series, the mathematical foundation for annuity and loan calculations.
My first newsletter (I think they called them blogs back then) was a step-by-step guide for making your own mortgage table. One thing that I swept under the rug in that article was how to calculate the monthly payment. I just used Excel’s PMT function without any explanation. In this post, I will atone for my earlier laziness and derive the monthly payment formula.
Setting up the mortgage payment formula
The worst part of this derivation is all the variables that we need. Here is the full list:
When people talk about mortgage interest rates, they’re typically referring to the nominal annual amount, which is 12*r. Keep that in mind if you want to use this formula yourself. The strategy for deriving M is as follows. First, I’ll write a general expression for the outstanding loan balance after the nth payment. This formula depends on M, as you would expect. Next, I’ll use the fact that the outstanding balance after the final (Nth) payment must be 0. This gives us an equation to solve that has M in it. Finally, I’ll solve that equation by leveraging formulas for sums of geometric series. Let’s get started.
Before you make the first payment, the outstanding balance on the loan is L. Each payment consists of interest on the loan and principal repayment. The interest is computed first, and the principal repayment is residual. For example, the interest due in the first month is r * L, so the outstanding payment after the first payment is the original loan amount, less (M - rL), the principal repayment:
For the second month, you owe interest on the outstanding balance from the first month, P_1. Applying the same formula yields:
One thing we learn from this formula is that the proportion of your payment that goes towards interest shrinks with each payment. In a given month, interest is r times your outstanding balance, and the outstanding balance gets smaller every time you make a payment. It’s not too bad to extrapolate the preceding formula to the nth month:
The problem is that this formula is recursive, meaning that it refers to earlier terms in the sequence. That’s not super helpful because if we don’t know P_n, then we don’t know P_(n-1) either. To get a closed formula, let’s consider the balance after the third payment:
I got the second equality by substituting the expression for P_2 from above. The third equality is algebra: expanding first, then grouping separately the terms with P_1 and M. This formula is still recursive. The final step is to get rid of P_1 using the first formula:
Now the pattern emerges. The outstanding balance after the nth period has two terms. The first is L times the nth power of (1 + r), and the second is -M times the sum of powers of (1 + r). For the latter term, you stop at the power (n - 1), which is 2 for P_3. Here is the general formula:
(Note that (1 + r) raised to the 0 power is 1.) Technically, you should prove that this pattern generalizes from 3. To do so, you use induction, which amounts to the same algebraic manipulations I did, except with 3 replaced by n. The formula I just derived is true for all values of n, including N—the final period. After you make the final payment, the outstanding loan balance is 0 (by definition of “final”), so we have
Technically, this is the formula we want. The only problem is that the expression in the denominator is the sum of N terms. That’s not ideal, since N is 360 for a 30-year mortgage. In the next section, I’ll finish by finding a closed-form expression for the denominator.
Geometric series
The denominator in the formula for M has the form:
This is called a geometric series. The defining feature of a geometric series is that each term is a constant multiple of the term before it (x, as written above). The nice thing about geometric series is that there is a compact formula for the sum (which is rare for series). To deduce the formula, call the sequence S and multiply by x:
Notice that all of the terms in S and xS are common, except for the 1 in S and the x^n in xS. We can therefore take the difference to simplify things considerably:
You can then factor the S to solve for the sum:
Back to mortgages
To finish the derivation, I’ll apply the geometric series formula to the series in the equation for M. Observing that x = (1 + r), we have
Now, let’s put it all together:
I know that’s a lot of letters, but you should know all of them: the amount you’re borrowing (L), your interest rate (r), and the number of monthly payments (N). Remember that you’ll be paying this amount each month, starting at the end of the first month. Just for fun, let’s see what happens when you discount those payments to the present using the monthly mortgage rate.
To go from the first line to the second, I pulled out one copy of 1/(1 + r) to get the format of the sum to match what we saw earlier. (Note the change in indices.) The next line applies the formula for the sum of a geometric series. The rest of it is algebra and substituting the value of M. Let’s think about what this says. If you compute the present value of your stream of mortgage payments—discounted using your monthly interest rate—you get the original loan amount. This shouldn’t be surprising. From the bank’s perspective, the interest rate is the return that they must get to justify lending you L today. In fact, it would have been valid to start with the equation PV = L to derive the monthly payment M.
Other finance applications of geometric series
The formula for the sum of geometric series is the key step in deriving the monthly payment formula for mortgages. But mortgages are just one example of geometric series applications in finance. For example, annuities have a similar structure: you receive a fixed amount at equal intervals for some period of time (possibly forever). Geometric series are used to compute the present value of annuities, which is important for actuaries. (I can say from experience that they feature prominently on the second actuarial exam—Financial Mathematics.) Speaking of valuation, geometric series are also relevant for pricing bonds and other investments, as well as company valuations.
Thank you for reading. I hope you found this exercise helpful for understanding mortgages. If not, I promise that there will be a payoff in future posts. Please share and subscribe with your network. Referrals are the best way to grow my audience!