Monthly mortgage payment
The formula of the monthly mortgage payments for a fixed-rate loan can be found online as \begin{equation} M = P\frac{r(1+r)^n}{(1+r)^n-1}\,,\tag{1}\end{equation} where $M$ is the mortgage payment. $P$ is the principal, i.e., the initial amount borrowed. $r$ is the monthly interest rate. For annual interest rate $2.5\%$, $r=2.5\% / 12$. $n$ is the number of payments. For 30-years fixed rate mortgage, $n=30 * 12 = 360$. Here we provide a derivation of the above formula. Let $b_i$ be the owned balance in the $i$-th month. Initially, $b_0=P$ and we choose the constant monthly payment $M$ such that $b_n=0$. We then have the recursion relation between two consecutive month as \begin{equation}b_{i+1}=b_i(1+r) - M\,.\tag{2}\end{equation} A trick to solve (2) is to write Eq. (2) into the following form \begin{equation}b_{i+1}+C = \left(b_i+C\right)(1+r)\,,\tag{3}\end{equation} so that $b_i+C$ is a geometric sequence: \begin{equation}b_i + C = (b_0 + C) (1+r)^i\,.\end{eq...