For , where , , and is symmetric, how do you derive using differentials and verify every matrix product by its shapes?
Linear algebra and optimisation, Matrix calculus
Level L4 Advanced. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can differentiate a matrix-valued objective cleanly using differentials and trace identities without transposing factors in the wrong order.
Key idea
Express both terms using traces, take the differential via the product and cyclic-trace rules, and match , whose dimensions must match ().
Steps
- Rewrite the Frobenius norm as a trace: where , so .
- Differentiate the first term using : .
- Differentiate the regulariser using symmetry and : .
- Read off the gradient from : .
- Check shapes: is and is , so their product is ; is and is , so is , matching .
Common mistakes
- Writing instead of : the shapes do not even multiply unless , and even then it has the wrong shape.
- Forgetting the factor of cancellation when differentiating , or omitting if were not symmetric.
How long your answer should be
Half a page; 4–5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Linear algebra and optimisation: If a data matrix has singular values , how does adding () change the eigenvalues and condition number of , and why does this explain both numerical stability and Tikhonov regularisation?
Next in Linear algebra and optimisation: How do quasi-Newton methods (BFGS and L-BFGS) approximate the Hessian without computing second derivatives, what are the secant equation and the curvature condition , and how does L-BFGS reduce memory from to ?