Back to AI Math Mind Map
中文·English
📐 AI MathID: jacobian-hessian

Jacobian & Hessian

Jacobian 与 Hessian
🎯Core Definition
For f:RnRmf: \mathbb{R}^n \to \mathbb{R}^m, the Jacobian is the m×nm \times n matrix JJ with entries Jij=fi/xjJ_{ij} = \partial f_i / \partial x_j — each row is the gradient row-vector of component fif_i. Dimension-check rule: nn-dimensional input and mm-dimensional output imply a Jacobian of shape m×nm \times n (never n×mn \times m); for a scalar function (m=1m=1) the Jacobian is the transpose of the gradient f\nabla f. It provides the first-order linear approximation f(x+δ)f(x)+J(x)δf(x + \delta) \approx f(x) + J(x)\delta. For the quadratic form f(x)=xTAxf(x) = x^TAx, the gradient is f=(A+AT)x\nabla f = (A + A^T)x, which becomes f=2Ax\nabla f = 2Ax when AA is symmetric. Hessian: for a scalar f:RnRf: \mathbb{R}^n \to \mathbb{R}, the symmetric matrix of second partials Hij=2f/xixjRn×nH_{ij} = \partial^2 f / \partial x_i \partial x_j \in \mathbb{R}^{n \times n}. Convexity criterion: if ff is twice continuously differentiable, ff is convex iff H(x)0H(x) \succeq 0 (positive semidefinite) for all xx, and strictly convex iff H(x)0H(x) \succ 0. Chain rule: for h=gfh = g \circ f, Jh=JgJfJ_h = J_g \cdot J_f, and the shape product (p×m)(m×n)=p×n(p \times m)(m \times n) = p \times n doubles as a consistency check.
💡Use Cases
dimension checking while hand-deriving backprop gradients; Newton's method xt+1=xtH1fx_{t+1} = x_t - H^{-1}\nabla f (second-order curvature); convexity analysis (KL divergence, cross-entropy, quadratic losses); second-order optimization, Fisher information, Laplace approximation.
Key Problems Solved
the most common source of error in matrix-calculus derivations is transposes and shapes — "the Jacobian is always m×nm \times n" plus chain-rule shape multiplication gives a uniqueness check for any derivation; Hessian positive definiteness operationalizes convexity: convex ⟹ local optimum = global optimum, the fundamental criterion for whether a learning objective is tractable; Newton's method exploits curvature H1H^{-1} to converge in one step on ill-conditioned problems where first-order methods crawl along narrow valleys.
🎯5 High-Frequency Exam Points
1
Dimension check: why is the Jacobian of f:RnRmf: \mathbb{R}^n \to \mathbb{R}^m m×nm \times n and not n×mn \times m? Write the Jacobian of f(x,y)=(x2+y,xy)f(x,y) = (x^2 + y, xy) by hand.
2
Derive: gradient (A+AT)x(A + A^T)x and Hessian A+ATA + A^T of the quadratic form f(x)=xTAxf(x) = x^TAx; why does it simplify to 2Ax2Ax when AA is symmetric?
3
By hand: compute the Jacobian/Hessian of f(x1,x2)=x12+3x1x2+2x22f(x_1, x_2) = x_1^2 + 3x_1x_2 + 2x_2^2 and test convexity via the principal-minor criterion (a>0a > 0 and acb2>0ac - b^2 > 0) or eigenvalues.
4
Prove: a twice-differentiable ff is convex iff its Hessian is everywhere positive semidefinite; why does this matter for global optimality (convex ⟹ local = global)?
5
Chain-rule dimension check: for the scalar loss L=Xwy2L = \Vert Xw - y \Vert^2, use the dimension rule to confirm the gradient is 2XT(Xwy)2X^T(Xw - y) and not any other transpose arrangement.
📖 In-depth Guide:📄 linear-algebra-for-ai
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Jacobian & Hessian"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardMatrix Decomposition ApplicationsNext CardProbability Axioms & Bayes

🔗 More AI Math Knowledge Cards

Adam/AdamW MathBayesian InferenceBias-Variance DecompositionBootstrap