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\end{abstract} 
 66
 67\footnote{I'm using \LaTeX and \TeX Shop.  See \url{https://www.ctan.org}. See source code for more documentation.} 
 68
 69\tableofcontents
 70
 71\bigskip % Put extra line space after the contents.
 72
 73% ------------------------------------------ First section begins --------------------------------------
 74
 75\pagebreak 
 76
 77\section{The Repayment Structure of a Mortgage Loan}
 78
 79\subsection{Definition of Interest Rate}
 80
 81The interest rate on the loan note is quoted as a yearly amount but is applied periodically for $m$ periods per year, giving
 82
 83\begin{equation}
 84i =  {{Annual  \: interest    \:  percent / 100} \over m}
 85\end{equation}
 86
 87Most house and car loans have a monthly period, $m = 12$.    % Inline math can use dollar sign delimiters like MathJax
 88
 89\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.
 90
 91\subsection{Periodic Payments of Principal + Interest}
 92
 93The $j^{th}$ payment PMT consists of interest $I_j$ on the previous unpaid balance $BAL_{j-1}$
 94
 95This payment is a fixed amount every month by design.
 96
 97Only the remainder of the payment after interest  $R_j$ actually reduces the principal of the loan.
 98
 99Payments from the initial payment to the end payment have the form,
100
101\bigskip % Put extra line space before and after the table.
102
103\begin{tabular}{ clll }
104\toprule
105Payment Number & Payment Amount  & Interest & Balance \\
106\midrule
107${1^{st}}$   &   $PMT = R_1 + I_1$   &   $I_1 = i \: BAL_0$   &  $BAL_1 = BAL_0 - R_1$  \\
108$2^{nd}$    &   $PMT = R_2 + I_2$   &  $I_2 = i \: BAL_1 $   & $BAL_2 = BAL_1 - R_2$ \\
109\ldots & \ldots & \ldots & \ldots \\
110$j^{th}$      &  $PMT = R_j + I_j$      & $I_j = i \: BAL_{j-1}$  &  $BAL_j = BAL_{j-1} - R_j$ \\
111\ldots & \ldots & \ldots & \ldots \\
112$n^{th}$      &  $PMT = R_n + I_n$  & $I_n = i \: BAL_{n-1}$ &  $BAL_n= BAL_{n-1} - R_n = 0 $ \\
113\bottomrule
114\end{tabular}
115
116\bigskip
117
118n = the number of periods of the loan
119
120\begin{remark}
121The loan amount is $PV = BAL_0$ which is the original balance before any payments are made.
122\end{remark}
123
124\begin{remark}
125The last balance is 0 because the loan is paid off, $BAL_n = 0$.
126\end{remark}
127
128We could write an Excel, Perl or Python script to compute this, but there are closed form solutions as we'll show.
129
130\pagebreak 
131
132\section{Closed Form Solution}
133
134\subsection{Difference Equation}
135
136Substituting we get a difference equation for the balances in terms of interest i and constant periodic payment PMT,
137
138\begin{equation}
139BAL_j = BAL_{j-1} - PMT + I_j
140\end{equation}
141
142\begin{equation}
143BAL_j = BAL_{j-1} - PMT + i BAL_{j-1}
144\end{equation}
145
146\begin{equation}
147BAL_j = (1+i) BAL_{j-1} - PMT
148\end{equation}
149
150Let's solve this difference equation.  But first, some lemmas,
151
152\begin{lemma}{}
153The geometric progression
154
155\begin{equation}
156g = 1 +  b + b^2 + \ldots + b^{n-1}
157\end{equation}
158
159has the formula,
160
161\begin{equation}
162g = {{1 - b^n} \over {1 - b}}
163\end{equation}
164
165\end{lemma}
166
167\begin{proof}
168
169Multiply by b and subtract,
170
171\begin{equation}
172g - 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
173\end{equation}
174
175to get
176
177\begin{equation}
178g = {{1 - b^n} \over {1 - b}}
179\end{equation}
180
181\end{proof}
182
183\begin{lemma}{}
184 If
185
186\begin{equation}
187u_k = a + b u_{k-1}
188\end{equation}
189
190then 
191
192\begin{equation}
193u_n = a {1 - b^n  \over 1-b } + b^n u_0
194\end{equation}
195
196\end{lemma}
197
198\begin{proof}   Expand out terms to see the pattern and use mathematical induction if you like,
199
200\begin{equation}
201u_1 = a  + b u_0
202\end{equation}
203
204\begin{equation}
205u_2 = a  + b u_1 = a + b(a + b u_0) = a (1 +  b) + b^2 u_0
206\end{equation}
207
208\begin{equation}
209u_3 = a  + b u_2 = a + b [ (1+b) + b^2 u_0] = a (1 +  b + b^2) + b^3 u_0
210\end{equation}
211
212The general formula is
213
214\begin{equation}
215u_n = a (1 +  b + b^2 + \ldots + b^{n-1}) + b^n u_0
216\end{equation}
217
218Now use the geometric progression lemma above.
219
220\end{proof}
221
222\subsection{Closed Form Solution for $BAL_k$}
223
224To solve the balance difference equation let $u_k = BAL_k$, $a = -PMT$, and $b = i+1$
225
226The balance AFTER payment k is then
227
228\begin{equation}
229BAL_k = {(-PMT) {1 - (1+i)^k \over 1 - (1+i) } + (1+i)^k BAL_0}
230\end{equation}
231
232rearranging,
233
234\begin{equation}
235BAL_k =  {1 \over  (1+i)^{-k} }   \left(  PV + PMT  { (1+i)^{-k} -1 \over i }   \right)
236\end{equation}
237
238Now set $BAL_n = 0$ because the last nth payment PMT finishes the mortgage.
239Check:  $BAL_0 = PV$
240
241\pagebreak 
242
243\section{Other Useful Closed Form Solutions}
244
245\subsection{Periodic Payment PMT From PV, n and i}
246
247The constant periodic payment is then
248
249\begin{equation}
250PMT =  {i PV \over  1-(1+i)^{-n}} 
251\end{equation}
252
253\subsection{Number of Periods n from PV, i and PMT}
254
255The number of periods (months) comes from the loan amount PV and the periodic payment PMT after inverting,
256
257\begin{equation}
258n = -{ ln \left(     {1 - i {PV \over PMT}}    \right) \over { ln( 1 + i ) } }
259\end{equation}
260
261where we're using the natural logarithm, but any log will work.
262
263\subsection{Reduced Number of Periods $n'$ from Increasing the PMT}
264
265You can use this to determine the reduced number of periods if you prepay principal.  Change $PMT$ to $(PMT + additional\:  principal \: prepayment)$
266
267\begin{equation}
268n' = -{ ln \left(     {1 - i {PV \over {PMT + additional\:  principal \: prepayment}}}       \right) \over { ln( 1 + i ) } }
269\end{equation}
270
271\subsection{Equivalent Simple Interest $i'$}
272
273Equivalent simple interest $i'$ on the loan is how much interest would have been had it been payable up front immediately.
274
275We use this formula to deduce it,
276
277\begin{equation}
278PV + i' PV = n PMT
279\end{equation}
280
281Equivalent simple interest is then
282
283\begin{equation}
284i' =  {n i \over  1-(1+i)^{-n}} -1
285\end{equation}
286
287\subsection{Accumulated Interest Payments j though k}
288
289What is the accumulated interest for payments j though k inclusive?
290
291\begin{equation}
292Int_{j \rightarrow k} = I_j + \ldots + I_k
293\end{equation}
294
295\begin{equation}
296Int_{j \rightarrow k} = \left( k - j + 1 \right) PMT - \sum_{l=j}^k R_l
297\end{equation}
298
299but
300
301\begin{equation}
302BAL_l - BAL_{l-1} = -R_l
303\end{equation}
304
305We get a telescoping sum
306
307\begin{equation}
308- \sum_{l=j}^k R_l = BAL_k - BAL_{j-1}
309\end{equation}
310
311Interest AFTER the kth payment is
312
313\begin{equation}
314Int_{1 \rightarrow k}  = k PMT + BAL_k - PV
315\end{equation}
316
317Check:  When $k=n$,
318
319\begin{equation}
320Int_{1 \rightarrow n}  = n PMT + BAL_n - PV = n PMT - PV
321\end{equation}
322
323as expected because the total n payments of PMT include repaying PV plus interest.
324
325\end{document}