Professional Documents
Culture Documents
a r t i c l e i n f o a b s t r a c t
Article history: The partial derivatives of scalar functions, vector functions, and matrix functions with
Received 29 May 2009 respect to a vector variable have many practical applications in the study of dynamics
Received in revised form 24 February 2010 and control of mechanical systems. The paper firstly presents an overview of the
Accepted 6 March 2010
matrix calculus related to Kronecker products. Secondly, two theorems establishing the
Available online 9 April 2010
relationship between the time derivative of a matrix and its partial derivative with respect
to a vector, and the partial derivative of the product of two matrices with respect to a
Keywords: vector will be presented. Finally, a new matrix form of Lagrangian equations is developed
Partial derivative of matrix functions
to demonstrate the usefulness of these theorems in the study of dynamics of mechanical
Kronecker product
systems.
Lagrangian equations
Robot dynamics © 2010 Elsevier Ltd. All rights reserved.
Mechanism dynamics
1. Introduction
The partial derivatives with respect to a vector variable of scalar functions, vector functions, and matrix functions
have many practical applications in dynamics and control of mechanical systems. The partial derivatives of scalar
functions and vector functions are used in dynamics of multibody systems [1–5] and also in robot dynamics [6–10].
However, the investigation of the partial derivative of matrix functions with respect to a vector variable is still limited
[6].
The first part of this paper reviews the definitions of partial derivatives of scalar function and vector function with
respect to a vector variable. Based on these definitions, the partial derivative of matrix function with respect to a vector
variable will be defined in Section 2; the matrix product and the Kronecker product will be reviewed in Section 3. The two
theorems and their proofs establishing the time derivative of a matrix and its partial derivative with respect to a vector,
and the partial derivative of product of two matrices with respect to a vector, will be presented in Sections 4 and 5,
respectively.
In the second part, the application of the theoretical results obtained to establish a new matrix form of Lagrangian equations for
mechanical systems will be presented.
0094-114X/$ – see front matter © 2010 Elsevier Ltd. All rights reserved.
doi:10.1016/j.mechmachtheory.2010.03.005
982 N. Van Khang / Mechanism and Machine Theory 45 (2010) 981–988
In the present study, vectors are represented in column forms. For example, vector x ∈ ℝn is an n-dimensional column vector,
and its transpose has following form
T
x = ½ x1 x2 … x n :
∂α ∂α ∂α ∂α
= ; ; …; : ð1Þ
∂x ∂x 1 ∂x 2 ∂x n
2 3 2 3
∂a1 ∂a1 ∂a1 ∂a1
6 7 6 ∂x ⋯
6 ∂x 7 6 1 ∂x2 ∂xn 7
7
6 7 6 7
6 ∂a2 7 6 ∂a ∂a2 ∂a2 7
∂a 6 7 6 2 ⋯ 7
=6
6 ∂x 7 = 6 ∂x
7 6 1 ∂x2 ∂xn 7
7: ð2Þ
∂x 6 7 6 7
6 ⋮ 7 6 ⋯ ⋯ ⋯ ⋯ 7
6 7 6 7
4 ∂a 5 4 ∂am ∂am ∂am 5
m ⋯
∂x ∂x1 ∂x2 ∂xn
2 3
a11 a12 ::: a1p
6 a21 a22 ::: a2p 7 h i
6
A=4 7 = a1 ; a2 ; …; ap
::: ::: ::: ::: 5
am1 am2 ::: amp
2 3
∂a11 ∂a12 ∂a1p
6 ⋯ 7
6 ∂x ∂x ∂x 7
6 7
6 7
6 ∂a21 ∂a22 ∂a2p 7
∂A ∂ap 6 ⋯ 7
= ∂a1 ∂a2
⋯ =6
6 ∂x ∂x ∂x 77
∂x ∂x ∂x ∂x 6 7
6 ⋯ ⋯ ⋯ ⋯ 7
6 7
6 7
4 ∂a ∂am2 ∂amp 5
m1
⋯
∂x ∂x ∂x
2 3 ð3Þ
∂a11 ∂a11 ∂a12 ∂a12 ∂a1p ∂a1p
6 ::: ::: ::: ::: 7
6 ∂x1 ∂xn ∂x1 ∂xn ∂x1 ∂xn 7
6 7
6 7
6 ∂a ∂a2p ∂a2p 7
6 21 ∂a21 ∂a22 ∂a22 7
6 ::: ::: ::: ::: 7
= 6 ∂x1 ∂xn ∂x1 ∂xn ∂x1 ∂xn 7:
6 7
6 ::: ::: ::: ::: 7
6 7
6 7
6 7
4 ∂am1 ∂am1 ∂am2 ∂am2 ∂amp ∂amp 5
::: ::: ::: :::
∂x1 ∂xn ∂x1 ∂xn ∂x1 ∂xn
N. Van Khang / Mechanism and Machine Theory 45 (2010) 981–988 983
Note that the partial derivative of a scalar function α(x) with respect to a vector variable x is defined as a row matrix, which is
rarely used in the literature. The partial derivative of matrix function A(x) according to Eq. (3) is fully consistent with Eq. (2).
Let's review some basic concepts of matrix calculus that help understand the proofs of the theorems presented in the following
sections, which are useful to establish dynamical equations of mechanical systems.
Definition 4. Matrix product of two matrices
The product of two matrices A(x) ∈ ℝm × p and B(x) ∈ ℝp × s is a matrix C(x) ∈ ℝm × s defined by [11–13]
2 3
c11 c12 … c1s
6 c21 c22 … c2s 7 p
C = AB = 6
4 …
7 where cij = ∑ aik bkj : ð4Þ
… … …5 k=1
cm1 cm2 … cms
Remark. The number of columns of matrix A must be equal to the number of rows of matrix B.
Definition 5. Kronecker product of two matrices
The Kronecker product of two matrices A(x)∈ ℝm × p and B(x) ∈ℝq × s, denoted by A ⊗ B, is a mq ×ps matrix defined as [12–14]
2 3
a11 B a12 B … a1p B
6 a21 B a22 B … a2p B 7
6
A⊗B = 4 7: ð5Þ
… … … … 5
am1 B am2 B … amp B
Example 1. The following expression for matrix A ∈ ℝn × n and vector b ∈ ℝp can be obtained
2 3
a11 b a12 b … a1n b
6 a21 b a22 b … a2n b 7
A⊗b = 6
4 …
7∈ℝn × np :
… … … 5
an1 b an2 b ⋯ ann b
2 3 2 3
b 0 … 0 b1 In
60 b … 07 6 b2 In 7
In ⊗b = 6 7 ; b⊗In = 6 7
np × n np × n
4 … … … … 5∈ℝ 4 ⋮ 5∈ℝ : ð6Þ
0 0 ⋯ b b I
p n
4. Relationships between the time derivative of a matrix and its partial derivative with respect to a vector
Theorem 1. When matrix A(x) ∈ ℝm × p is a function of vector x ∈ ℝn, and x(t) is a function of the time, we have the following rule
dAðxÞ ∂AðxÞ
= ðIn ⊗ẋÞ: ð7Þ
dt ∂x
2 3
ȧ11 ðxÞ ::: ȧ1p ðxÞ ∂aij
dAðxÞ n
= 4 ::: ::: ::: 5 where ȧij = ∑ ẋ ð8Þ
dt ȧ ðxÞ ::: ȧmp ðxÞ k = 1 ∂xk k
m1
984 N. Van Khang / Mechanism and Machine Theory 45 (2010) 981–988
The partial derivative of the matrix A with respect to vector x is given by Eq. (3). Using the Eq. (6) of Kronecker product In ⊗ ẋ,
the right hand side of Eq. (7) yields
2 3
∂a11 ∂a12 ∂a1p
6 ⋯ 7
6 ∂x ∂x ∂x 72 3
6 7 ẋ 0 … 0
6 7
6 ∂a21 ∂a22 ∂a2p 76 7
∂AðxÞ 6 ⋯ 76 0 ẋ … 0 7
ðIn ⊗ẋÞ = 6
6 ∂x ∂x ∂x 7 6
76
7
7
∂x 6 74 … … … … 5
6 ⋯ ⋯ ⋯ ⋯ 7
6 7 0 0 ⋯ ẋ
6 7
4 ∂a ∂am2 ∂amp 5
m1
⋯
∂x ∂x ∂x ð9Þ
2 3
∂a11 ∂a11 ∂a1p ∂a1p
6 ẋ1 + ::: + ẋ ; ⋯ ẋ1 + ::: + ẋn 7
6 ∂x1 ∂xn n ∂x1 ∂xn 7
6 7
6 ⋯ ⋯ ⋯ 7
=6 7⋅
6 7
6 7
4 ∂am1 ∂am1 ∂amp ∂amp 5
ẋ + ::: + ẋ ; ⋯ ẋ1 + ::: + ẋn
∂x1 1 ∂xn n ∂x1 ∂xn
The right hand side of Eq. (9) is identical to that of Eq. (8); Theorem 1 therefore is proved.
Theorem 2. Let the matrices A(x) ∈ ℝm × p and B ∈ ℝp × s be functions of vector x ∈ ℝn. Then the partial derivative of the matrix product
A(x)B(x) with respect to vector x is given by
∂ ∂AðxÞ ∂B
ðAðxÞBðxÞÞ = ðBðxÞ⊗In Þ + A ð10Þ
∂x ∂x ∂x
2 3 2 p p 3 2 p p 3
∂c11 ∂c12 ∂c1s ∂a1k ∂a1k ∂bk1 ∂bks
6 ∂x ⋯ 7 6 ∑ b ; ⋯
∂x k1
;∑ bks 7 6 ∑ a1k ∂x ; ⋯ ; ∑ a1k
∂x 7
6 ∂x ∂x 7 6 k=1 k = 1 ∂x 7 6 k=1 k=1 7
∂ðABÞ ∂C 6 7 6 7
= =6
6 ⋯ ⋯ ⋯ ⋯ 77= 6 ⋯ ⋯ ⋯ 7+6 ⋯ ⋯ ⋯ 7 = K1 + K2
∂x ∂x 4 ∂c 6 p 7 6 p 7
m1 ∂cm2 ∂cms 5 4 ∂amk p
∂amk 5 4 ∂bk1 p
∂bks 5
⋯ ∑ b ; ⋯ ;∑ bks ∑ amk ; ⋯ ; ∑ amk
∂x ∂x ∂x k=1 ∂x k1 k = 1 ∂x k=1 ∂x k=1 ∂x
ð11Þ
where the symbols K1 and K2 denote the first and the second term in the right hand side, respectively.
Note that
2 3
b11 In b12 In ::: b1s In
6 b21 In b22 In ::: b2s In 7
B⊗In = 6
4 :::
7: ð12Þ
::: ::: ::: 5
bp1 In bp2 In ::: bps In
The matrix product of the above expression with that of in Eq. (3) yields
2 3
∂a11 ∂a12 ∂a1p
6 ∂x ⋯ 72
6 ∂x ∂x
7 b I 3
6 7 11 n b12 In ::: b1s In
∂A 6 ∂a21 ∂a22 76 b I
∂a2p ::: b2s In 7
6 ⋯ 76 21 n b22 In 7
ðB⊗In Þ = 6 ∂x ∂x 7 ð13Þ
∂x 6 ∂x 74 ::: ::: ::: ::: 5
6 ⋯ ⋯ ⋯ ⋯ 7 ::: bps In
6 7 bp1 In bp2 In
4 ∂amp 5
∂am1 ∂am2
⋯
∂x ∂x ∂x
N. Van Khang / Mechanism and Machine Theory 45 (2010) 981–988 985
∂A
K1 = ðB⊗In Þ: ð14Þ
∂x
2 3 2 T3
∂b1 ∂b2 ∂bs a1
6 aT1 aT1 ⋯ aT1 6 7
6 ∂x ∂x ∂x 77 6 aT 7
6 2 7 ∂b1 ∂b2 ∂bs
K2 = 6
6 ⋯ ⋯ ⋯ ⋯ 7 7 = 6 7 ::: ð15Þ
4 5 6 ::: 7 ∂x ∂x ∂x
T ∂b T ∂b T ∂bs 4 5
am 1 am 2 ⋯ am
∂x ∂x ∂x aTm
where
2 3
b1j
6 b2j 7
T
ai = ai1 ai2 … aip ; bj = 6 7
4 ⋮ 5 for i = 1; 2; …; m and j = 1; 2; …; s:
bpj
According to Eq. (3), Eq. (15) can be rewritten in the following form
∂B
K2 = A : ð16Þ
∂x
Substituting Eqs. (14) and (16) into Eq. (11) we obtain the same rule as shown in Eq. (10).
The theorem is valid for any sizes of matrices A(x), B(x). Therefore, from Eq. (10) the following important consequences can be
found: let matrix A ∈ ℝm × p, vectors a, b ∈ ℝp, and scalars α, β ∈ ℝ be functions of vector x ∈ ℝn, then we obtain from Eq. (10) the
following relationships
∂ ∂AðxÞ ∂b
ðAðxÞbðxÞÞ = ðb⊗In Þ + A ; ð17Þ
∂x ∂x ∂x
∂ ∂a ∂β
ðaðxÞβðxÞÞ = ðβ⊗In Þ + a ; ð18Þ
∂x ∂x ∂x
∂ ∂α ∂β
ðαðxÞβðxÞÞ = ðβ⊗In Þ + α ; ð19Þ
∂x ∂x ∂x
∂ aT b ∂aT T ∂b
= ðb⊗In Þ + a : ð20Þ
∂x ∂x ∂x
Consider a scleronomic multibody system S with n degrees-of-freedom described by the generalized coordinates q = [q1, ..., qn]T.
The kinetic energy T of the system can be expressed as [1–5]
1 T 1 T
T= q̇ MðqÞq̇ = q̇ bðq;q̇Þ ð21Þ
2 2
where b(q,q̇) = M(q)q̇, and the n × n inertia matrix M(q) has the following form [1–5]
p
T T T
MðqÞ = ∑ mi JTi JTi + JRi Ii JRi = M ðqÞ: ð22Þ
i=1
In general, Lagrangian equations of multibody systems have the following compact form [1–5]
T
d ∂T T ∂T
− =f ð23Þ
dt ∂q̇ ∂q
To apply Eq. (23) we must calculate partial derivatives of the kinetic energy T with respect to vectors q and q̇. Firstly, using
Eq. (20) the partial derivative of the kinetic energy T with respect to vector q̇ is given as
" #
1 ∂ T
T
∂T 1 ∂q̇ T ∂b
= q̇ b = ðb⊗In Þ + q̇ ð24Þ
∂q̇ 2 ∂q̇ 2 ∂q̇ ∂q̇
where
2 3
b1 In
h i6 h i
b2 In 7
T
∂q̇
ðb⊗In Þ = e1 ; e2 ; …; en 6 7 = b1 eT1 In + b2 eT2 In + … + bn eTn In = ½b1 ; b2 ; :::; bn = bT = ½MðqÞq̇T = q̇T MðqÞ;ð25Þ
T T T
∂q̇ 4 ⋯ 5
bn In
and
T ∂b T ∂ T ∂MðqÞ ∂q̇ T T
q̇ = q̇ ½MðqÞq̇ = q̇ ðq̇⊗In Þ + MðqÞ = q̇ MðqÞIn = q̇ MðqÞ: ð26Þ
∂q̇ ∂q̇ ∂q̇ ∂q̇
∂T T
= q̇ MðqÞ:
∂q̇
Thus
T
∂T d ∂T T
= MðqÞq̇; = MðqÞq̈ +ṀðqÞq̇: ð27Þ
∂q̇ dt ∂q̇
Now we calculate the partial derivative of the kinetic energy T with respect to vector q
" #
∂T 1 ∂ T 1 ∂q̇T T ∂b 1 T ∂ 1 T ∂MðqÞ ∂q̇ 1 T ∂MðqÞ
= q̇ b = ðb⊗In Þ + q̇ = q̇ ðMðqÞq̇Þ = q̇ ðq̇⊗In Þ + MðqÞ = q̇ ðq̇⊗In Þ:
∂q 2 ∂q 2 ∂q ∂q 2 ∂q 2 ∂q ∂q 2 ∂q
ð28Þ
∂MðqÞ
ṀðqÞ = ðIn ⊗q̇Þ: ð31Þ
∂q
T
∂MðqÞ 1 ∂MðqÞ
Cðq; q̇Þ = ðIn ⊗q̇Þ− ðq̇⊗In Þ ; ð33Þ
∂q 2 ∂q
N. Van Khang / Mechanism and Machine Theory 45 (2010) 981–988 987
the Lagrangian equations of multibody system, Eq. (23), can be rewritten in the compact matrix form
::
MðqÞq + Cðq; q̇Þq̇ = f: ð34Þ
The matrix C(q, q̇) is called a Coriolis/Centripetal matrix. Based on the described algorithm in order to calculate the Coriolis/
Centripetal matrix, a program for dynamic analysis of robot manipulators in MAPLE computer algebraic system has been
developed at the Hanoi University of Technology.
Example 2. To illustrate how Lagrangian equations in matrix form can be applied to a multibody system, we consider a planar
two-link manipulator as shown in Fig. 1. The following notation will be used: qi (i = 1, 2) denotes the joint angles, which also
serves as generalized coordinates; mi denotes the mass of i-th link; li is the length of i-th link; lCi = li/2 the distance from the
previous joint to the center of mass of i-th link; and Ii the moment of inertia of the link about the axis passing through the center of
mass and perpendicular to the plane of motion. The inertia matrix M(q) takes the form [9,10]
2 ! ! 3
2 2 2
l1 2 l2 l2 l l
6 1
m + m2 l 1 + + l l
1 2 cosq 2 + Iz1 + Iz2 m2 + 1 2 cosq2 + Iz2 7
6 4 4 4 4 7
6 7
MðqÞ = 6 ! 7: ð35Þ
6 l22 l2 7
4 l1 l2 5
m2 + cosq2 + Iz2 m2 2 + Iz2
4 4 4
Using the software MAPLE, we can quickly and conveniently calculate the Coriolis/Centripetal matrix with the following
command
1
− ⁎ðtransposeðmultiplyðdMq; KroneckerProduct ðqp; InÞÞÞÞ;
2
T
∂MðqÞ 1 ∂MðqÞ
Cðq; q̇Þ = ðIn ⊗q̇Þ− ðq̇⊗In Þ ð36Þ
∂q 2 ∂q
2 3
1
6 −m2 l1 l2 q̇2 sinq2 − m2 l1 l2 q̇2 sinq2 7
2
=6
4
7:
5
1 1 1
− m2 l1 l2 q̇2 sinq2 + m2 l1 l2 q̇1 sinq2 − m2 l1 l2 q̇1 sinq2
4 2 4
1
f2 = τ 2 + m gl cosðq1 + q2 Þ−Px l2 sinðq1 + q2 Þ + Py l2 cosðq1 + q2 Þ:
2 2 2
7. Conclusions
The purpose of this paper is to use a consistent notation of partial derivative of matrix functions with respect to vector variables
and the Kronecker product for the automatic construction of dynamical equations of mechanical systems. Eqs. (1), (2), and (3)
represent consistent definitions of partial derivatives of a scalar function, a vector function, and a matrix function with respect to a
vector variable, respectively. The theorems expressed by Eqs. (7) and (10) are simple and very convenient to use.
A new form of Lagrangian equations has been established and expressed by Eqs. (33) and (34). The proposed form of motion
equations is written in the compact matrix form, which enables us to construct the motion equations of mechanical systems
conveniently by means of computer software packages such as MAPLE, MATHCAD, and MATHEMATICA.
The theoretical results obtained in this paper can also be applied to derive the balancing conditions of spatial mechanisms, and
that will be presented in other works.
Acknowledgements
This paper was completed with the financial support given by the National Foundation for Science and Technology
Development of Vietnam.
References