Upload
kasie
View
59
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Fin500J Mathematical Foundations in Finance Topic 2: Matrix Calculus Philip H. Dybvig Reference: Matrix Calculus, appendix from Introduction to Finite Element Methods book Slides designed by Yajun Wang. Outline. The Derivatives of Vector Functions The Chain Rule for Vector Functions. - PowerPoint PPT Presentation
Citation preview
Fin500J Topic 2 Fall 2010 Olin Business School 1
Fin500J Mathematical Foundations in FinanceTopic 2: Matrix Calculus
Philip H. Dybvig
Reference: Matrix Calculus, appendix from Introduction to Finite Element Methods book
Slides designed by Yajun Wang
Fin500J Topic 2 Fall 2010 Olin Business School 2
Outline
The Derivatives of Vector Functions
The Chain Rule for Vector Functions
Fin500J Topic 2 Fall 2010 Olin Business School 3
1 The Derivatives of Vector Functions
Fin500J Topic 2 Fall 2010 Olin Business School 4
1.1 Derivative of Vector with Respect to Vector
Fin500J Topic 2 Fall 2010 Olin Business School 5
1.2 Derivative of a Scalar with Respect to Vector
If y is a scalar
1.3 Derivative of Vector with Respect to Scalar
It is also called the gradient of y with respect to a vector
variable x, denoted by .y
Fin500J Topic 2 Fall 2010 Olin Business School 6
Example 1
Given
and
In Matlab
Fin500J Topic 2 Fall 2010 Olin Business School 7
>> syms x1 x2 x3 real;
>> y1=x1^2-x2;
>> y2=x3^2+3*x2;
>> J = jacobian([y1;y2], [x1 x2 x3])
J =
[ 2*x1, -1, 0]
[ 0, 3, 2*x3]
Note: Matlab defines the derivatives as the transposes of those given in this lecture.
>> J'
ans =
[ 2*x1, 0]
[ -1, 3]
[ 0, 2*x3]
>> syms x1 x2 x3 real;
>> y1=x1^2-x2;
>> y2=x3^2+3*x2;
>> J = jacobian([y1;y2], [x1 x2 x3])
J =
[ 2*x1, -1, 0]
[ 0, 3, 2*x3]
Note: Matlab defines the derivatives as the transposes of those given in this lecture.
>> J'
ans =
[ 2*x1, 0]
[ -1, 3]
[ 0, 2*x3]
Fin500J Topic 2 Fall 2010 Olin Business School 8
Some useful vector derivative formulas
2
T
T
T
CxC
x CC
x xx
x
x
x
n
tntt
n
ttt
n
ttt
nnnnn
n
n
Cx
Cx
Cx
x
x
x
CCC
CCC
CCC
1
12
11
2
1
21
22221
11211
T
nnnn
n
n
C
ccc
ccc
ccc
21
22212
12111
x
CxHomework
Fin500J Topic 2 Fall 2010 Olin Business School 9
T
1 1
T1 1 1 1
1 1
TT T
( )
( )
n n
i j iji j
n n n n
i j ij k j kj i k iki j j i
k k k k
n n
j kj i ikj i
x x C
x x C x x C x x C
x x x x
x C x C
x
x Cx
x Cx
x CxCx C x C C x
Important Property of Quadratic Form xTCx
Proof:
T
T( )
x Cx
C C xx
n
tntt
n
ttt
n
ttt
nnnnn
n
n
Cx
Cx
Cx
x
x
x
CCC
CCC
CCC
1
12
11
2
1
21
22221
11211
If C is symmetric, T( )
2C
x Cx
xx
Fin500J Topic 2 Fall 2010 Olin Business School 10
2 The Chain Rule for Vector FunctionsLet
where z is a function of y, which is in turn a function of x, we
can write
Each entry of this matrix may be expanded as
Fin500J Topic 2 Fall 2010 Olin Business School 11
The Chain Rule for Vector Functions (Cont.)Then
On transposing both sides, we finally obtain
This is the chain rule for vectors (different from the conventional chain rule of calculus, the chain of matrices builds toward the left)
Fin500J Topic 2 Fall 2010 Olin Business School 12
Example 2x, y are as in Example 1 and z is a function of y defined as
21 1 21
22 2 2 1
2 23 3 1 2
4 4 1 2
31 2 4
1 1 1 1 1 1
2 231 2 4
2 2 2 2
2
, , we have
2
2 1 2 2.
2 2 2 1
Therefore,
2
z y yz
z z y yz and
z z y yz z y y
zz z z
y y y y y yzy yzy z z z
y y y y
z y z
x x y
1 1 1 1 1 111 1
1 2 2 22 2
3 3 3 2 3 2 3
4 2 4 402 1 2 2
2 6 1 6 2 6 11 32 2 2 1
0 2 4 4 4 2
x y x x y xxy y
y y y yy y
x x x y x y x
In Matlab
Fin500J Topic 2 Fall 2010 Olin Business School 13
>> z1=y1^2-2*y2;
>> z2=y2^2-y1;
>> z3=y1^2+y2^2;
>> z4=2*y1+y2;
>> Jzx=jacobian([z1; z2; z3; z4],[x1 x2 x3])
Jzx =
[ 4*(x1^2-x2)*x1, -2*x1^2+2*x2-6, -4*x3]
[ -2*x1, 6*x3^2+18*x2+1, 4*(x3^2+3*x2)*x3]
[ 4*(x1^2-x2)*x1, -2*x1^2+20*x2+6*x3^2, 4*(x3^2+3*x2)*x3]
[ 4*x1, 1, 2*x3]
>> Jzx’
ans =
[ 4*(x1^2-x2)*x1, -2*x1, 4*(x1^2-x2)*x1, 4*x1]
[ -2*x1^2+2*x2-6, 6*x3^2+18*x2+1, -2*x1^2+20*x2+6*x3^2, 1]
[ -4*x3, 4*(x3^2+3*x2)*x3, 4*(x3^2+3*x2)*x3, 2*x3]
>> z1=y1^2-2*y2;
>> z2=y2^2-y1;
>> z3=y1^2+y2^2;
>> z4=2*y1+y2;
>> Jzx=jacobian([z1; z2; z3; z4],[x1 x2 x3])
Jzx =
[ 4*(x1^2-x2)*x1, -2*x1^2+2*x2-6, -4*x3]
[ -2*x1, 6*x3^2+18*x2+1, 4*(x3^2+3*x2)*x3]
[ 4*(x1^2-x2)*x1, -2*x1^2+20*x2+6*x3^2, 4*(x3^2+3*x2)*x3]
[ 4*x1, 1, 2*x3]
>> Jzx’
ans =
[ 4*(x1^2-x2)*x1, -2*x1, 4*(x1^2-x2)*x1, 4*x1]
[ -2*x1^2+2*x2-6, 6*x3^2+18*x2+1, -2*x1^2+20*x2+6*x3^2, 1]
[ -4*x3, 4*(x3^2+3*x2)*x3, 4*(x3^2+3*x2)*x3, 2*x3]