Interactive Hesse (Hessian) Matrix Calculator
Enter a two-variable function f(x, y) and a point (x, y). The calculator estimates second partial derivatives numerically and builds the Hessian matrix:
H = [[fxx, fxy], [fyx, fyy]]
Supported functions: sin, cos, tan, asin, acos, atan, sqrt, log, ln, exp, abs, floor, ceil, round. Constants: pi, e.
What Is a Hesse Matrix?
The Hesse matrix (also called the Hessian matrix) is a square matrix of second-order partial derivatives of a scalar function. For a function of two variables, f(x, y), the Hessian is:
H(x, y) = [[∂²f/∂x², ∂²f/∂x∂y], [∂²f/∂y∂x, ∂²f/∂y²]]
It describes local curvature and plays a central role in optimization, machine learning, economics, engineering design, and multivariable calculus.
Why the Hessian Matters
1) Classifying critical points
After finding points where the gradient is zero, the Hessian helps determine whether each point is a local minimum, local maximum, saddle point, or inconclusive. In two variables, the determinant test uses:
- D = fxx·fyy − (fxy)²
- If D > 0 and fxx > 0: local minimum
- If D > 0 and fxx < 0: local maximum
- If D < 0: saddle point
- If D = 0: test is inconclusive
2) Optimization algorithms
Second-order optimization methods (like Newton’s method) use the Hessian to choose better search directions than gradient-only methods. This can dramatically speed up convergence when the Hessian is well-conditioned.
3) Curvature insight
The Hessian captures how a surface bends in each direction and between directions. The diagonal terms measure pure curvature in x and y; off-diagonal terms measure interaction between variables.
How This Calculator Works
This tool uses central finite differences to approximate derivatives at your chosen point:
fxx ≈ (f(x+h,y) − 2f(x,y) + f(x−h,y)) / h²fyy ≈ (f(x,y+h) − 2f(x,y) + f(x,y−h)) / h²fxy ≈ (f(x+h,y+h) − f(x+h,y−h) − f(x−h,y+h) + f(x−h,y−h)) / (4h²)
For smooth functions and reasonable values of h, this produces accurate practical estimates.
Usage Tips
- Use explicit multiplication:
3*x*yinstead of3xy(the calculator handles many implicit cases, but explicit input is safest). - Use
^for exponent, such asx^2. - If your function includes logs or square roots, choose points in the valid domain.
- If results look noisy, try a different step size h (for example,
1e-4to1e-5).
Example Interpretation
For f(x,y)=x^3+y^3-3xy at (1,1), the gradient is near zero, and the Hessian indicates the point is a local minimum. This matches the geometry of the function around that point.
Limitations
Numerical differentiation is approximate. Very small step sizes can introduce floating-point rounding error, while very large step sizes can reduce accuracy. Also, if the function is non-smooth (kinks or cusps), second derivatives may not exist or may behave poorly.
Bottom Line
The Hesse matrix is one of the most useful tools in multivariable analysis. With this calculator, you can quickly estimate curvature, test critical points, and build intuition for optimization and surface geometry in two variables.