Mortgage Math

1 min read Original article ↗

Input

p := Original Principal amount
apr := Annual Percentage Rate
t := Number of years of loan

Calcuation:

r := apr/100/12                    # monthly interest rate
n := 12 * t                        # number of monthly payments

c(x) := 1 - (1 + r)^(-x)

m := p*r/c(n)                      # monthly payment

balance(i) := p*c(n-i)/c(n)        # balance at the end of the ith month

principal(i) := balance(i-1) - balance(i)    # principal part of the ith monthly loan payment
interest(i)  := m - principal(i)             # interest part of the ith month loan payment