ITO’s lemma Part I (Using Stochastic article 19 of n)
Monday, February 1st, 2010(Read from the beginning) OR
(If you have not read article "18 of n" already then please consider reading it before continuing here
So, ITO’s lemma, eh?
Reaching there. ![]()
After struggling a lot and almost giving up, I can now feel that there is light at the end of the tunnel.
To quickly cover the basic concept: ITO’s lemma is chain-rule of calculus applied to Stochastic Variables.
What is chain-rule of calculus? I am taking this example from Wikepedia http://en.wikipedia.org/wiki/Chain_rule
“Suppose that a mountain climber ascends at a rate of 0.5 kilometers per hour. The temperature is lower at higher elevations; suppose the rate by which it decreases is 6 °C per kilometer. To calculate the decrease in air temperature per unit time that the climber experiences, one multiplies 6 °C per kilometer by 0.5 kilometer per hour, to obtain 3 °C per hour. This calculation is a typical chain rule application.”
The above example can be stated as: change in kilometer per hour * change in temperature per kilometer. Say x denotes kilometers, y denotes temperature and z denotes hours. The the Change in temperature/change in hours = change in temperature / change in kilometers * change in kilometers / change in hours
= 
So it should be obvious from the above that this chain-rule cannot really apply to Stochastic process since Stochastic process involves random variable and it is impossible to find a slope of such a function.
This is a problem when it comes to valuation of options since options depend on price of underlying stock plus a random variable. But then price of stock itself is also is a stochastic process.
ITO’s lemma gives a solution to this problem.
There are multiple concepts involved in ITO’s lemma and I am discussing the first concept in this blog. I suspect that this blog is going to take 3 parts to complete. I also suspect that I have completely screwed up on the mathematic jargon over here, so keep an eye on understanding the end result ![]()
Say we have this equation; number of miles travelled =
where s denotes the total number of minutes passed. Here is a table for the number of kilometers travelled after every 5 minutes.
s
f(s)
0 0 0
5 5 710
5 10 5320
i.e. we travelled 710 miles at the end of 5 minutes, 5320 miles at the end of 10 minutes and so on…
Another way to calculate the number of miles travelled is to take first derivative of the slope of line at 5 minutes and multiply it by incremental time i.e. 5, This is the distance that we travelled in the incremental time, add it to the previous distance travelled and we should have total distance.
I am giving the calculations and graph below:
s
f(s)
X
0 0 0 2 0
5 5 710 407 2035
5 10 5320 1562 9845
Not very convincing, right? The distance travelled at the end of 5 minutes is 710 miles but our approximation is giving us 2035 miles ![]()
If you wish to do this in excel, these are the formulae that you should use. Just copy the formulae for row three to subsequent lines.
Column A Column B Column C Column D Column E
Row 1 s
f(s)
X
Row 2 0 +A2 =(2*B2)+(3*B2*B2)+(5*B2*B2*B2) =2+(6*B2)+(15*B2*B2) =+C2
Row 3 5 +A3+B2 =(2*B3)+(3*B3*B3)+(5*B3*B3*B3) =2+(6*B3)+(15*B3*B3) =(D3*A3)+E2
Now let us see what happens when we reduce the incremental time to 1
s
f(s)
X
0 0 0 2 0
1 1 10 23 23
1 2 56 74 97
1 3 168 155 252
1 4 376 266 518
1 5 710 407 925

With incremental time of 1, the distance travelled as per our approximation is somewhat better than incremental time of 5.
At the end of 5 minutes now our approximation comes off with 925 miles (which is better than 2035 miles with incremental time of 5). But this is not really useful since the actual time travelled at the end of 5 minutes is 710 miles.
Now let us see what happens when we reduce incremental time to .05
s
f(s)
X
| 0 | 0 | 0 | 2 | 0 |
| 0.05 | 0.05 | 0.108125 | 2.3375 | 0.116875 |
| 0.05 | 0.1 | 0.235 | 2.75 | 0.254375 |
| 0.05 | 0.15 | 0.384375 | 3.2375 | 0.41625 |
| 0.05 | 0.2 | 0.56 | 3.8 | 0.60625 |
| 0.05 | 0.25 | 0.765625 | 4.4375 | 0.828125 |
| 0.05 | 0.3 | 1.005 | 5.15 | 1.085625 |
| 0.05 | 0.35 | 1.281875 | 5.9375 | 1.3825 |
| 0.05 | 0.4 | 1.6 | 6.8 | 1.7225 |
| 0.05 | 0.45 | 1.963125 | 7.7375 | 2.109375 |
| 0.05 | 0.5 | 2.375 | 8.75 | 2.546875 |
| 0.05 | 0.55 | 2.839375 | 9.8375 | 3.03875 |
| 0.05 | 0.6 | 3.36 | 11 | 3.58875 |
| 0.05 | 0.65 | 3.940625 | 12.2375 | 4.200625 |
| 0.05 | 0.7 | 4.585 | 13.55 | 4.878125 |
| 0.05 | 0.75 | 5.296875 | 14.9375 | 5.625 |
| 0.05 | 0.8 | 6.08 | 16.4 | 6.445 |
| 0.05 | 0.85 | 6.938125 | 17.9375 | 7.341875 |
| 0.05 | 0.9 | 7.875 | 19.55 | 8.319375 |
| 0.05 | 0.95 | 8.894375 | 21.2375 | 9.38125 |
| 0.05 | 1 | 10 | 23 | 10.53125 |
| 0.05 | 1.05 | 11.19563 | 24.8375 | 11.77313 |
| 0.05 | 1.1 | 12.485 | 26.75 | 13.11063 |
| 0.05 | 1.15 | 13.87188 | 28.7375 | 14.5475 |
| 0.05 | 1.2 | 15.36 | 30.8 | 16.0875 |
| 0.05 | 1.25 | 16.95313 | 32.9375 | 17.73438 |
| 0.05 | 1.3 | 18.655 | 35.15 | 19.49188 |
| 0.05 | 1.35 | 20.46938 | 37.4375 | 21.36375 |
| 0.05 | 1.4 | 22.4 | 39.8 | 23.35375 |
| 0.05 | 1.45 | 24.45063 | 42.2375 | 25.46563 |
| 0.05 | 1.5 | 26.625 | 44.75 | 27.70313 |
| 0.05 | 1.55 | 28.92688 | 47.3375 | 30.07 |
| 0.05 | 1.6 | 31.36 | 50 | 32.57 |
| 0.05 | 1.65 | 33.92813 | 52.7375 | 35.20688 |
| 0.05 | 1.7 | 36.635 | 55.55 | 37.98438 |
| 0.05 | 1.75 | 39.48438 | 58.4375 | 40.90625 |
| 0.05 | 1.8 | 42.48 | 61.4 | 43.97625 |
| 0.05 | 1.85 | 45.62563 | 64.4375 | 47.19813 |
| 0.05 | 1.9 | 48.925 | 67.55 | 50.57563 |
| 0.05 | 1.95 | 52.38188 | 70.7375 | 54.1125 |
| 0.05 | 2 | 56 | 74 | 57.8125 |
| 0.05 | 2.05 | 59.78313 | 77.3375 | 61.67938 |
| 0.05 | 2.1 | 63.735 | 80.75 | 65.71688 |
| 0.05 | 2.15 | 67.85938 | 84.2375 | 69.92875 |
| 0.05 | 2.2 | 72.16 | 87.8 | 74.31875 |
| 0.05 | 2.25 | 76.64063 | 91.4375 | 78.89063 |
| 0.05 | 2.3 | 81.305 | 95.15 | 83.64813 |
| 0.05 | 2.35 | 86.15688 | 98.9375 | 88.595 |
| 0.05 | 2.4 | 91.2 | 102.8 | 93.735 |
| 0.05 | 2.45 | 96.43812 | 106.7375 | 99.07188 |
| 0.05 | 2.5 | 101.875 | 110.75 | 104.6094 |
| 0.05 | 2.55 | 107.5144 | 114.8375 | 110.3513 |
| 0.05 | 2.6 | 113.36 | 119 | 116.3013 |
| 0.05 | 2.65 | 119.4156 | 123.2375 | 122.4631 |
| 0.05 | 2.7 | 125.685 | 127.55 | 128.8406 |
| 0.05 | 2.75 | 132.1719 | 131.9375 | 135.4375 |
| 0.05 | 2.8 | 138.88 | 136.4 | 142.2575 |
| 0.05 | 2.85 | 145.8131 | 140.9375 | 149.3044 |
| 0.05 | 2.9 | 152.975 | 145.55 | 156.5819 |
| 0.05 | 2.95 | 160.3694 | 150.2375 | 164.0938 |
| 0.05 | 3 | 168 | 155 | 171.8438 |
| 0.05 | 3.05 | 175.8706 | 159.8375 | 179.8356 |
| 0.05 | 3.1 | 183.985 | 164.75 | 188.0731 |
| 0.05 | 3.15 | 192.3469 | 169.7375 | 196.56 |
| 0.05 | 3.2 | 200.96 | 174.8 | 205.3 |
| 0.05 | 3.25 | 209.8281 | 179.9375 | 214.2969 |
| 0.05 | 3.3 | 218.955 | 185.15 | 223.5544 |
| 0.05 | 3.35 | 228.3444 | 190.4375 | 233.0763 |
| 0.05 | 3.4 | 238 | 195.8 | 242.8663 |
| 0.05 | 3.45 | 247.9256 | 201.2375 | 252.9281 |
| 0.05 | 3.5 | 258.125 | 206.75 | 263.2656 |
| 0.05 | 3.55 | 268.6019 | 212.3375 | 273.8825 |
| 0.05 | 3.6 | 279.36 | 218 | 284.7825 |
| 0.05 | 3.65 | 290.4031 | 223.7375 | 295.9694 |
| 0.05 | 3.7 | 301.735 | 229.55 | 307.4469 |
| 0.05 | 3.75 | 313.3594 | 235.4375 | 319.2188 |
| 0.05 | 3.8 | 325.28 | 241.4 | 331.2888 |
| 0.05 | 3.85 | 337.5006 | 247.4375 | 343.6606 |
| 0.05 | 3.9 | 350.025 | 253.55 | 356.3381 |
| 0.05 | 3.95 | 362.8569 | 259.7375 | 369.325 |
| 0.05 | 4 | 376 | 266 | 382.625 |
| 0.05 | 4.05 | 389.4581 | 272.3375 | 396.2419 |
| 0.05 | 4.1 | 403.235 | 278.75 | 410.1794 |
| 0.05 | 4.15 | 417.3344 | 285.2375 | 424.4412 |
| 0.05 | 4.2 | 431.76 | 291.8 | 439.0312 |
| 0.05 | 4.25 | 446.5156 | 298.4375 | 453.9531 |
| 0.05 | 4.3 | 461.605 | 305.15 | 469.2106 |
| 0.05 | 4.35 | 477.0319 | 311.9375 | 484.8075 |
| 0.05 | 4.4 | 492.8 | 318.8 | 500.7475 |
| 0.05 | 4.45 | 508.9131 | 325.7375 | 517.0344 |
| 0.05 | 4.5 | 525.375 | 332.75 | 533.6719 |
| 0.05 | 4.55 | 542.1894 | 339.8375 | 550.6637 |
| 0.05 | 4.6 | 559.36 | 347 | 568.0137 |
| 0.05 | 4.65 | 576.8906 | 354.2375 | 585.7256 |
| 0.05 | 4.7 | 594.785 | 361.55 | 603.8031 |
| 0.05 | 4.75 | 613.0469 | 368.9375 | 622.25 |
| 0.05 | 4.8 | 631.68 | 376.4 | 641.07 |
| 0.05 | 4.85 | 650.6881 | 383.9375 | 660.2669 |
| 0.05 | 4.9 | 670.075 | 391.55 | 679.8444 |
| 0.05 | 4.95 | 689.8444 | 399.2375 | 699.8062 |
| 0.05 | 5 | 710 | 407 | 720.1562 |

Hurray! With incremental time of .05 our distance travelled at the end of 5 minutes is 720.1562 miles.
Now if we reduce the incremental time to .01 (do not worry I am not going to paste this data) then at end of 5 minutes our approximation gives us 712.0262 miles.
So taking minute incremental time is the first trick to be used in stochastic process (note that for the sake of sanity, I am using linear equations for this particular blog).
Last but not the least: After thinking for some time, I realized that this is another thing that can be filed in ‘bleedingly obvious’ category. We would have got a decent result even with incremental time of 5 minutes if we had used average slope during the period. It is not as if we started speeding at the end of the time interval. We started speeding as soon as we were past time zero and the speed kept on increasing thereafter. So in essence what we are doing by reducing incremental time is to take average speed.
Revisiting partial derivatives (Using Stochastic article 18 of n)
Wednesday, January 13th, 2010(Read from the beginning) OR
(If you have not read article "17 of n" already then please consider reading it before continuing here
Reinforcing the concept of partial derivatives
It seems there are two things in calculus that are vital in understanding the derivation of ITO’s lemma
One of them is Taylor series, which I have covered in my previous post.
The other one is partial derivatives. Though I had covered this topic in one of my previous posts, I was not very happy with what I had done. So I decided to spend more time to make sure that I really understand this concept.
Let us take one more theoretical example:
Find the partial derivatives for f(x,y) = 
[f(x,y) is just another way of saying function of x and y]
First let us keep x constant and find partial derivative with respect to y
Step 1: Say we need to find derivative of
which is
. Now instead of
, we need to find derivative of
. We treat x as constant (same as 3 in
) and hence the partial derivative is 
Step 2: We already know that derivative of
is 2y
Step 3: We also know that the derivative of y is 1.
Hence

Now let us keep y constant and find partial derivative with respect to x.
Step 1: partial derivative of
is
(derivative of x is 1 and
is a constant)
Step 2: partial derivative of
is 0 (Think over this,
is a constant and hence derivative of
with respect to x is zero)
Step 3: Same with y, the partial derivative with respect to x is zero.
Hence

You might be initially confused about why derivative of
is zero. Look at this way. If we had a function
then the derivative of this function will be 2x + 2. Notice that we have calculated derivative of 3 as zero since 3 is a constant. In our example
is also a constant and hence the derivative of
is zero.
The trick is to be able to mentally keep one or more of the variables as constant.
Let us now take a practical example to make sure we have really understood the concept:
Consider a rectangular box with width same as height. Let us say we denote width of the box as x and the length as y. Thus we get volume of the box as equal to
(width * height * length).
Now let us say we keep length as constant.
(a) If the length is constant at 2 then in this case our formulae for volume is
. What is the rate of increase? Rate of increase is same as the first derivative i.e. 4x.
(b) Now let us keep length constant at 3. In this case our formulae for volume is
. What is the rate of increase? Rate of increase is 6x
(c) Finally let us keep length constant at 4. In this case our formulae for volume is
. What is the rate of increase? Rate of increase is 8x.
Is there any way to consolidate the above information? Yes, what we are basically doing above is to take partial derivatives i.e. keep one variable (length) constant.
Our original formulae for volume is
. i.e.
. Now treat y as constant and take first derivative to find the rate of increase as 2xy. If you glance at the above calculations (a),(b),(c), you will realize that 2xy is just a fancy way of saying the same thing..4x, 6x, 8x etc (just substitute y with the actual values).
So now let us rewrite our fancy equation in the way mathematicians like it. It is very important to get used to this weird symbol. ![]()

but I suppose there is some logical reason for showing it the other way i.e.
)
Taylor series revisited (Using stochastic article 17 of n)
Friday, November 27th, 2009(Read from the beginning) OR
(If you have not read article "16 of n" already then please consider reading it before continuing here
So it has been quite some time since I updated this blog. I was too distracted with a lot of stuff, work at office, my new dot com site (still working on it) and family vacation among other thing.
In addition to this I have also been struggling with ITO’s lemma. I have been trying to understand at least ‘something’ about it for a long time now and I have not yet managed to unlock the secret L
Anyway, it does appear that I need to revisit the concept of Taylor Series. There are a lot of blogs for Taylor Series including my own and all they talk about is
. The problem is it is hard to make anything out of this concept, this is just confusing L
Taylor series is

The problem is that I did not have a clue how to use this series to find solution to a practical problem, I mean any problem at all! So I decided to dig deeper and after pulling my hair for one week, I have slowly started to understand what this series is all about. So here are my preliminary findings J Let us say we need to find square-root of a number say 4.10 using taylor series . The first step is to find the deriviatives Now there is a reason why I am writing down And finally Now we need to plug in a number in the above equation. Since we need to calculate square root of 4.10, let us plug in 4 and calculate the values. Why four? Because it is a nice little round number and we know the square root of four
instead of
It just makes the calculation much easier. At least for me who is not trained to grasp the meaning of numbers such as
Next step is to rewrite the Taylor series plugging in our values to come up with an equation of square root of 4.
i.e
Now we are ready to find square-root of 4.10 with the above equation. Just substitute x with 4.10 and a with 4
Which gives us a value of 2.024846. Hurray!!! If you calculate the square-root of 4.10 on your calculator then you can confirm that Taylor Series did calculate the square-root correctly.
Now let us calculate square-root of various numbers using the above series
Number Taylor Series square root Square root as per calculator
4.5 2.121319 2.12132
5.0 2.236023 2.236068
6.0 2.448242 2.44949
10.0 2.963867 3.162278
So as you can see our series giving us in-correct results as we move away from four. What is happening? I have drawn both the values in the graph. The line in red is actual square-roots and line in blue is the square roots calculautd with the help of taylor function at value of 4.

As you can see the blue line (which is our Taylor Series) is moving away and away from the actual values. So what does this tell us?
(What we have done above is we have expanded Taylor series for square-root of a number at a point which is four in our case). To convert any function to a Taylor Series we need to expand the series at a point and as long we are near that point we will get accurate results.
It should be obvious by now that is important to find a point where f(x) can easily be calculated. In our case to find out square-root of 4.10, all we had to do was to calcuate square root of 4 (which we hopefully already know).
So does this mean that Taylor series is completely hopeless when it comes to complex functions? Because after all we need to calculate f(x) for one point.
Not really! We had a problem with square-root since this is a singular series i.e. it is not defined for negative numbers. So this was an odd example that I picked up. But what about functions where f(a) can be calculated at point 0 which will make the series really easy to solve? Or what about a function that exactly matches taylor series at all points? Here again we can expand the series at point 0 and get a simplified polynomial (Taylor series is a polynomial). Let us look at a few such series next.
I will be away for most of December, visiting H'bad in India for a week and then off for rest of the December on vacation. So if I do not get a chance to write another blog in next month then Happy new Year! Hopefully todays stock market action was just a small pull-back (which may run for 3-4 days) rather than a crash

