by Julian M Bucknall

Back in a previous life, I used to write swaps and options software for traders and brokers. Of all my jobs, I’d have to say that writing this kind of software was practically the only one that utilized my mathematics degree to any great extent, which I must admit is kind of depressing in a way. You’d think that programming is all about mathematics but, in reality, not so much. Sure, understanding lambda calculus is all very well, but you tend not to have to use it in your day-to-day work. (My friend and colleague Seth Juarez is perhaps the only other person I know who regularly uses “proper” mathematics in his work: he’s a fan of machine learning, and you can get his open-source library here for C# and .NET.)

Anyway, the core of writing swaps software (or indeed any kind of financial software) is to understand the Time Value of Money (*TVM*). This is the mathematics behind the principle that money changes value with time. Applying TVM we can understand how mortgages works, how savings work, how car leases work, and any other kind of financial instrument that involves some kind of principal and interest and payments.

Here’s some examples where knowing TVM can help us understand the benefits or downsides of various financial transactions:

- I want to buy a house worth $250K. I can afford to put down 10% (or $25K) and the bank offers me a 30 year mortgage on the remainder at a rate of 5%. What would be my monthly payment? How about for a 15 year mortgage?
- Some banks offer a plan whereby you can pay half the payment every two weeks (to coincide with your salary payments should you also be paid every two weeks) so that you make two extra payments a year towards your principal. How much faster would you pay off the mortgage?
- I go into a car dealer and lease a car worth $20K. The dealer offers 36-month lease at $375 a month with a 50% residual. What’s the underlying interest rate?

All of these examples are TVM problems. Let’s go back to basics to understand how to make the required calculations; and when I say “basics”, they really are. You’ll be wondering what all the fuss is about.

Suppose I have a savings account that pays 2% per year (yes, I know, these days,that would be like a dream come true). I put in $100 today. How much would it be worth in one year’s time? The amount of interest I would make (*I*) would be equal to the principal (*P*) multiplied by the interest rate (*i*):

\[ I = P \times i \]

That means that at the end of the year I will have in my savings account that interest plus the original principal:

\[ P_1 = P_0(1 + i) \]

(Here I’m using subscripts to denote the point in time.) Let’s say I keep that total in my saving account another year. What do I have at the end of the second year? Same basic calculation:

\[ P_2 = P_1(1 + i) \]

Or, since we know what the principal at the end of the first year is:

\[ P_2 = P_0(1 + i)(1 + i) \]

Which is:

\[ P_2 = P_0(1 + i)^2 \]

I’m sure that you can quite quickly see what the value of my original principal would be at the end of *N* years:

\[ P_N = P_0(1 + i)^N \]

Plugging in our example values, we see that our original $100 would be worth $102 at the end of the first year, $104.04 at the end of the second, $106.12 at the end of the third, $108.24 at the end of the fourth, and so on. Notice that the interest we get is left in the savings account at the end of every year so that we can earn interest on the interest the following year: this is known as *compounding*. If we took out the interest earned at the end of the year and put it under our mattress, we’d just earn $2 of interest every year, so the growth of our principal would be:

- end of year 1: $102 ($100 in the savings account, $2 under the mattress),
- end of year 2: $104 ($100 in the savings account, $4 under the mattress),
- end of year 3: $106 ($100 in the savings account, $6 under the mattress),
- end of year 4: $108 ($100 in the savings account, $8 under the mattress),

and so on. This is known as *simple interest* – we don’t earn interest on the interest. We shall ignore simple interest since it’s not used in real life.

Sounds easy enough, so let’s introduce a couple of new terms: present value (*PV*) and future value (*FV*). The $100 I put in my savings account is the present value of my investment. The future value of that $100 after four years is $108.24. Another way of putting it is that the present value of $108.24 four years hence is $100 when using this savings account.

So what you may ask? The thing is, when you are evaluating several different strategies for investment or borrowing, you want to compare apples to apples. Comparing a present value to a future value is like comparing apples to oranges: they are not the same magnitudes. You want to either strictly compare PVs or FVs, but not mix them.

Let’s illustrate. Suppose I have the opportunity of using a savings account that pays 1% every six months. Which account should I choose? 2% every year, or 1% every six months? The present value of putting $100 into each account is well, just $100. So there’s no difference there. What about the future value? Let’s calculate the future value four years hence. In my original account, the FV is $108.24. In my new account, the FV is $108.29; I would earn $0.05 more. By comparing the FVs I can see that the second savings account is more attractive.

Another way of looking at it is to say, I want the FV of both accounts to be $100 in four years. What should I put into each account now (the PV) to get that FV? Rearranging the above formula to:

\[ P_0 = \frac {P_N} { (1 + i)^N } \]

we’ll need $92.38 in the first account, $92.35 in the second. Again, by comparing equivalent values (this time the PV), we see the second account is better, since we have to invest less money now.

This insight about PVs and FVs (that is, the time value of money) is, believe it or not, all you need for working out savings, loans, mortgages, and leases. We’ll explore how next time.

Loading links to posts on similar topics...

## 2 Responses

## #1 waka said...

02-Mar-13 6:09 PMHie. I recently started doing a finance programme and was delighted to see your blog. How do I work-out the following kind of problems using a financial calculator:

I want to buy a house worth $250K. I can afford to put down 10% (or $25K) and the bank offers me a 30 year mortgage on the remainder at a rate of 5%. What would be my monthly payment? How about for a 15 year mortgage?

I go into a car dealer and lease a car worth $20K. The dealer offers 36-month lease at $375 a month with a 50% residual. Whatâ€™s the underlying interest rate?

## #2 julian m bucknall said...

03-Mar-13 12:48 PM@waka: The only financial calculators I know are HP ones. They all use (pretty much) the same way of inputting data and calculating the answer. There are five variables in the TVM calculation: the number of payment periods (

N), the interest rate per period (i), the present value of the loan (PV), the future value (FV), and the payment per period (something likePMT).The way it works is that you enter the four values you know (

valuefollowed by the relevant key), and then press the key for the value you don't know and want to calculate.So, for my first example, PV is 225000, FV is 0 (that is, you'll fully pay off the loan), N is 360 (30 years of 12 months), i is 0.41667 (that is, 5/12). Enter that in, then press the PMT key to get -$1202.84. That's what you pay per month (it's negative so you pay it out).

Second example, using same interest rate, gives you -$1771.90 per month.

Third example. PV is 20000, FV is -10000 (50% of the PV, and you have to pay it back), N is 36, and the PMT is -375. Enter that, press the i key to get 0.65% per month. Multiply that by 12 to get the annual rate of 7.8%.

(You might also have a BEGIN/END setting for the calculator. Make sure this is set to END -- you are making your payments at the end of the period not at the start.)

Cheers, Julian

## Leave a response

Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.

`_emphasis_`

`**strong**`

`[text](url)`

``IEnumerable``

`* an item`

`1. an item`

`> Now is the time...`

## Preview of response