Elementary Financial Mathematics

This document provides an overview of Mathematics implemented by the loan calculator library.

PMT

Let \(s\) be the principal, \(d\) the daily interest rate and \(n_i\) the number of days since the principal was granted until the due date of the \(i\)-th payment, for \(i,1\leq i\leq k\). We want to determine the so called PMT of these parameters, i.e., the due payment value which completely pays the principal if made in the expected dates and considered under the daily interest rate.

Let \(P\) denote the PMT value. Brought to present value using the daily interest rate, the \(k\) payments should exactly meet the principal. Then

\[\frac{P}{(1+d)^{n_1}} + \frac{P}{(1+d)^{n_2}} + \cdots + \frac{P}{(1+d)^{n_k}} = s\]

and it follows that

\[P\ \sum_{i=1}^k \frac{1}{(1+d)^{n_i}} = s.\]

Therefore, the PMT can be defined as

\[\mathrm{PMT}(s,d,(n_1,\ldots,n_k)) := \frac{s}{\displaystyle\sum_{i=1}^k \frac{1}{(1+d)^{n_i}}}.\]

Converting interest rates

The mathematics for converting aliquots between two different interest rates is fairly simple. In fact, let \(s\) be a semiannual interest rate and let us assume a year has 365 days (this convention is also called as “commercial year”. There is also the “banker year”, with 360 days). If \(d_s\) is the equivalent daily interest rate, applying \(d_s\) 365 to an amount produces as much capital as the semiannual rate \(s\) applied twice over the same initial amount, i.e.,

\[(1 + d_s)^{365} = (1 + s)^2\]

from which follows that

\[d_s = (1 + s)^{\frac{2}{365}} - 1.\]

The conversion expression for monthly and quarterly rate can be obtained in an analogue manner: for a monthly interest rate \(m\), the equivalent daily interest rate \(d_m\) is given by

\[d_m = (1 + m)^\frac{12}{365} - 1\]

and for a quarterly interest rate \(q\), the equivalent daily interest rate \(d_q\) is given by

\[d_q = (1 + q)^\frac{4}{365} - 1.\]

Amortization Schedules

After a loan is granted, it must be continuously paid over time until it is considered to be fully paid. The total amount of money the borrower returns must be exactly the summed amounts of the loan’s principal and interest. Thus, each payment the borrower performs must be properly split into principal and interest portions in such a way that, after all payments are performed, neither principal or interest remain. The schedule according to which a loan is paid is called an amortization schedule.

Let \(s\) be the principal, \(d\) the daily interest rate and \(n_i\) the number of days since the loan started until the due date of the \(i\)-th payment. An amortization schedule must describe

  • a sequence of payments \(P_1,P_2,\ldots,P_k\).
  • a sequence of partitions \((A_1,J_1),(A_2,J_2),\ldots,(A_k,J_k)\) of \(P_1,P_2,\ldots,P_k\), respectively, where
    • \(A_i\) is the portion of \(P_i\) used as principal amortization,
    • \(J_i\) is the portion of \(P_i\) used as interest payment, and
    • \(P_i = A_i + J_i\), for all \(i,1\leq i\leq k\),

and these are such that

\[\sum_{i=1}^k A_i = s\]

holds. From the partitions and the sequence of payments one can define the balance after each payment by

