Matrix gradient and Hessian

Problem

For

f(w)=Xwy22+λw22,f(w) = \lVert Xw-y \rVert_2^2 + \lambda \lVert w \rVert_2^2,

derive the gradient and Hessian. State a sufficient condition for strict convexity.

Reveal answer or reference solution
f(w)=2XT(Xwy)+2λw,2f(w)=2XTX+2λI.\nabla f(w) = 2X^{\mathsf T}(Xw-y) + 2\lambda w, \qquad \nabla^2 f(w) = 2X^{\mathsf T}X + 2\lambda I.

It is strictly convex if λ>0\lambda>0, or if XX has full column rank when λ=0\lambda=0.

Local history

Loading attempts saved in this browser…

Use with your agent

Share this URL and your attempt. Ask the agent to start with a clarifying question or the smallest useful hint.

Tutor me on https://mlprep.iwase.dev/mathematics/calculus/original-calc-matrix/. If window.mlPrepAgent is available, read attempts for item original-calc-matrix before tutoring. Inspect my attempt, keep the item ID, and do not reveal the full answer first. After a real attempt, append its record and read it back.

Appears in