Docsity

Matrix Calculus: Derivatives of Vector Functions and the Chain Rule, Summaries of Calculus

Partial preview of the text

Download Matrix Calculus: Derivatives of Vector Functions and the Chain Rule and more Summaries Calculus in PDF only on Docsity!

.

D

Matrix

Calculus

Appendix D: MATRIX CALCULUS D– 2

In this Appendix we collect some useful formulas of matrix calculus that often appear in finite

element derivations.

§ D.1 THE DERIVATIVES OF VECTOR FUNCTIONS

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

, (D. 1 )

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

def

∂ 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. 3 )

§ D.1.2 Derivative of a Scalar with Respect to Vector

If y is a scalar,

∂ y

∂ x

def

∂ y

∂ x 1

∂ y

∂ x 2

. . . ∂ y

∂ x (^) n

. (D. 4 )

§ D.1.3 Derivative of Vector with Respect to Scalar

If x is a scalar,

∂ y

∂ x

def

[

∂ y 1

∂ x

∂ y 2

∂ x

∂ ym

∂ x

]

(D. 5 )

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

D– 5 §D.2 THE CHAIN RULE FOR VECTOR FUNCTIONS

§ D.2 THE CHAIN RULE FOR VECTOR FUNCTIONS

Let

x =

x 1

x 2

. . .

x (^) n

, y =

y 1

y 2

. . .

yr

and z =

z 1

z 2

. . .

z (^) m

(D. 19 )

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

) T

∂ 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

(D. 20 )

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.

(D. 21 )

Then

∂ z

∂ x

) T

∑ (^) ∂ 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

) T (

∂ y

∂ x

) T

∂ y

∂ x

∂ z

∂ y

) T

. (D. 22 )

On transposing both sides, we finally obtain

∂ z

∂ x

∂ y

∂ x

∂ z

∂ y

, (D. 23 )

which is the chain rule for vectors. If all vectors reduce to scalars,

∂ z

∂ x

∂ y

∂ x

∂ z

∂ y

∂ z

∂ y

∂ y

∂ x

, (D. 24 )

D– 7 §D.4 THE MATRIX DIFFERENTIAL

§ 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 |

∂ X

. (D. 31 )

Using the chain rule we can write

∂| Y |

∂ x (^) rs

i

j

Y i j

∂| Y |

∂ yi j

∂ yi j

∂ x (^) rs

. (D. 32 )

But

| Y | =

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

∂| Y |

∂ yi j

= Y i j. (D. 34 )

It follows that

∂| Y |

∂ x (^) rs

i

j

Y i j

∂ yi j

∂ x (^) rs

. (D. 35 )

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

§ D.4 THE MATRIX DIFFERENTIAL

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

def

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

. (D. 41 )

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 )