




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





.
Appendix D: MATRIX CALCULUS D– 2
In this Appendix we collect some useful formulas of matrix calculus that often appear in finite
element derivations.
Let x and y be vectors of orders n and m respectively:
x =
x 1
x 2 . . .
x (^) n
, y =
y 1
y 2 . . .
ym
where each component yi may be a function of all the x (^) j , a fact represented by saying that y is a
function of x , or
y = y ( x ). (D. 2 )
If n = 1, x reduces to a scalar, which we call x. If m = 1, y reduces to a scalar, which we call y.
Various applications are studied in the following subsections.
§ D.1.1 Derivative of Vector with Respect to Vector
The derivative of the vector y with respect to vector x is the n × m matrix
∂ y
∂ x
∂ y 1
∂ x 1
∂ y 2
∂ x 1
∂ ym
∂ x 1
∂ y 1
∂ x 2
∂ y 2
∂ x 2
∂ ym
∂ x 2
. . .
∂ y 1
∂ x (^) n
∂ y 2
∂ x (^) n
∂ ym
∂ x (^) n
§ D.1.2 Derivative of a Scalar with Respect to Vector
If y is a scalar,
∂ y
∂ x
∂ y
∂ x 1
∂ y
∂ x 2
. . . ∂ y
∂ x (^) n
§ D.1.3 Derivative of Vector with Respect to Scalar
If x is a scalar,
∂ y
∂ x
∂ y 1
∂ x
∂ y 2
∂ x
∂ ym
∂ x
Appendix D: MATRIX CALCULUS D– 4
EXAMPLE D.
The transformation from spherical to Cartesian coordinates is defined by
x = r sin θ cos ψ, y = r sin θ sin ψ, z = r cos θ (D. 11 )
where r > 0 , 0 < θ < π and 0 ≤ ψ < 2 π. To obtain the Jacobian of the transformation, let
x ≡ x 1 , y ≡ x 2 , z ≡ x 3
r ≡ y 1 , θ ≡ y 2 , ψ ≡ y 3
(D. 12 )
Then
J =
∂ x
∂ y
=
sin y 2 cos y 3 sin y 2 sin y 3 cos y 2
y 1 cos y 2 cos y 3 y 1 cos y 2 sin y 3 − y 1 sin y 2
− y 1 sin y 2 sin y 3 y 1 sin y 2 cos y 3 0
= y
2 1 sin^ y^2 =^ r
2 sin θ.
(D. 13 )
The foregoing definitions can be used to obtain derivatives to many frequently used expressions,
including quadratic and bilinear forms.
EXAMPLE D.
Consider the quadratic form
y = x
T Ax (D. 14 )
where A is a square matrix of order n. Using the definition (D.3) one obtains
∂ y
∂ x
= Ax + A
T x (D. 15 )
and if A is symmetric,
∂ y
∂ x
= 2 Ax. (D. 16 )
We can of course continue the differentiation process:
∂
2 y
∂ x^2
=
∂
∂ x
∂ y
∂ x
= A + A
T , (D. 17 )
and if A is symmetric,
∂
2 y
∂ x^2
= 2 A. (D. 18 )
The following table collects several useful vector derivative formulas.
y
∂ y
∂ x
Ax A
T
x
T A A
x
T x 2 x
x
T Ax Ax + A
T x
Let
x =
x 1
x 2
. . .
x (^) n
, y =
y 1
y 2
. . .
yr
and z =
z 1
z 2
. . .
z (^) m
where z is a function of y , which is in turn a function of x. Using the definition (D.2), we can write
∂ z
∂ x
∂ z 1 ∂ x 1
∂ z 1 ∂ x 2
∂ z 1 ∂ x (^) n
∂ z 2 ∂ x 1
∂ z 2 ∂ x 2
∂ z 2 ∂ x (^) n
. . .
∂ z (^) m ∂ x 1
∂ z (^) m ∂ x 2
∂ z (^) m ∂ x (^) n
Each entry of this matrix may be expanded as
∂ z (^) i
∂ x (^) j
∑^ r
q = 1
∂ z (^) i
∂ yq
∂ yq
∂ x (^) j
i = 1 , 2 ,... , m
j = 1 , 2 ,... , n.
Then
∂ z
∂ x
∑ (^) ∂ z 1 yq
∂ yq
∂ x 1
∑ (^) ∂ z 1 ∂ yq
∂ yq
∂ x 2
∑ (^) ∂ z 2 ∂ yq
∂ yq
∂ x (^) n ∑ ∂ z 2 ∂ yq
∂ yq
∂ x 1
∂ z 2 ∂ yq
∂ yq
∂ x 2
∂ z 2 ∂ yq
∂ yq
∂ x (^) n
. . . ∑ (^) ∂ z m ∂ yq
∂ yq
∂ x 1
∑ (^) ∂ z m ∂ yq
∂ yq
∂ x 2
∑ (^) ∂ z m ∂ yq
∂ yq
∂ x (^) n
∂ z 1 ∂ y 1
∂ z 1 ∂ y 2
∂ z 1 ∂ yr
∂ z 2 ∂ y 1
∂ z 2 ∂ y 2
∂ z 2 ∂ yr
. . .
∂ z (^) m ∂ y 1
∂ z (^) m ∂ y 2
∂ z (^) m ∂ yr
∂ y 1 ∂ x 1
∂ y 1 ∂ x 2
∂ y 1 ∂ x (^) n
∂ y 2 ∂ x 1
∂ y 2 ∂ x 2
∂ y 2 ∂ x (^) n
. . .
∂ yr ∂ x 1
∂ yr ∂ x 2
∂ yr ∂ x (^) n
∂ z
∂ y
∂ y
∂ x
∂ y
∂ x
∂ z
∂ y
On transposing both sides, we finally obtain
∂ z
∂ x
∂ y
∂ x
∂ z
∂ y
which is the chain rule for vectors. If all vectors reduce to scalars,
∂ z
∂ x
∂ y
∂ x
∂ z
∂ y
∂ z
∂ y
∂ y
∂ x
§ D.3.1 Functions of a Matrix Determinant
An important family of derivatives with respect to a matrix involves functions of the determinant
of a matrix, for example y = | X | or y = | AX |. Suppose that we have a matrix Y = [ yi j ] whose
components are functions of a matrix X = [ x (^) rs ], that is yi j = f (^) i j ( x (^) rs ), and set out to build the
matrix
∂| Y |
Using the chain rule we can write
∂ x (^) rs
i
j
Y i j
∂ yi j
∂ yi j
∂ x (^) rs
But
j
yi j Y i j , (D. 33 )
where Y i j is the cofactor of the element yi j in | Y |. Since the cofactors Y i 1 , Y i 2 ,... are independent
of the element yi j , we have
∂ yi j
= Y i j. (D. 34 )
It follows that
∂| Y |
∂ x (^) rs
i
j
Y i j
∂ yi j
∂ x (^) rs
There is an alternative form of this result which is ocassionally useful. Define
ai j = Y i j , A = [ ai j ], bi j =
∂ yi j
∂ x (^) rs
, B = [ bi j ]. (D. 36 )
Then it can be shown that
∂| Y |
∂ x (^) rs
= tr( AB
T ) = tr( B
T A ). (D. 37 )
EXAMPLE D.
If X is a nonsingular square matrix and Z = | X | X
− 1 its cofactor matrix,
G =
∂| X |
∂ X
= Z
T
. (D. 38 )
If X is also symmetric,
G =
∂| X |
∂ X
= 2 Z
T − diag( Z
T ). (D. 39 )
Appendix D: MATRIX CALCULUS D– 8
For a scalar function f ( x ), where x is an n -vector, the ordinary differential of multivariate calculus
is defined as
d f =
∑^ n
i = 1
∂ f
∂ x (^) i
d x (^) i. (D. 40 )
In harmony with this formula, we define the differential of an m × n matrix X = [ x (^) i j ] to be
d X
d x 11 d x 12... d x 1 n
d x 21 d x 22... d x 2 n
. . .
d x (^) m 1 d x (^) m 2... d x (^) mn
This definition complies with the multiplicative and associative rules
d (α X ) = α d X , d ( X + Y ) = d X + d Y. (D. 42 )
If X and Y are product-conforming matrices, it can be verified that the differential of their product
is
d ( XY ) = ( d X ) Y + X ( d Y ). (D. 43 )
which is an extension of the well known rule d ( x y ) = y d x + x dy for scalar functions.
EXAMPLE D.
If X = [ x (^) i j ] is a square nonsingular matrix of order n , and denote Z = | X | X
− 1
. Find the differential of the
determinant of X :
d | X | =
i , j
∂| X |
∂ x (^) i j
d x (^) i j =
i , j
X i j dx (^) i j = tr(| X | X
− 1 )
T d X ) = tr( Z
T d X ), (D. 44 )
where X (^) i j denotes the cofactor of x (^) i j in X.
EXAMPLE D.
With the same assumptions as above, find d ( X
− 1 ). The quickest derivation follows by differentiating both
sides of the identity X
− 1 X = I :
d ( X
− 1 ) X + X
− 1 d X = 0 , (D. 45 )
from which
d ( X
− 1 ) = − X
− 1 d X X
− 1
. (D. 46 )
If X reduces to the scalar x we have
d
1
x
= −
dx
x^2
. (D. 47 )