← Back to AI Math Mind Map
📐 AI MathID: jacobian-hessian

Jacobian & Hessian

Jacobian 与 Hessian
🎯Core Definition
For f:Rn→Rmf: \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:Rn→Rf: \mathbb{R}^n \to \mathbb{R}, the symmetric matrix of second partials Hij=∂2f/∂xi∂xj∈Rn×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=g∘fh = g \circ f, Jh=Jg⋅JfJ_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=xt−H−1∇fx_{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 H−1H^{-1} to converge in one step on ill-conditioned problems where first-order methods crawl along narrow valleys.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Jacobian & Hessian.
Use Cases
In production engineering, what are the primary use cases for Jacobian & Hessian and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Dimension check: why is the Jacobian of f:Rn→Rmf: \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 ac−b2>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=∥Xw−y∥2L = \Vert Xw - y \Vert^2, use the dimension rule to confirm the gradient is 2XT(Xw−y)2X^T(Xw - y) and not any other transpose arrangement.
📖 In-depth Guide:📄 linear-algebra-for-ai →
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Jacobian & Hessian"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardMatrix Decomposition ApplicationsNext Card →Probability Axioms & Bayes

🔗 More AI Math Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/Math/card/jacobian-hessian
中文速览与面试要点

Jacobian 与 Hessian (Jacobian & Hessian)

定义: 对 f: R^n R^m, Jacobian 是 m n 矩阵 J, 分量 J_ij = f_i / x_j — 每行是分量函数 f_i 的梯度行向量; 维度检查法则: 输入 n 维、输出 m 维 ⟹ Jacobian 形状 m n (不是 n m); 标量函数 (m=1) 的 Jacobian 是其梯度 f 的转置。它给出 f 的一阶线性近似 f(x + ) f(x) + J(x) 。二次型 f(x) = x^TAx 的梯度为 f = (A + A^T)x, A 对称时 f = 2Ax。Hessian: 标量函数 f: R^n R 的二阶偏导矩阵 H_ij = ^2 f / x_i x_j R^n n (对称); 凸性判定: f 二阶连续可微时, f 凸当且仅当 H(x) 对所有 x 半正定 (H 0), 严格凸当且仅当正定 (H 0)。链式法则: 对 h = g f, J_h = J_g J_f, 维度相乘 (p m)(m n) = p n 可作一致性校验。 使用场景: 反向传播手推梯度时的维度核对; 牛顿法 x_t+1 = x_t - H^-1 f (二阶曲率); 凸性分析 (KL 散度、交叉熵、二次损失); 二阶优化、Fisher 信息矩阵、拉普拉斯近似。 解决的问题: 矩阵求导手推的最大错误来源是转置与维度——"Jacobian 恒为 m n"与链式法则的形状相乘可作为推导唯一性校验; Hessian 正定性给出判定凸函数的操作化标准: 凸 ⟹ 局部最优 = 全局最优, 机器学习损失可解性的根本判据; 牛顿法用曲率 H^-1 对病态问题 (条件数大) 一步收敛, 而一阶法需要沿等高线反复走。

核心要点

  • 维度检查: 为什么 f: R^n R^m 的 Jacobian 是 m n 而非 n m? 手写 f(x,y) = (x^2 + y, xy) 的 Jacobian?
  • 推导: 二次型 f(x) = x^TAx 的梯度 (A + A^T)x 与 Hessian A + A^T; A 对称时为何简化为 2Ax?
  • 手算: 对 f(x_1, x_2) = x_1^2 + 3x_1x_2 + 2x_2^2 求 Jacobian/Hessian, 用主元判据 (a > 0 且 ac - b^2 > 0) 或特征值判断凸性?
  • 证明: 二阶可微 f 凸当且仅当 Hessian 处处半正定; 为什么这对全局最优性至关重要 (凸 ⟹ 局部 = 全局)?
  • 链式法则维度核对: 标量损失 L = Xw - y ^2 对 w 的梯度, 用维度法则确认答案是 2X^T(Xw - y) 而非其他转置组合?