\[\begin{split}\left\{ \begin{aligned} b_i &:= b_{i-1}\ (1+d)^{n_i-n_{i-1}} - P_i, \ \mathrm{for}\ i,1\leq i\leq k,\ \mathrm{and}\\ b_0 &:= s \end{aligned} \right..\end{split}\]

Regressive Price Schedule. All the payments have the same value and it is given by the PMT of the schedule parameters. The amortizations are then defined as the PMT’s present values, considering it can be brought back to the start date according to the loan’s daily interest rate. The interest due to each payment is then defined as the difference between the PMT and the associated amortization. Therefore, the payments, amortization and interest are defined by

  • \(P := \mathrm{PMT}(s,d,(n_1,\ldots,n_k)) = \displaystyle\frac{s}{\sum_{j=1}^k \frac{1}{(1+d)^{n_j}}}, \ \ \mathrm{for\ all}\ i,1\leq i\leq k\),
  • \(A_i := P\ \displaystyle\frac{1}{(1+d)^{n_i}}, \ \ \mathrm{for\ all}\ i,1\leq i\leq k\),
  • \(J_i := P\ (1 - \displaystyle\frac{1}{(1+d)^{n_i}}), \ \ \mathrm{for\ all}\ i,1\leq i\leq k\),

respectively, for all \(i,1\leq i\leq k\).

This schedule is said to be “regressive” since it yields a decreasing sequence of amortizations.

For example, consider a principal of R$ \(8530.20\), with interest rate of \(0.0985\%\) per day (which yields around \(3\%\) every \(30\) days) and paid with \(10\) instalments. Suppose payments should be made every 30 days. The regressive Price schedule of such a loan is presented in the table below.

# days balance amortization interest payment
0 0 8530.20      
1 30 7786.11 970.87 29.13 1000.00
2 60 7019.69 942.60 57.40 1000.00
3 90 6230.28 915.14 84.86 1000.00
4 120 5417.19 888.49 111.51 1000.00
5 150 4579.71 862.61 137.39 1000.00
6 180 3717.10 837.48 162.52 1000.00
7 210 2828.61 813.09 186.91 1000.00
8 240 1913.47 789.41 210.59 1000.00
9 270 970.87 766.42 233.58 1000.00
10 300 0.00 744.09 255.91 1000.00
EOL     8530.20 1469.80 10000.00

Progressive Price Schedule. As in the regressive Price schedule, all the payments are given by the PMT of the schedule parameters, but the sequence of amortizations and interests are reversed and therefore the amortizations form an increasing sequence, hence the name “progressive”. The sequences of amortizations and interests are given by

  • \(A_i = P\ \displaystyle\frac{1}{(1+d)^{n_{k-i+1}}}, \ \mathrm{for\ all}\ i,1\leq i\leq k\),
  • \(J_i = P\ (1 - \displaystyle\frac{1}{(1+d)^{n_{k-i+1}}}), \ \mathrm{for\ all}\ i,1\leq i\leq k\),

respectively.

For example, consider a principal of R$ \(8530.20\), with interest rate of \(0.0985\%\) per day (which yields around \(3\%\) every \(30\) days) and paid with \(10\) instalments. Suppose payments should be made every 30 days. The progressive Price schedule of such a loan is presented in the table below.

# days balance amortization interest payment
0 0 8530.20      
1 30 7786.11 744.09 255.91 1000.00
2 60 7019.69 766.42 233.58 1000.00
3 90 6230.28 789.41 210.59 1000.00
4 120 5417.19 813.09 186.91 1000.00
5 150 4579.71 837.48 162.52 1000.00
6 180 3717.10 862.61 137.39 1000.00
7 210 2828.61 888.49 111.51 1000.00
8 240 1913.47 915.14 84.86 1000.00
9 270 970.87 942.60 57.40 1000.00
10 300 0.00 970.87 29.13 1000.00
EOL     8530.20 1469.80 10000.00

Constant Amortization Schedule. As the name implies, all amortizations are taken so to have the same value, which is obtained by equally dividing the principal into \(k\) parts. The interest of each period is calculated over the last remaining balance, and this is added to the amortization to compound the due payment. These are given by

  • \(J_i := S(1 - \displaystyle\frac{i-1}{k})((1+d)^{n_i-n_{i-1}} - 1), \ \mathrm{for\ all}\ i,1\leq i\leq k\),
  • \(A_i := \displaystyle\frac{S}{k}, \ \mathrm{for\ all}\ i,1\leq i\leq k\),

respectively. Note that the payments form a decreasing sequence, since the interest part of each payment is calculate over an ever decreasing balance. Moreover the balance decreases at a constant rate, due to the constant amortization.

For example, consider a principal of R$ \(800.00\), with interest rate of \(1,979\%\) per day (which yields around \(80\%\) every \(30\) days) and paid with \(10\) instalments. Suppose payments should be made every 30 days. The constant amortization schedule of such a loan is presented in the table below.

# days balance amortization interest payment
0 0 800.00      
1 30 640.00 160.00 640.00 800.00
2 60 480.00 160.00 512.00 672.00
3 90 320.00 160.00 384.00 544.00
4 120 160.00 160.00 256.00 416.00
5 150 0.00 160.00 128.00 288.00
EOL     800.00 1920.00 2720.00

Grossup

The grossup consists of including due taxes and service fee into a given principal augmenting it so its resulting net value equals the originally provided principal. We can also think of the grossed up principal as the financed value: in onder to grant a loan whose net value exactly matches the amount demanded by the borrower, it is necessary to finance a greater amount comprehending services fees and due taxes.

It seems fairly reasonable to assume the service fee is simply an aliquot applied over the principal so, if \(s\) is the principal and \(\gamma\) is the service fee aliquot, then the service fee is given by \(\gamma s\). On the other hand, it is hard to pin down a reasonable and generic expression for due taxes, since they are very context bound and their rules might be revised as laws are amended. Therefore, loans being granted in different contexts will have their principals grossed up by different amounts.

Let us examine the particular case of loans being granted by Brazilian financial institutions to a natural person. This is ruled by the law-decree n. 6306, dating December 14th, 2007, for which the relevant parts are copied and translated below. The amended text can be checked out here.


TÍTULO I

DA INCIDÊNCIA

Art. 2o O IOF incide sobre:

I - operações de crédito realizadas:

  1. por instituições financeiras (Lei no 5.143, de 20 de outubro de 1966, art. 1o);
  1. entre pessoas jurídicas ou entre pessoa jurídica e pessoa física (Lei no 9.779, de 19 de janeiro de 1999, art. 13);

This excerpt defines our study case as being affected by the IOF law. It says “The IOF affects I - credit operations performed by a) financial institutions (…) c) between natural persons or a jurisdictional person and a natural person.


