Mortgage loan calculation
Deriving the fixed monthly payment and its principal and interest parts
A derivation of the general formula for a fixed mortgage payment, and of its principal and interest components for period l.
N - loan amount
n - number of months
r - annual interest rate
R - monthly payment
c - principal part of the payment
I - interest part of the payment
z_i - outstanding balance in month i
$$ z_0 = N $$
$$ z_1 = z_0 \cdot (1+\frac{r}{12}) - R $$
Introducing the substitution q defined as
$$ q = 1 + \frac{r}{12} $$
which is the growth factor for a single period, assuming monthly compounding (12 periods per year), we get
$$ z_1 = z_0 \cdot q - R $$
$$ z_2 = z_1 \cdot q - R $$
$$ \vdots $$
$$ z_n = z_{n-1}\cdot q - R $$
and after substituting the successive terms
$$ \begin{split} z_1 & = z_0 \cdot q - R \\ \\z_2 & = \left( z_0 \cdot q - R \right) \cdot q - R \\ & = z_0 \cdot q \cdot q - R \cdot q - R \\ & = z_0 \cdot q^2 - R(q + 1) \\ \\ z_3 & = z_2 \cdot q - R \\ & = \left( z_0 \cdot q^2 - R(q + 1) \right) q - R \\ & = z_0 \cdot q^3 - R (q+1)q - R \\ & = z_0 \cdot q^3 - R\cdot (q^2+q) - R \\ & = z_0 \cdot q^3 - R\cdot (q^2 + q + 1) \end{split} $$
$$ \vdots $$
we can write
$$ z_n = N \cdot q^n - R \cdot (q^{n-1} + q^n + \ldots + q + 1) $$
where the factor $$q^{n-1} + q^n + \ldots + q + 1$$ is a geometric series.
Since the final balance (at step n) is 0, we have:
$$z_n = 0 = N \cdot q^n - R \cdot \frac{q^n-1}{q-1}\\$$
from which the formula for the payment follows $$\boxed{R = N \cdot q^n \cdot \frac{q-1}{q^n-1}} $$ $$R = c + I$$
The principal part can be computed as the difference between successive balances
$$ c_0=0 $$
$$ c_1=z_0-z_1 $$
$$ \vdots $$
$$ c_l=z_{l-1} - z_l $$
and, using the formula for z_n, we have
$$ c_l = z_{l-1} - z_l $$
$$ \big\Downarrow $$
$$ \begin{split} c_l & = N\cdot q^{l-1}-R\frac{q^{l-1}-1}{q-1} - \left( N\cdot q^l-R\frac{q^l-1}{q-1} \right) \\ & = N\cdot (q^{l-1} - q^l)-R\cdot (\frac{q^{l-1}-1}{q-1} - \frac{q^l-1}{q-1}) \\ & = N\cdot (q^{l-1}-q^l) - R\cdot (\frac{q^{l-1}-q^l}{q-1}) \\ & = (q^{l-1}-q^l)\cdot (N - R\cdot \frac{1}{q-1}) \\ \end{split} $$
Substituting R gives
$$ \begin{split} c_l &= (q^{l-1}-q^l)\cdot \big(N - (\frac{N\cdot q^n\cdot(q-1)}{q^n-1}\cdot\frac{1}{q-1}) \big) \\ & = (q^{l-1}-q^l)\cdot \big(N - (\frac{N\cdot q^n}{q^n-1}) \big) \\ & = (q^{l-1}-q^l)\cdot \big( N \cdot (1 - \frac{q^n}{q^n-1} ) \big) \\ & = N\cdot(q^{l-1}-q^l)\cdot \big( \frac{-1}{q^n-1} \big) \\ \end{split} $$
Finally, the principal and interest parts of payment R in month l are
$$ \boxed{c_l = N\cdot\frac{q^l - q^{l-1}}{q^n-1}}\\ $$
$$ \boxed{I_l = R - c_l} $$
$$ \rule{2cm}{0.4pt} $$
Repayment period after an overpayment
Assuming a one-off overpayment while keeping the payment amount unchanged, how long does it take to repay the loan?
N' - loan balance after the overpayment
R' = R - monthly payment
n' - number of months needed to repay N'
Starting from the payment formula we can solve for n'
$$ R = R' = N' \cdot q^{n'} \cdot \frac{q-1}{q^{n'}-1} $$
$$ R\cdot(q^{n'}-1) = N'\cdot q^{n'}\cdot (q-1) \\ $$
rearranging for n'
$$ q^{n'} = \frac{R}{R - N'\cdot(q-1)} $$
$$ \boxed{ n' = \log_q{ \left[ \frac{R}{R - N' \cdot \left( q-1 \right) } \right] }} $$
For computation, using the identity
$$ \log_a b = \frac{\log_c b}{\log_c a} $$
we get
$$ n' = \ln{ \left[ \frac{R}{R - N' \cdot \left( q-1 \right)} \right] } \cdot \ln^{-1}{q} $$
$$ \rule{2cm}{0.4pt} $$
Written for przeliczrate.pl.