1% ================================================================
  2% MortgageLoanDerivation.tex
  3% ================================================================
  4%
  5%  Used as an example of how to write a short mathematical article.
  6
  7% ------------------------------------------ Initial Setup --------------------------------------
  8
  9%  Run the "Typeset" command twice in TexShop, otherwise you won't get the table of contents.
 10
 11\tracinglostchars=3  % Generate an error message if a UTF-8 character is not supported.
 12
 13
 14% ------------------------------ This document is an Article -------------------------------
 15
 16\documentclass{article}
 17
 18\author{ Sean E. O'Connor}
 19\title{Mortgage Loan Derivation}
 20
 21
 22% ------------------------ Packages for theorems et. al., tables, hyperlinks --------------------------------------
 23% For more packages, see  https://www.ctan.org/
 24
 25\usepackage{amssymb}  % American Mathematical Society math symbols. https://www.ams.org/arc/resources/amslatex-about.html
 26
 27\usepackage{amsthm}     % Help in writing theorems:  https://www.ams.org/arc/tex/amscls/amsthdoc.pdf
 28
 29% Define styles for lemmas, theorems, definitions, remarks.
 30
 31\newtheorem{lemma}{Lemma}[section]  % variable name, caption, section number.
 32\theoremstyle{definition} % Bold title, Roman text body.
 33
 34\newtheorem{theorem}{Theorem}[section]
 35\theoremstyle{definition} % Bold title, Roman body.
 36\RenewDocumentCommand{ \qedsymbol }{}{ \(\blacksquare\)  }  % Redefine the Q.E.D. symbol as a mathematical black square.
 37
 38\newtheorem{remark}{Remark}
 39\theoremstyle{remark} % Italic title, Roman body.
 40
 41% Tables of good quality: https://ctan.mirrors.hoobly.com/macros/latex/contrib/booktabs/booktabs.pdf
 42
 43\usepackage{booktabs}
 44
 45% Hyperlinks:  https://ctan.math.illinois.edu/macros/latex/contrib/hyperref/doc/hyperref-doc.html
 46
 47\usepackage[
 48  colorlinks
 49]{hyperref} % Hyperlinks.  This must be the last package loaded.
 50
 51\hypersetup{   % Which colors to use.
 52   urlcolor=red,
 53   citecolor=purple,
 54   linkcolor=blue
 55 }
 56  
 57% ----------------- Document begins:  title, abstract, table of contents --------------------
 58
 59\begin{document}
 60
 61\maketitle
 62
 63\begin{abstract}
 64We derive the equations for a \emph{mortgage} loan and give several useful formulas
 65\footnote{I'm using \LaTeX and \TeX Shop.  See \url{https://www.ctan.org}. See source code for more documentation.} 
 66\end{abstract} 
 67
 68\tableofcontents
 69
 70% ------------------------------------------ First section begins --------------------------------------
 71
 72\pagebreak 
 73
 74\section{The Repayment Structure of a Mortgage Loan}
 75
 76\subsection{Definition of Interest Rate}
 77
 78The interest rate on the loan note is quoted as a yearly amount but is applied periodically for $m$ periods per year, giving
 79
 80\begin{equation}
 81i =  {{Annual  \: interest    \:  percent / 100} \over m}
 82\end{equation}
 83
 84Most house and car loans have a monthly period, $m = 12$.    % Inline math can use dollar sign delimiters like MathJax
 85
 86\emph{NOTE:}  This is NOT the APR, which is the interest percentage as if the loan were compounded yearly instead of monthly.  I would ignore the APR.
 87
 88\subsection{Periodic Payments of Principal + Interest}
 89
 90The $j^{th}$ payment PMT consists of interest $I_j$ on the previous unpaid balance $BAL_{j-1}$
 91
 92This payment is a fixed amount every month by design.
 93
 94Only the remainder of the payment after interest  $R_j$ actually reduces the principal of the loan.
 95
 96Payments from the initial payment to the end payment have the form,
 97
 98\bigskip % Put extra line space before and after the table.
 99
100\begin{tabular}{ clll }
101\toprule
102Payment Number & Payment Amount  & Interest & Balance \\
103\midrule
104${1^{st}}$   &   $PMT = R_1 + I_1$   &   $I_1 = i \: BAL_0$   &  $BAL_1 = BAL_0 - R_1$  \\
105$2^{nd}$    &   $PMT = R_2 + I_2$   &  $I_2 = i \: BAL_1 $   & $BAL_2 = BAL_1 - R_2$ \\
106\ldots & \ldots & \ldots & \ldots \\
107$j^{th}$      &  $PMT = R_j + I_j$      & $I_j = i \: BAL_{j-1}$  &  $BAL_j = BAL_{j-1} - R_j$ \\
108\ldots & \ldots & \ldots & \ldots \\
109$n^{th}$      &  $PMT = R_n + I_n$  & $I_n = i \: BAL_{n-1}$ &  $BAL_n= BAL_{n-1} - R_n = 0 $ \\
110\bottomrule
111\end{tabular}
112
113\bigskip
114
115n = the number of periods of the loan
116
117\begin{remark}
118The loan amount is $PV = BAL_0$ which is the original balance before any payments are made.
119\end{remark}
120
121\begin{remark}
122The last balance is 0 because the loan is paid off, $BAL_n = 0$.
123\end{remark}
124
125We could write an Excel, Perl or Python script to compute this, but there are closed form solutions as we'll show.
126
127\pagebreak 
128
129\section{Closed Form Solution}
130
131\subsection{Difference Equation}
132
133Substituting we get a difference equation for the balances in terms of interest i and constant periodic payment PMT,
134
135\begin{equation}
136BAL_j = BAL_{j-1} - PMT + I_j
137\end{equation}
138
139\begin{equation}
140BAL_j = BAL_{j-1} - PMT + i BAL_{j-1}
141\end{equation}
142
143\begin{equation}
144BAL_j = (1+i) BAL_{j-1} - PMT
145\end{equation}
146
147Let's solve this difference equation.  But first, some lemmas,
148
149\begin{lemma}{}
150The geometric progression
151
152\begin{equation}
153g = 1 +  b + b^2 + \ldots + b^{n-1}
154\end{equation}
155
156has the formula,
157
158\begin{equation}
159g = {{1 - b^n} \over {1 - b}}
160\end{equation}
161
162\end{lemma}
163
164\begin{proof}
165
166Multiply by b and subtract,
167
168\begin{equation}
169g - b g = g(1 - b) = \left( 1 +  b + b^2 + \ldots + b^{n-1}  \right) - \left( b +  b^2 + b^3 + \ldots + b^n \right) = 1 - b^n
170\end{equation}
171
172to get
173
174\begin{equation}
175g = {{1 - b^n} \over {1 - b}}
176\end{equation}
177
178\end{proof}
179
180\begin{lemma}{}
181 If
182
183\begin{equation}
184u_k = a + b u_{k-1}
185\end{equation}
186
187then 
188
189\begin{equation}
190u_n = a {1 - b^n  \over 1-b } + b^n u_0
191\end{equation}
192
193\end{lemma}
194
195\begin{proof}   Expand out terms to see the pattern and use mathematical induction if you like,
196
197\begin{equation}
198u_1 = a  + b u_0
199\end{equation}
200
201\begin{equation}
202u_2 = a  + b u_1 = a + b(a + b u_0) = a (1 +  b) + b^2 u_0
203\end{equation}
204
205\begin{equation}
206u_3 = a  + b u_2 = a + b [ (1+b) + b^2 u_0] = a (1 +  b + b^2) + b^3 u_0
207\end{equation}
208
209The general formula is
210
211\begin{equation}
212u_n = a (1 +  b + b^2 + \ldots + b^{n-1}) + b^n u_0
213\end{equation}
214
215Now use the geometric progression lemma above.
216
217\end{proof}
218
219\subsection{Closed Form Solution for $BAL_k$}
220
221To solve the balance difference equation let $u_k = BAL_k$, $a = -PMT$, and $b = i+1$
222
223The balance AFTER payment k is then
224
225\begin{equation}
226BAL_k = {(-PMT) {1 - (1+i)^k \over 1 - (1+i) } + (1+i)^k BAL_0}
227\end{equation}
228
229rearranging,
230
231\begin{equation}
232BAL_k =  {1 \over  (1+i)^{-k} }   \left(  PV + PMT  { (1+i)^{-k} -1 \over i }   \right)
233\end{equation}
234
235Now set $BAL_n = 0$ because the last nth payment PMT finishes the mortgage.
236Check:  $BAL_0 = PV$
237
238\pagebreak 
239
240\section{Other Useful Closed Form Solutions}
241
242\subsection{Periodic Payment PMT From PV, n and i}
243
244The constant periodic payment is then
245
246\begin{equation}
247PMT =  {i PV \over  1-(1+i)^{-n}} 
248\end{equation}
249
250\subsection{Number of Periods n from PV, i and PMT}
251
252The number of periods (months) comes from the loan amount PV and the periodic payment PMT after inverting,
253
254\begin{equation}
255n = -{ ln \left(     {1 - i {PV \over PMT}}    \right) \over { ln( 1 + i ) } }
256\end{equation}
257
258where we're using the natural logarithm, but any log will work.
259
260\subsection{Reduced Number of Periods $n'$ from Increasing the PMT}
261
262You can use this to determine the reduced number of periods if you prepay principal.  Change $PMT$ to $(PMT + additional\:  principal \: prepayment)$
263
264\begin{equation}
265n' = -{ ln \left(     {1 - i {PV \over {PMT + additional\:  principal \: prepayment}}}       \right) \over { ln( 1 + i ) } }
266\end{equation}
267
268\subsection{Equivalent Simple Interest $i'$}
269
270Equivalent simple interest $i'$ on the loan is how much interest would have been had it been payable up front immediately.
271
272We use this formula to deduce it,
273
274\begin{equation}
275PV + i' PV = n PMT
276\end{equation}
277
278Equivalent simple interest is then
279
280\begin{equation}
281i' =  {n i \over  1-(1+i)^{-n}} -1
282\end{equation}
283
284\subsection{Accumulated Interest Payments j though k}
285
286What is the accumulated interest for payments j though k inclusive?
287
288\begin{equation}
289Int_{j \rightarrow k} = I_j + \ldots + I_k
290\end{equation}
291
292\begin{equation}
293Int_{j \rightarrow k} = \left( k - j + 1 \right) PMT - \sum_{l=j}^k R_l
294\end{equation}
295
296but
297
298\begin{equation}
299BAL_l - BAL_{l-1} = -R_l
300\end{equation}
301
302We get a telescoping sum
303
304\begin{equation}
305- \sum_{l=j}^k R_l = BAL_k - BAL_{j-1}
306\end{equation}
307
308Interest AFTER the kth payment is
309
310\begin{equation}
311Int_{1 \rightarrow k}  = k PMT + BAL_k - PV
312\end{equation}
313
314Check:  When $k=n$,
315
316\begin{equation}
317Int_{1 \rightarrow n}  = n PMT + BAL_n - PV = n PMT - PV
318\end{equation}
319
320as expected because the total n payments of PMT include repaying PV plus interest.
321
322\end{document}