Matrix Calculus Problems
1. Let f : Rm×n → R be defined by f (X) = ∥X∥2F .
∂f
(a) What is the shape of ∂X
?
∂f
(b) Express ∂X
in terms of X.
2. The numerator-layout and denominator-layout notations for derivatives differ in the
placement of transposes. Given
∂y
(numerator-layout),
∂x
rewrite this derivative in denominator-layout form.
3. Let a ∈ Rn be a constant vector and define f (x) = a⊤ x. Compute ∇x f .
4. Let A ∈ Rn×n be a constant symmetric matrix and define g(x) = x⊤ Ax.
(a) Find ∇x g.
∂2g
(b) Compute the Hessian matrix ∂x ∂x⊤
.
5. Define h : Rn → Rm by h(x) = Ax, where A ∈ Rm×n .
(a) Determine the Jacobian matrix of h.
(b) State its dimensions and entries.
∂f
6. Let A ∈ Rp×q be constant and f (X) = tr(AX), with X ∈ Rp×q . Compute ∂X
.
∂f
7. For invertible X ∈ Rn×n , let f (X) = ln det(X). Use Jacobi’s formula to show ∂X
=
(X −1 )⊤ .
8. Let f (X) = X −1 .
(a) Show that d(X −1 ) = −X −1 (dX)X −1 .
∂ vec(X −1 )
(b) Write the derivative ∂ vec(X)
.
9. Given the numerator-layout derivative
∂y
∈ R1×pq ,
∂X
express the same derivative in denominator-layout form
∂y
∈ Rpq×1 .
∂X
10. For F (X) = ∥X∥2F = tr(X ⊤ X), show that
∂F
= 2X.
∂X
(Hint: use tr(X ⊤ X) = Xij2 .)
P
i,j