Professional Documents
Culture Documents
Mathematical Methods
Mathematical Methods
Quantitative Finance
1. Limits and Derivatives
Kjell Konis
Acting Assistant Professor, Applied Mathematics
University of Washington
Kjell Konis (Copyright 2013)
1 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
2 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
3 / 68
Course Information
Instructors:
Lecturer: Kjell Konis <kjellk@uw.edu>
4 / 68
Recommended Texts
5 / 68
Recommended Texts
6 / 68
Quarter Overview
Topics
1
Integration
3/4
Multivariable Calculus
5/6
Numerical Methods
7 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
8 / 68
9 / 68
1
FV = d1 FV
1+r
10 / 68
Annuities
An annuity is a contract that pays money regularly over a period of
time.
Question: suppose we would like to buy an annuity that pays $100 at
the end of the year for each of the next 10 years. At an interest rate
of 4%, how much should we expect to pay?
Solution: appropriately discount each of the 10 future payments and
take the sum.
The present value of the k th payment is
PVk = dk Ak =
100
(1 + 0.04)k
10
X
100
(1 + 0.04)k
k=1
11 / 68
Annuities (continued)
Recall: V =
10
X
100
(1 + 0.04)k
k=1
(1 + 0.04) V
0.04V
100 +
9
X
100
(1 + 0.04)k
k=1
9
X
100
100
+
k
(1
+
0.04)
(1
+
0.04)10
k=1
100
100
(1 + 0.04)10
1
100
100
0.04
(1 + 0.04)10
=
Kjell Konis (Copyright 2013)
V =
= 811.09
12 / 68
Perpetual Annuities
A perpetual annuity or perpetuity pays a fixed amount periodically
forever.
Actually exist: instruments exist in the UK called consols.
(1 + 0.04) V
100 +
100
(1 + 0.04)k
k=1
100
(1 + 0.04)k
k=1
0.04V
100
V =
100
= 2500
0.04
13 / 68
1
[1 + (r /m)]k
V =
14 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
15 / 68
A Diverging Example
Calculate
V = 1 1 + 1 1 + 1...
Rewrite as
?
V =
(+1 1) =
k=1
0=0
k=1
V =
k=1
But
k=1 1
=1+1+1+
?
V =
X
k=1
k=4 1
1=0
k=1
=1+1+1+
1=1+1+1+
k=1
X
j=1
j=1 1
X
?
1=3
k=1
16 / 68
Notation
R the set of real numbers
Z the set of integers
in: indicator of set membership
for all
there exists
goes to
g : R R a real-valued function with a real argument
b x c floor: the largest integer less than or equal to x
d x e ceiling: the smallest integer greater than or equal to x
6
17 / 68
Definition of limit
Let g : R R.
The limit of g(x ) as x x0 exists and is finite and equal to l if and
only if for any > 0 there exists > 0 such that |g(x ) l| < for all
x (x0 , x0 + ).
Alternatively,
lim g(x ) = l iff > 0, > 0 s.t. |g(x ) l| < , |x x0 | <
x x0
Similarly,
lim g(x ) = iff C > 0, > 0 s.t. g(x ) > C ,
x x0
|x x0 | <
lim g(x ) = iff C < 0, > 0 s.t. g(x ) < C ,
x x0
|x x0 | <
Kjell Konis (Copyright 2013)
18 / 68
Modification for x
How to make sense of |x | < ?
lim g(x ) = l iff > 0, b s.t. |g(x ) l| < , x > b
V =
A
r
Strategy: given > 0, find N such that |Vn V | < for n > N.
Kjell Konis (Copyright 2013)
19 / 68
Example
Given > 0, find N such that |Vn V | < for n > N
|Vn V | =
=
=
A
1
A
r 1 (1 + r )n r
A
A
A
r
r (1 + r )n
r
A
r (1 + r )n
2
for n > N.
Kjell Konis (Copyright 2013)
20 / 68
Example (continued)
A
r (1 + r )n
(1 + r )n =
2
2A
r
2A
n log(1 + r ) = log
r
n =
log(2A) log(r )
log(1 + r )
log(2A) log(r )
Choose N =
then for n > N
log(1 + r )
|Vn V |
Kjell Konis (Copyright 2013)
A
<
n
r (1 + r )
2
21 / 68
Summary: Limits
Given > 0, can find N such that |Vn V | < for n > N, thus
lim Vn = V
Definition of a limit
lim g(x ) = l iff > 0, > 0 s.t. |g(x ) l| < , |x x0 | <
x x0
22 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
23 / 68
Evaluating Limits
Observation: working with the definition = not fun!
Suppose that c is a real constant and the limits
lim f (x )
x a
and
lim g(x )
x a
exist. Then
(i)
(ii)
(iii)
(iv)
x a
x a
x a
lim cf (x ) = c lim f (x )
x a
x a
x a
x a
x a
lim f (x )
f (x )
= x a
x a g(x )
lim g(x )
if lim g(x ) 6= 0
lim
x a
x a
(v)
lim
x a
p
n
f (x ) =
q
n
lim f (x )
x a
24 / 68
Evaluating Limits
If P(x ) and Q(x ) are polynomials and c > 1 is a real constant then
(a)
(b)
lim
P(x )
= lim P(x ) c x = 0
x
cx
lim
log |Q(x )|
=0
P(x )
Examples
(a)
(b)
lim x 2 e x = 0
log(x 3 )
=0
x
x
lim
25 / 68
Evaluating Limits
Notation: x & 0 means x 0 with x > 0; k! = k (k 1) 2 1
Let c > 0 be a positive constant, then
(a)
(b)
(c)
lim c x = 1
lim x x = 1
lim x x = 1
x &0
lim k k = 1
lim c k = 1
ck
=0
k k!
lim
26 / 68
Example
1
4x + 1 x
x 2 4x + 1 + x
1
= lim
x
x 2 4x + 1 x
x 2 4x + 1 + x
x 2 4x + 1 + x
= lim 2
x x 4x + 1 x 2
x 2 4x + 1 + x x1
= lim
1
x
1 4x
x
lim
x2
lim
limx
4
1
x + x2
1
x 4
4
x
1
x
=
limx
Kjell Konis (Copyright 2013)
+1
1
x2
+1
=
1+1
1
=
4
2
27 / 68
Example
lim
x2
1
4x + 1 x + 2
1
x 2 4x + 1 + (x 2)
lim
x
x 2 4x + 1 (x 2)
x 2 4x + 1 + (x 2)
x 2 4x + 1 + x 2
lim 2
x x 4x + 1 (x 2)2
x 2 4x + 1 + x 2
lim 2
x x 4x + 1 [x 2 4x + 4]
x 2 4x + 1 + x 2
lim
x
3
Kjell Konis (Copyright 2013)
28 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
29 / 68
Continuity
Most of the time:
lim f (x ) = f (a)
x a
y
f(x)
f(a)
a
Kjell Konis (Copyright 2013)
x
30 / 68
Continuity Definitions
A function f is continuous at a if
lim f (x ) = f (a)
x a
A function is right-continuous at a if
lim f (x ) = f (a)
x &a
A function is left-continuous at a if
lim f (x ) = f (a)
x %a
31 / 68
(Dis)continuity
f(x)
Is f (x ) continuous at a?
Is f (x ) right-continuous at a?
Is f (x ) left-continuous at a?
Kjell Konis (Copyright 2013)
32 / 68
Continuity Theorems
Let f and g be continuous at a and c be a real-valued constant. Then
1.
4.
f +g
fg
2.
5.
f g
f
g (g(a) 6= 0)
3.
cf
are continuous at a.
Any polynomial is continuous on R.
The following functions are continuous on their domains:
polynomials
rational functions
root functions
logarithmic functions
trigonometric functions
inverse trigonometric functions
exponential functions
33 / 68
Example
Where is the following function continuous?
f (x ) =
log(x ) + tan1 (x )
x2 1
1
tan(x )
cos(x )
sin(x )
= cot(x )
34 / 68
Horizontal Asymptotes
What happens to f (x ) =
x2 1
as x becomes large?
x2 + 1
x
Kjell Konis (Copyright 2013)
or
lim f (x ) = L
35 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
36 / 68
Tangent Line
Goal: find the slope of the line tangent to y = f (x ) at a point a.
f(a)
f(x)
37 / 68
Strategy
f(x + h)
rise
f(x)
f(x)
run
x+h
rise
f (x + h) f (x )
=
run
h
38 / 68
Definition of Derivative
A function f : R R is differentiable at a point x R if
lim
h0
f (x + h) f (x )
h
exists.
When this limit exists, the derivative of f (x ), denoted by f 0 (x ), is
defined as
f (x + h) f (x )
h0
h
f 0 (x ) = lim
39 / 68
Example
Compute the derivative of f (x ) = 3x 2 + 5x + 1
f 0 (x ) =
f (x + h) f (x )
h0
h
lim
3x 2 + 6xh + 3h2 + 5x + 5h + 1 3x 2 5x 1
h0
h
6xh + 3h2 + 5h
h0
h
lim 6x + 3h + 5
lim
lim
lim
h0
= 6x + 5
Kjell Konis (Copyright 2013)
40 / 68
Properties of Derivatives
The derivative of a constant is 0.
Linearity: let f (x ) and g(x ) be differentiable functions and let a and
b be real-valued constants. The derivative of
l(x ) = a f (x ) + b g(x )
is
l 0 (x ) = a f 0 (x ) + b g 0 (x )
Power Rule: Let n be a real-valued constant. The derivative of
f (x ) = x n
is
f 0 (x ) = n x n1
Kjell Konis (Copyright 2013)
41 / 68
Definition: f 0 (x ) = lim
Linearity: a f (x ) + b g(x ) = a f 0 (x ) + b g 0 (x )
Power Rule: (x c )0 = c x c1
for c 6= 0.
42 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
43 / 68
Product Rule
Suppose f (x ) and g(x ) are differentiable functions.
Let p(x ) = f (x ) g(x )
Then p(x ) is differentiable, and
0
p 0 (x ) = f (x ) g(x ) = f 0 (x ) g(x ) + f (x ) g 0 (x )
44 / 68
Examples
0
g(x ) = e x
p 0 (x ) = 1 e x + x e x
= (x + 1)e x
t(1 t)
1
f (t) =
t = t2,
p(t) =
p 0 (x ) =
=
Kjell Konis (Copyright 2013)
g(t) = (1 t)
1
1 1
t 2 (1 t) + t 2 (1)
2
(1 t)
1 3t
t=
2 t
2 t
1. Limits and Derivatives
45 / 68
Chain Rule
Suppose f (x ) and g(x ) are differentiable functions.
The composite function (g f )(x ) = g(f (x )) is differentiable, and
0
(g f )(x ) = g 0 (f (x )) f 0 (x )
46 / 68
Examples
0
Recall: (g f )(x ) = g 0 (f (x )) f 0 (x )
(g f )(x ) =
x 2 + 1 = (x 2 + 1) 2
(g f )(x )
0
=
=
1
1 2
(x + 1) 2 2x
2
x
2
x +1
(g f )(x ) = (x 3 1)100
(g f )(x )
0
= 100(x 3 1)99 3x 2
= 300x 2 (x 3 1)99
47 / 68
Substitution Method
Recall Leibniz notation:
Compute
d
dx
dg du
dg
=
dx
du dx
d
sin(u) =
dx
du
dx
= 2x
d
du
sin(u)
du
dx
= cos(u) 2x
= 2x cos(x 2 )
Compute
d sin()
;
d e
d sin()
e
=
dx
du
d
= cos()
d u du
e
du
d
= e u cos()
= cos() e sin()
Kjell Konis (Copyright 2013)
48 / 68
f 1 (x ) =
1
f 0 (f 1 (x ))
Example
log(e x ) = x
f (x ) = e x , f 0 (x ) = e x , and f 1 (x ) = log(x )
0
0
log(x ) = f 1 (x ) =
1
e log(x )
1
x
49 / 68
Product Rule
0
f (x ) g(x ) = f 0 (x ) g(x ) + f (x ) g 0 (x )
Chain Rule
0
(g f )(x ) = g 0 (f (x )) f 0 (x )
dg
dg du
=
dx
du dx
50 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
51 / 68
Utility Functions
A utility function is a real-valued function U(x ) defined on the real
numbers.
Used to compare wealth levels: if U(x ) > U(y ) then U(x ) is
preferred.
U(x)
Exponential U(x ) = e ax
(a > 0)
Logarithmic
Power
Logarithmic
U(x ) = log(x )
Quadratic
Power U(x ) = bx b
b (0, 1]
x
Exponential
Quadratic U(x ) = x bx 2
(b > 0)
What is the derivative telling us?
Kjell Konis (Copyright 2013)
52 / 68
Critical Points
A critical point of a function f (x ) is a number a in the domain of
f (x ) where either f 0 (a) = 0 or f 0 (a) does not exist.
If f has a local min or max at a, then a is a critical point.
f(x)
U(x)
U'(x)
f'(x)
53 / 68
Higher Derivatives
If f (x ) is a differentiable function, f 0 (x ) is also a function.
If f 0 (x ) is also differentiable, its derivative is denoted by
f 00 (x ) = f 0 (x )
0
Alternative notation: f 00 (x ) = D 2 f (x )
No reason to stop at 2:
f (n) (x ) =
dn
d nf
f
(x
)
=
= D n f (x )
dx n
dx n
54 / 68
f''(x)
U(x)
f(x)
U'(x)
f'(x)
U''(x)
55 / 68
Evaluate f (x ) at a and b
Expected Return
56 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
57 / 68
Price
300
200
100
0
0
5%
10%
15%
20%
n
X
F
C
+
n
[1 + ]
1 + k
k=1
C = coupon payment
F = face value
F
C
1
+
1
n
[1 + ]
[1 + ]n
58 / 68
ck
,
[1 + ]k
P=
n
X
PVk =
k=1
n
X
ck
[1
+
]k
k=1
n
X
PVk
k=1
or
DP =
n
X
k PVk
k=1
ck
= ck [1 + ]k
[1 + ]k
d PVk
d
k ck [1 + ]k1 =
k ck
k
=
PVk
k+1
[1 + ]
1+
59 / 68
n
X
PVk
k=1
d
P =
d
n
n
X
d X
d PVk
PVk =
d k=1
d
k=1
n
X
k
PVk
1+
k=1
n
1 X
k PVk
1 + k=1
1
D P DM P
1+
60 / 68
Duration
Price Sensitivity Formula
dP
= DM P
d
Since
DM
1 dP
= DM
P d
measures the relative change in price as changes.
61 / 68
Linear Approximation
400
Price
300
200
100
0
0
5%
10%
15%
20%
62 / 68
n
X
PVk
k=1
or
DP =
n
X
k PVk
k=1
Modified Duration
DM =
1
D
1+
63 / 68
Outline
1
Course Organization
Present Value
Limits
Evaluating Limits
Differentiation
Higher Derivatives
Bond Duration
10
lHopitals Rule
Kjell Konis (Copyright 2013)
64 / 68
lHopitals Rule
Problem: how to evaluate
lim
x 0
sin(x )
?
x
lim sin(x )
sin(x )
0
= x 0
=
x 0
x
lim x
0
lim
x 0
65 / 68
lHopitals Rule
Let x0 be a real number (including ) and let f (x ) and g(x ) be
differentiable functions.
(i)
)
Suppose limx x0 f (x ) = 0 and limx x0 g(x ) = 0. If limx x0 gf 0(x
(x ) exists
and there is an interval (a, b) containing x0 such that g 0 (x ) 6= 0 for all
f (x )
x (a, b) \ 0, then limx x0 g(x
) exists and
lim
x x0
(ii)
f (x )
f 0 (x )
= lim 0
g(x ) x x0 g (x )
0
)
Suppose limx x0 f (x ) = and limx x0 g(x ) = . If limx x0 gf 0(x
(x )
exists and there is an interval (a, b) containing x0 such that g 0 (x ) 6= 0
f (x )
for all x (a, b) \ 0, then limx x0 g(x
) exists and
lim
x x0
f (x )
f 0 (x )
= lim 0
g(x ) x x0 g (x )
66 / 68
Examples
lim
x 0
sin(x )
x
x 0
sin(x )
= lim
x 0
x 0
x
lim
x2 1
x x 2 + 1
d
dx
sin(x )
d
dx x
= lim
x 0
cos x
=1
1
lim
x2 1
= lim
x x 2 + 1
x
lim
d 2
dx x
d 2
dx x
1
+1
2x
=?
x 2x
= lim
x2 1
= lim
x x 2 + 1
x
lim
d 2
dx x
d 2
dx x
1
+1
2x
= lim
x 2x
x
= lim
d
dx 2x
d
dx 2x
= lim
2
=1
2
67 / 68
http://computational-finance.uw.edu
68 / 68