Mortgage Calculations

 

Fixed Period Repayments

Amount borrowed: _ _ _ A
Rate of interest over one period (e.g. month): _ _ _ ~r
Instalment (repayment) per period: _ _ _ ~x
Amount owing at end of ~i^{th} period _ [after interest added and repayment deducted.] : _ _ A_{~i}

In the ~i^{th} period, interest is paid on the amount still owing, and a repayment is made. So the amount still owing at end of ~i+1^{th} period is:

A_{~i+1} _ _ = _ _ A_{~i} + ~rA_{~i} - ~x _ _ = _ _ (1 + ~r)A_{~i} - ~x

Applying this from the beginning:

A_1 _ = _ (1 + ~r)A - ~x

A_2 _ = _ (1 + ~r)^2A - (1 + ~r)~x - ~x

A_3 _ = _ (1 + ~r)^3A - (1 + ~r)^2~x - (1 + ~r)~x - ~x

...


Suppose

A_{~i} _ = _ (1 + ~r)^{~i}A - ~x ( &sum._{~j}^{~i}_=^-_0^1(1 + ~r)^{ ~j} ) _ _ _ _ ~i = 1,2, ...

A_{~i+1} _ = _ (1 + ~r)^{~i + 1}A - ~x ( &sum._{~j}^{~i}_=_1(1 + ~r)^{ ~j} ) - ~x

_ _ _ = _ (1 + ~r)^{~i + 1}A - ~x ( &sum._{~j}^{~i}_=_0(1 + ~r)^{ ~j} )

which proves the conjecture by induction.

Now

( &sum._{~j}^{~i}_=^-_0^1(1 + ~r)^{ ~j} ) _ = _ (1 - (1 + ~r)^{~i}) / (1 - (1 + ~r)) _ [geometric series]

So

A_{~i} _ = _ (1 + ~r)^{~i}A - ~x(((1 + ~r)^{~i} - 1) / ~r)



We usually require that total is repaid after a given number, ~m say, of instalments. i.e. A_{~m} = 0 so

(1 + ~r)^{~m}A _ = _ ~x (((1 + ~r)^{~m} - 1) / ~r)


hence

~x _ = _ fract{(~r(1 + ~r)^{~m}) , ((1 + ~r)^{~m} - 1)} # A

Variable Period Repayments

The above works fine for regular instalments at a fixed rate of interest. If the rate of interest changes, the instalment is usually recalculated to preserve the total repayment period.

However most mortgage repayments are made monthly, and months have different lengths, so the "monthly" rate of interest will vary according to the number of days in the month.

Let ~w be the daily increase factor (i.e. ~w = 1 + ~r, where ~r is the ~{daily} interest rate). Then if there are no instalments in ~n days, the loan amount will have increased by a factor of ~w^{~n}.

Let ~d_{~i} be the number of days in the ~i^{th} month, and let ~x be the monthly instalment as before. Then:

A_1 _ = _ A ~w^{~d_1} - ~x

A_2 _ = _ A_1 ~w^{~d_2} - ~x _ = _ A ~w^{~d_1}~w^{~d_2} - ~x ~w^{~d_2} - ~x

A_3 _ = _ A ~w^{~d_1}~w^{~d_2}~w^{~d_3} - ~x ~w^{~d_2}~w^{~d_3} - ~x~w^{~d_3} - ~x

...

A_{~i} _ = _ A ( &prod._{~j}^{~i}_=_1 ~w^{~d_{~j}} ) - ~x ( &sum._{~k}^{~i}_=_2 &prod._{~j}^{~i}_=_{~k} ~w^{~d_{~j}} ) - ~x



If we require, as before, that the total is repaid after ~m repayments. then we need to solve the equation:

~x _ = _ fract{ (&prod._{~j}^{~m}_=_1 ~w^{~d_{~j}}) , ( &sum._{~k}^{~m}_=_2 &prod._{~j}^{~m}_=_{~k} ~w^{~d_{~j}} ) + ~1} # A


Note that although this is a complicated calculation, it is somewhat simplified by the fact that a month has to be 28, 29, 30 or 31 days long, so there will only be four values of ~w^{~d_{~j}} which can be calculated initially and used in the calculation.
(There will also be one value for the partial month if the first instament is not one month after the loan date. This is usually only relevant when the repayments have to be recalculated after a change of interest rate, which could happen mid period.)

Note also that

( &sum._{~k}^{~m}_=_2 &prod._{~j}^{~m}_=_{~k} ~w^{~d_{~j}} ) + ~1 _ = _ (((.(~w^{~d_2} + 1)~w^{~d_3} + 1) ... )~w^{~d_{~m}} + 1)


which is an easier algoritm to compute.

To calculate the order of magnitude of the numerator and denominator of the expression for ~x, consider the term for fixed period repayments, we have that:

&prod._{~j}^{~m}_=_1 ~w^{~d_{~j}} _ _ _ _ ~~ _ _ _ _ ~w^{~m + 1} - ~w^{~m},


where ~w is the ~{monthly} increase, and

( &sum._{~k}^{~m}_=_2 &prod._{~j}^{~m}_=_{~k} ~w^{~d_{~j}} ) + ~1 _ _ _ _ ~~ _ _ _ _ ~w^{~m} - 1


As an example, with monthly repayments spread over 25 years, with a 1% annual interest rate, the numerator and denominator will be about 0.001 and 0.3 respectively, whereas with a 100% annual interest rate, they will be about 2 million and 34 million respectively.

Calculating the Daily Interest Rate

The daily interest rate is that rate, which when compounded 365 times gives the annual interest rate. I.e. if ~r is the daily rate and ~R is the annual rate then

(1 + ~r)^{365} _ = _ 1 + ~R

so

365 log_~e(1 + ~r) _ = _ log_~e(1 + ~R)

~r _ = _ exp rndb{fract{ log_~e(1 + ~R) , 365}} _ _ - _ _ 1

Mortgage Calculator

All this is implemented in a module programmed in JavaScript.