Hessian Matrix Calculator

Build the 2×2 Hessian, get D = fxx·fyy − fxy², and classify bowl, dome, or saddle.

Hessian Matrix Calculator

What Is the Hessian Matrix?

The Hessian packages all the second partial derivatives of f(x, y) into one 2×2 matrix:

H = [ fxx fxy ; fyx fyy ]

Symmetric by Clairaut's theorem (fxy = fyx), the Hessian is to curvature what the gradient is to slope: the complete local record of how the surface bends, in every direction at once. Its determinant is the discriminant D = fxxfyy − fxy², the number at the heart of the two-variable second derivative test, the tool that classifies critical points as minima, maxima, or saddles.

The Second Derivative Test in Two Variables

At a critical point (where ∇f = 0), evaluate D and fxx:

DfxxVerdictShape
> 0> 0Local minimumBowl
> 0< 0Local maximumDome
< 0 Saddle pointPringle
= 0 InconclusiveNeeds finer analysis

The logic: D > 0 forces the two axis curvatures to agree in sign and dominate the twist term, so the surface curves the same way in all directions, a true extremum, with fxx's sign picking bowl versus dome. D < 0 means curvatures disagree (or twist wins): up in one direction, down in another, the saddle. It's the exact analogue of the one-variable second derivative test with the mixed partial as the genuinely new ingredient.

How to Use This Calculator

Enter f(x, y). All four second partials are computed symbolically and assembled into H, with the discriminant formula stated. Provide a point and the calculator evaluates the matrix numerically, computes D, and issues the classification, bowl, dome, saddle, or degenerate, in shape language. The chips cover all three decisive cases at the origin of their standard model surfaces, plus a subtler cubic evaluated away from its degenerate center.

Worked Example

f(x, y) = x² − y² at the origin, the canonical saddle. Second partials: fxx = 2, fyy = −2, fxy = 0, so

H = [2, 0; 0, −2], D = (2)(−2) − 0² = −4 < 0: saddle point

The geometry is visible without the theorem: along the x-axis the surface is the upward parabola x², along the y-axis the downward parabola −y², up one way, down the other, the defining saddle behavior, detected algebraically by D's negative sign. The origin is a critical point (both first partials vanish) that is neither a max nor a min: the case one-variable intuition least expects.

Common Mistakes to Avoid

  • Forgetting to square the mixed partial. D = fxxfyy − (fxy)², omitting the square (or the whole term) misclassifies twisted surfaces where the mixed partial does the deciding.
  • Applying the test away from critical points. Classification only means max/min/saddle where ∇f = 0. Elsewhere, H still describes curvature, but there's no extremum to classify, find critical points first (∂f/∂x = ∂f/∂y = 0), then test.
  • Reading D = 0 as "saddle" or "min." Degenerate means the quadratic terms are silent and higher-order terms decide, the monkey saddle x³ − 3xy² at the origin is the classic example, which is why its chip evaluates at (1,1) instead.
  • Checking fyy instead of fxx inconsistently. When D > 0, fxx and fyy necessarily share a sign, so either works, but mixing them mid-argument invites sign slips.

Real-World Applications

The Hessian is the central object of optimization beyond the first order. Newton's method for minimization solves H·step = −∇f each iteration, using curvature to take smarter steps than gradient descent, the approach inside classical statistics' maximum-likelihood fitting and countless engineering optimizers. In deep learning, Hessian eigenvalues diagnose the loss landscape: sharp minima versus flat ones (with implications for generalization), saddle-point prevalence in high dimensions, and the conditioning that makes training easy or hard, modern research estimates Hessian spectra of networks with billions of parameters.

In physics and chemistry, the Hessian of a molecule's energy surface at an equilibrium, the force-constant matrix, has eigenvalues that are the squared vibrational frequencies measured in infrared spectra; a negative eigenvalue flags a transition state, chemistry's version of the saddle. In economics, the Hessian's definiteness certifies that a candidate optimum of profit or utility genuinely is one (second-order conditions), and in statistics the observed information matrix, the negative Hessian of log-likelihood, sets the error bars on every fitted parameter.

Frequently Asked Questions

What do the Hessian's eigenvalues mean?

The principal curvatures: the surface's strongest upward and downward bending rates, along perpendicular eigenvector directions. Both positive → bowl; both negative → dome; mixed signs → saddle, the eigenvalue story behind the D-and-fxx shortcut, and the version that survives into n dimensions where the shortcut doesn't.

Why does D > 0 with fxx > 0 guarantee a minimum?

D > 0 is exactly the condition that the quadratic form ax² + 2bxy + cy² (a = fxx b = fxy c = fyy) has one sign for all directions; fxx > 0 pins that sign positive. Every direction curves upward, the definition of a local minimum's shape.

How does this generalize to three or more variables?

H becomes n×n; classification reads off eigenvalue signs (all positive → min, all negative → max, mixed → saddle) or leading principal minors (Sylvester's criterion). The 2-variable D-test is Sylvester's criterion in its smallest clothes.

What exactly happens in the degenerate D = 0 case?

The second-order approximation flattens in some direction, and third- or higher-order terms take over, outcomes range from valleys (x² alone in 2D) to monkey saddles (three valleys meeting). Analysis proceeds by examining f along curves through the point, case by case.

Is the Hessian related to the Jacobian?

Precisely: the Hessian of f is the Jacobian of f's gradient, differentiate the vector field ∇f and H appears. First derivatives of a vector map, second derivatives of a scalar: same matrix machinery one rung apart.

Why are saddles said to dominate in high dimensions?

A critical point in n dimensions needs all n Hessian eigenvalues to share a sign to be an extremum; with each sign roughly a coin flip, pure minima become exponentially rare and mixed-sign saddles the overwhelming norm. This counting argument reshaped deep-learning theory, the obstacle to optimizing huge networks turns out to be saddle plateaus, not the once-feared bad local minima.