Hessian Matrix Calculator

Analyze any quadratic function f(x, y) = A·x² + B·x·y + C·y² + D·x + E·y + F. Compute the Hessian matrix (matrix of second partial derivatives), its eigenvalues, determinant, and classify critical points as local minima, maxima, or saddle points.

Enter any real numbers. The calculator builds the Hessian matrix from second-order partial derivatives.
? Positive Definite (Min) : f = x² + y²
? Negative Definite (Max) : f = -x² - y²
? Saddle Point : f = x² - y²
? With Linear Terms : f = x² + y² - 2x + 4y
✖️ Cross Term : f = x² + 3xy + y²
⚠️ Degenerate (det=0) : f = x² + 2xy + y²
100% private: All calculations are performed locally in your browser. No data is sent to any server.

What is the Hessian Matrix?

The Hessian matrix (or simply Hessian) is a square matrix of second‑order partial derivatives of a scalar‑valued function. For a twice‑differentiable function f: ℝⁿ → ℝ, the Hessian H(f) encodes local curvature information. In multivariable calculus, the Hessian plays a central role in the second partial derivative test for classifying critical points (local minima, maxima, and saddle points).

For f(x,y) = A x² + B x y + C y² + D x + E y + F,

H = \begin{bmatrix} \frac{\partial^2 f}{\partial x^2} & \frac{\partial^2 f}{\partial x \partial y} \\ \frac{\partial^2 f}{\partial y \partial x} & \frac{\partial^2 f}{\partial y^2} \end{bmatrix} = \begin{bmatrix} 2A & B \\ B & 2C \end{bmatrix}

The Hessian is symmetric (Clairaut's theorem) when second derivatives are continuous. Its eigenvalues determine convexity/concavity: if H is positive definite (all eigenvalues > 0), the function is locally convex → local minimum; negative definite → local maximum; indefinite (mixed signs) → saddle point.

Why Use This Hessian Calculator?

  • Educational Clarity: Instantly see how coefficients affect the Hessian matrix and the shape of the quadratic surface.
  • Optimization & ML: Verify convexity of loss functions, test Newton's method convergence, or analyze quadratic approximations.
  • Physics & Engineering: Stability analysis of mechanical systems (potential energy Hessian).
  • Research & Teaching: Quickly generate examples for lectures, assignments, or self‑study.

Step‑by‑Step Derivation & Interpretation

1. Compute first partial derivatives: ∂f/∂x = 2A x + B y + D ; ∂f/∂y = B x + 2C y + E.
2. Stationary point: Solve ∇f = 0 → linear system: 2A x₀ + B y₀ = -D ; B x₀ + 2C y₀ = -E. Using Cramer's rule (provided det ≠ 0) yields unique critical point.
3. Hessian matrix H: constant independent of (x,y) for quadratic functions. The determinant Δ = (2A)(2C) - B² = 4AC - B².
4. Classification rule: If Δ > 0 and 2A > 0 → local minimum; Δ > 0 and 2A < 0 → local maximum; Δ < 0 → saddle point; Δ = 0 → test inconclusive (degenerate).

For quadratic functions, the Hessian is globally constant, meaning curvature is uniform — classification at the stationary point applies globally. This matches the concept of convex quadratic forms widely used in optimization.

Real‑World Applications

Machine Learning: Loss Landscape Analysis

In linear regression with squared error, the Hessian of the cost function is 2XᵀX (positive semidefinite), guaranteeing convexity and a unique global minimum. For logistic regression, the Hessian varies but remains positive definite under certain conditions. Understanding the Hessian helps debug optimization algorithms like Newton-Raphson.

Structural Mechanics: Potential Energy Minimization

Elastic systems often have potential energy approximated by quadratic forms. Positive definiteness of the Hessian indicates stable equilibrium. Engineers use eigenvalue analysis of the stiffness matrix (essentially a Hessian) to avoid buckling.

The Second Partial Derivative Test – Full Explanation

Given a critical point (x₀, y₀) where ∇f = 0, define D = f_xx f_yy - (f_xy)² = determinant(H). Then:

  • If D > 0 and f_xx > 0 → local minimum.
  • If D > 0 and f_xx < 0 → local maximum.
  • If D < 0 → saddle point.
  • If D = 0 → test fails; higher‑order analysis needed.

Our calculator implements this rule precisely, even when linear terms shift the critical point. For quadratic functions, the result is always exact.

Example Walkthrough

Function Hessian Determinant Stationary Point Classification
f = x² + 2xy + y² [[2,2],[2,2]] 0 line of points (degenerate) Inconclusive (global valley)
f = 3x² + 2y² [[6,0],[0,4]] 24 > 0 (0,0) Local minimum
f = -x² - 3y² [[-2,0],[0,-6]] 12 > 0 (0,0) Local maximum
f = x² - 2xy + y² [[2,-2],[-2,2]] 0 degenerate line Test fails (parabolic cylinder)

Frequently Asked Questions

If the Hessian is positive semidefinite everywhere, f is convex; positive definite → strictly convex. Negative definiteness implies concavity. Our calculator shows definiteness via eigenvalues.

The second derivative test is inconclusive. The critical point may be a minimum, maximum, or saddle along a flat direction. Higher-order terms (or restricted domain) must be analyzed.

This tool focuses on quadratic functions, which provide the exact Hessian everywhere. For general functions, the Hessian varies with (x,y). Check our General Hessian tool for symbolic differentiation (coming soon).

Eigenvalues indicate the directional curvature. Positive eigenvalues → concave up in that eigen-direction; negative → concave down. The definiteness classification directly follows from eigenvalue signs.

Yes, for functions with continuous second partial derivatives (Clairaut's theorem). Quadratic polynomials always satisfy symmetry.

Mathematical Rigor – This tool is built upon established calculus principles (Stewart, "Multivariable Calculus"; Strang, "Calculus"). The classification algorithm follows the standard second partial derivative test. Reviewed by the GetZenQuery math editorial team, updated May 2026. For interactive exploration, each calculation is double‑checked for numerical stability.

References: Wolfram MathWorld – Hessian; Wikipedia: Hessian Matrix; Boyd & Vandenberghe, "Convex Optimization" (2004).