# Derivation of the Formula for Mortgage Payments

Derivation of the Formula for Mortgage Payments

A while ago, I wanted to know the reasoning behind the amount of my payments on my home mortgage. I looked in some accounting books, and all they gave was the formula. None of them gave the rationale behind it. So I sat down and derived it myself. It's not too hard.

Say we borrow an amount "A" at an interest rate of "r" per payment period. (If the payments are made monthly, "r" is the annual interest rate quoted by the bank divided by 12.) We pay back the loan in "N" payments or periods.

For example, for a 30 year mortgage on which payments are made monthly, N would be 30×12 or 360. After N payments, each of the amount "P", the loan is paid off and the amount we owe is reduced to zero.

Derivation of the Formula
The Initial amount we owe is A. At the end of the first payment period, the amount we owe has increased by rA, one payment period of interest, and we make a payment, P. So the total amount we owe after one period is
: A + rA – P, or A(1 + r) – P. We note that this A(1 + r) – P is not only an amount, but also an operator; that is, given the amount of principal outstanding at the beginning of any period, we can apply it to determine the amount of principal remaining at the end of the period.

So applying the operator A(1 + r) – P to the amount A(1 + r) – P remaining at the end of the first period, we get (A(1 + r) – P)(1 + r) – P as the amount remaining at the end of the second period. Similarly, at the end of the third period, the amount of principal remaining is: ((A(1 + r) – P)(1 + r) – P)(1 + r) – P. After N periods (applying the operator and then expanding), the amount remaining will be:

A(1 + r)^N – P( (1 + r)^(N-1) + (1 + r)^(N-2) + (1 + r)^(N-3) + … + 1 ) = 0  [Equation 1].

It equals zero, because after N periods the loan is paid off. Considering just the (1 + r)^(N-1) + (1 + r)^(N-2) + (1 + r)^(N-3) + … + 1 portion, we can reverse the order of its terms and rewrite it as: 1 + (1 + r) + (1 + r)^2 + … + (1 + r)^(N-1)

Representing this series by "S", and letting "R" equal (1 + r), we get:
S = 1 + R + R^2 + … + R^(N-1)
So, RS = R + R^2 + … + R^(N-1) + R^N
Subtracting: S – RS = 1 – R^N, and so S = (1 – R^N) / (1 – R)
Inserting this value for S back into Equation 1:

A(1 + r)^N – P( (1 – R^N) / (1 – R) ) = 0

Finally, Solving for P, the amount we pay each period, we get:

P = rA / (1 – (1 + r)^(-N))

I checked this formula against my own mortgage amount and payments and it agreed exactly! Voila! For example, for a 30 year mortgage for \$300,000 at an interest rate of 6% per year paid monthly, the parameters are: A = 300000 (the mortgage amount) r = 0.06 / 12 = 0.005 (the monthly interest rate) N = 30 x 12 = 360 (the number of payments) And the monthly payments would be: 0.005 x 300000/(1 – 1.005^(-360)) = 1798.65 dollars per month.

Another Way: Approximation with a Differential Equation
We can also use a differential equation to get a very close approximation of the payments on a mortgage.  A while ago I was trying to figure out how long it would take a bug walking along a stretching rubber band to get to the end.  After I solved that problem, it occurred to me that the problem of mortgage payments could be solved in a similar way.  It's a nice example of how a differential way of thinking can be used to solve a real-world problem.  Perhaps many problems in finance and economics can be solved using a differential approach.

We start by looking at how fast the mortgage is being paid off:  We now let A(t) be the amount we owe on the mortgage as a function of time.  Note that A(0) is the amount of the mortgage, the amount we borrowed.  Each month, the bank adds an interest amount of r * A to the mortgage and we make a payment of P.  Consequently, the amount we have remaining to pay on the mortgage changes by: dA/dt = r * A – P each month.

To solve this equation for A requires a little bit of mathematical gymnastics, but it's strictly cookbook.  It can be very easily solved by entering "solve (dA/dt = r * A – P)", without the quotes, into WolframAlpha at www.wolframalpha.com and clicking on the = sign.

The solution is: A(t) = P/r + C e^(rt), where C is a constant we need to evaluate. After a time T, the mortgage will be paid off, so we have: A(T) = P/r + C e^(rT) = 0. Solving for C, we get, C = -P/r e^(-rT). Replacing C in the solution, A(t) = (P/r) (1 – e^(r (t-T)). So, A(0), the amount of the mortgage (the amount we borrowed) is: A(0) = P/r (1 – e^(-rT)). And finally, solving for P we get: P = r A(0) / (1 – e^(-rT)). For A(0) = 300000 dollars, i = 0.06 / 12 = 0.005 percent per month, and T = 360 months, we get: P = 1797.05 dollars per month, very close to the amount we calculated before.  (But, of course, not quite good enough for the bank!)