TÍTULO II

DA INCIDÊNCIA SOBRE OPERAÇÕES DE CRÉDITO

CAPÍTULO I

DO FATO GERADOR

Art. 3o O fato gerador do IOF é a entrega do montante ou do valor que constitua o objeto da obrigação, ou sua colocação à disposição do interessado (Lei no 5.172, de 1966, art. 63, inciso I).

§ 1o Entende-se ocorrido o fato gerador e devido o IOF sobre operação de crédito:

I - na data da efetiva entrega, total ou parcial, do valor que constitua o objeto da obrigação ou sua colocação à disposição do interessado;

This defines the taxable event (fato gerador) as happening at the date where the amount constituting the object of obligation is delivered or made available to the borrowing part.


CAPÍTULO II

DOS CONTRIBUINTES E DOS RESPONSÁVEIS

Dos Contribuintes

Art. 4o Contribuintes do IOF são as pessoas físicas ou jurídicas tomadoras de crédito (Lei no 8.894, de 1994, art. 3o, inciso I, e Lei no 9.532, de 1997, art. 58).

(…)

Dos Responsáveis

Art. 5o São responsáveis pela cobrança do IOF e pelo seu recolhimento ao Tesouro Nacional:

I - as instituições financeiras que efetuarem operações de crédito (Decreto-Lei nº 1.783, de 1980, art. 3º, inciso I);

This excerpt defines the jurisdictional or natural person borrowing money as the taxpayer for the IOF, and the financial institution providing credit as accountable for collecting the tax and delivering it to the national treasure.


CAPÍTULO III

DA BASE DE CÁLCULO E DA ALÍQUOTA

Da Alíquota

