# A little piece of financial math

Like many homeowners, I don’t put a lot of thought into my mortgage payments. Indeed, it suffices for me to know that if I pay the bank the amount that they asked for, then they’ll stay off my back for at least a month. Most of the Canadian banks have a mortgage calculator on their website, and I’ve never put much thought as to how it works.

This changed when my wife, who’s getting certified as a professional accountant, asked me how to perform what turns out to be equivalent to calculating a mortgage. The derivation is quite intricate and surprisingly satisfying mathematically, so I thought I would share.

Let us set up the problem as follows. Suppose that you borrowed an amount $k$ from a lender, and the interest rate is $r$ percent per period. You are to pay the lender back in $n$ equal payments, including all interest and principal. How do you calculate the amount of each payment, and the total cost of borrowing (excluding time value of money which is not part of the problem)?

This question seems quite intractable, as there are many unknowns. However, in a realistic situation $k, r, n$ are all known. In concrete terms, suppose you borrowed $k = 250,000$ dollars to buy a house, at an interest rate of 3% per month. You are to pay the bank back over a period of 25 years, or $n = 300$ months. Therefore, our final formula would make use of the parameters $n, k ,r$, or in other words, we wish to derive the payment amount $P$ as a function of $n, k, r$.

To do this, let us think about the first payment, say $P_1$. We have to pay $rk$ amount in interest, and an amount $a_1$ in principal. Therefore, we have

$P_1 = rk + a_1.$

The next payment, $P_2$, we pay an interest equal $r(k - a_1)$, since the principal has been reduced by $a_1$, and a principal amount equal to $a_2 = P_2 - r(k-a_1)$. Making use of the fact that each payment is equal, i.e. $P_1 = P_2 = P$, we have

$a_2 = P - r(k - P + rk) = P - rk + rP - r^2 k = (1+r)P - k(r + r^2) = (1+r)a_1$.

Likewise, for the third payment, we have

$a_3 = P - r(k - a_1 - a_2) = P - r(k - a_1 - (1+r)a_1) = a_1 + ra_1 + r(1+r)a_1 = a_1(1+r)^2$.

We now have enough data to make an induction hypothesis, namely

$a_l = a_1 (1+r)^{l-1}$.

If we assume the induction hypothesis, then we have

$a_{l+1} = P - r(k - a_1 - \cdots - a_l) = a_1 + r a_1 + \cdots + r(1+r)^{l-1}a_1 = a_1(1+r)^l.$

Now we use the fact that after $n$ payments, we must pay back the principal. In other words, we must have

$\sum_{j=1}^n a_j = k,$

which is equivalent to

$a_1 \sum_{j=0}^{n-1} (1+r)^j = k.$

The partial geometric series on the left hand side can be evaluated to be

$a_1 \left(\frac{(1+r)^n - 1}{r}\right),$

hence

$a_1 = \frac{kr}{(1+r)^n - 1}.$

Recall that $a_1 = P - rk$, and we obtain

$P = rk\left(1 + \frac{1}{(1+r)^n - 1}\right) = \frac{rk(1+r)^n}{(1+r)^n - 1}$.