Differentiation on Matrix Manifold
Author: Dr. Jack Yansong Li
Affiliation: Liii Network
Email: yansong@liii.pro
Question
How to calculate the derivative of f(X)=logdet(X), where X∈Sn is a n-dimensional positive-definite symmetrical real-valued matrix. Or g(x)=x⊤Ax, where x∈Rn and A∈Sn.
Definitions
Scalar field: A mapping ψ:M→R. The set of all scalar fields on M is denoted by FM.
Example: The functions f and g in the question are scalar fields.
Taylor expansion for a scalar field f:
f(x+Δx)=f(x)+Df(x)[Δx]+21D2f(x)[Δx,Δx]+h.o.t,
where Df maps M→L(M,R) and D2f maps M→BL(M,R).
Notation:
- L(M,R): set of linear maps M→R
- BL(M,R): set of bilinear maps M×M→R
Remark: D2f=D(Df) and L(M,L(M,R))≅BL(M,R).
Vector at x∈M: a linear map v:FM→R.
Example: The perturbation Δx acts as a vector at x via:
Δx(f)≜Df(x)[Δx].
Derivative of g(x)=x⊤Ax
Expand:
g(x+Δx)=(x+Δx)⊤A(x+Δx)=x⊤Ax+x⊤AΔx+Δx⊤Ax+h.o.t.
Using symmetry of A (Δx⊤Ax=x⊤AΔx):
g(x+Δx)≈g(x)+2x⊤AΔx.
By definition of Taylor expansion:
Dg(x)[Δx]=2x⊤AΔx.(1)
Dg(x)∈L(Rn,R). By the Riesz Representation Theorem, there exists a gradient ∇g(x) such that:
Dg(x)[Δx]=⟨∇g(x),Δx⟩Rn.
Comparing with (1) gives ⟨∇g(x),Δx⟩=2x⊤AΔx, so:
∇g(x)=2Ax.
Derivative of f(X)=logdet(X)
Expand:
f(X+ΔX)=logdet(X+ΔX).
Factor X=X1/2X1/2:
f(X+ΔX)=logdet(X1/2(I+X−1/2ΔXX−1/2)X1/2).
Using det(AB)=det(A)det(B):
=logdet(X)+logdet(I+X−1/2ΔXX−1/2).
Let λi be eigenvalues of X−1/2ΔXX−1/2. Then:
f(X+ΔX)=logdet(X)+i=1∑nlog(1+λi).
For small λi, log(1+λi)≈λi, so:
f(X+ΔX)≈logdet(X)+i=1∑nλi.
Since ∑λi=tr(X−1/2ΔXX−1/2) and tr(AB)=tr(BA):
∑λi=tr(X−1ΔX).
Thus:
f(X+ΔX)≈f(X)+tr(X−1ΔX).
Hence:
Df(X)[ΔX]=tr(X−1ΔX).
On Sn, the inner product is ⟨A,B⟩=tr(A⊤B). Since X−1 is symmetric:
tr(X−1ΔX)=⟨X−1,ΔX⟩Sn.
Therefore:
∇f(X)=X−1.
Useful Identities
- det(AB)=det(A)det(B)
- tr(AB)=tr(BA)
- tr(X)=∑i=1nλi, where λi are eigenvalues of X.
Exercise
Calculate the second derivative operator of f(X)=logdet(X) using the expansion method.
Hint 1: Treat Df(⋅)[ΔX] as a scalar field and expand Df(X+δX)[ΔX].
Hint 2: For small A, (I+A)−1≈I−A.
Hint 3: The representation of D2f is a tensor, not necessarily a matrix.
下载题目文件
📥 下载《001_matrix_calculus.tmu》题目文件
提交要求:
- 将答案写在《001_matrix_calculus.tmu》文件末尾
- 重命名为:
001_你的姓名_学校.tmu - 发送至:yansong@liii.pro
- 截止时间:本周日 23:59
奖品: Liii STEM定制文化衫
参与方式:
- 加入QQ群:934456971 获取前置资料
- 下载题目文件并仔细阅读
- 完成题目并按要求提交
← 返回每周一题活动主页