Art. 6o O IOF será cobrado à alíquota máxima de um vírgula cinco por cento ao dia sobre o valor das operações de crédito (Lei no 8.894, de 1994, art. 1o).

Da Base de Cálculo e das Alíquotas Reduzidas

Art. 7o A base de cálculo e respectiva alíquota reduzida do IOF são (Lei no 8.894, de 1994, art. 1o, parágrafo único, e Lei no 5.172, de 1966, art. 64, inciso I):

I - na operação de empréstimo, sob qualquer modalidade, inclusive abertura de crédito:

(…)

b) quando ficar definido o valor do principal a ser utilizado pelo mutuário, a base de cálculo é o principal entregue ou colocado à sua disposição, ou quando previsto mais de um pagamento, o valor do principal de cada uma das parcelas:

  1. mutuário pessoa jurídica: 0,0041% ao dia;
  2. mutuário pessoa física: 0,0082% ao dia;

This is, perhaps, the most important excerpt since it defines the values of the aliquots and describes how to apply them. It states

  1. that the daily aliquot should not be greater than 1.5%,

  2. that whenever the loan’s principal is well defined (which is our case), the calculation basis is the principal (or the amortization) of each instalment, the aliquot being 0.0082% per day. Therefore, if the \(i\)-th instalment has amortization \(A_i\) and is expected to be paid \(n_i\) days after the taxable event, then due amount of IOF is given by

    \[A_i\ \min(n_i \ 0.000082, 0.015)\]

A last excerpt defines a complementary aliquot to be applied on the principal:

§ 15. Sem prejuízo do disposto no caput, o IOF incide sobre as operações de crédito à alíquota adicional de trinta e oito centésimos por cento, independentemente do prazo da operação, seja o mutuário pessoa física ou pessoa jurídica. (Incluído pelo Decreto nº 6.339, de 2008).

It says that “(…) the IOF is applied on credit operations at the aliquot of thirty eight hundredths per cent regardless of how much time the operation lasts, be the borrower a natural or jurisdictional person”. Therefore, if \(s\) is the principal, the due complementary IOF is given by

\[s\ 0.0038.\]

Putting all the pieces together, we arrive at the equation below

\[s - \sum_{i=1}^k A_i \min(n_i\ 0.0038, 0.015) - s\ 0.0038 - \gamma s = s_\circ\]

where \(s\) is the grossed up principal, \(A_1,A_2,\ldots,A_k\) are the amortizations, \(\gamma\) is the sevice fee aliquot and \(s_\circ\) is the net principal. Therefore, solving the grossup problem for this specific scenario, means solving the equation above on \(s\).

Internal Return Rate

The internal return rate is the effective rate at which the net principal is grows in order to exactly match the sum of the due returns. The IRR is the actual “interest rate” from the point of view of a borrower, who receives the net principal but will have to pay off its grossed up value.

Let \(r_1, r_2,\ldots ,r_k\) be the expected returns that will pay off the grossed up principal, \(n_1, n_2,\ldots, n_k\) the number of days since the loan was granted until each expected return. If \(s_\circ\) is the net principal, the IRR \(c\) is defined as the least positive real solution of the equation

\[s_\circ (1 + c)^{n_k} - \sum_{i=1}^k r_i (1 + c)^{n_k - n_i} = 0.\]

Note that this is an algebraic equation on the unknown \(1 + c\). Let \(X = 1 + c\) and \(f(X)\) be the polynomial

\[f(X) = s_\circ X^{n_k} - r_1 X^{n_k - n_1} - r_2 X^{n_k - n_2} - \cdots - r_k.\]

Therefore, to approximate the IRR is equivalent to approximate a positive real root of \(f(X)\). In this library, this is achieved by a Newton-Raphson based solver, which is a natural choice since it is easy to evaluate the derivative \(f^\prime (X)\) of \(f(X)\) and the loan’s daily interest rate can be adopted as starting point for the approximation as we know the IRR is a slightly greater aliquot.