Hessian Matrix Calculator
Introduction: what the Hessian matrix means for f(x, y)
The Hessian matrix packages the second partial derivatives of a function into one square matrix, so you can see how the surface bends in different directions near a chosen point. In this calculator, the focus is on a two-variable function written as f(x, y), because that is the form needed for the 2×2 Hessian shown below and for the second-derivative test used by the tool.
At a point (x, y), the 2×2 Hessian matrix is
Here:
f_xxis the second partial derivative with respect tox,f_yyis the second partial derivative with respect toy,f_xyandf_yxare the mixed partial derivatives.
When the function is twice continuously differentiable, the mixed partials agree, so the Hessian is symmetric and the two off-diagonal entries should match once the expression is differentiated successfully.
How to use the Hessian Matrix Calculator
This Hessian matrix calculator evaluates f(x, y) at one coordinate pair and then applies the second-derivative test to the curvature data it finds. Use it when you want to see whether a point behaves like a local minimum, a local maximum, a saddle point, or a case where second derivatives do not decide the outcome.
- Enter the function in the field labeled Function f(x, y).
- Enter the point where you want to evaluate the Hessian:
- Type the x coordinate in the corresponding box.
- Type the y coordinate in the corresponding box.
- Click the compute button to calculate the second partial derivatives and build the Hessian matrix at that point.
- Read the output:
- The calculator shows the Hessian entries
f_xx,f_xy,f_yx, andf_yyevaluated at your point. - It also computes the determinant of the Hessian and uses the second-derivative test to classify the point.
- The calculator shows the Hessian entries
That makes the tool useful for checking multivariable calculus homework, testing symbolic differentiation, or confirming the local shape of a surface you have already sketched by hand.
Input format for Hessian calculations
The function field accepts ordinary calculator-style syntax for f(x, y), so you can describe the surface without switching to another algebra system. The important part is that the expression depends on x and y in a form the parser can differentiate twice.
- Variables: use
xandyfor the two coordinates. - Addition and subtraction:
x + y,x - 2*y. - Multiplication: use an explicit star, for example
x*y,2*x*y,x*(y + 1). - Division: use
/, for examplex/y,(x^2 + y^2)/(1 + x^2). - Powers: use
^, such asx^2,y^3,(x^2 + y^2)^0.5. - Standard functions: common functions like
sin,cos,tan,exp,logorln,sqrtare usually allowed, for examplesin(x)*cos(y),exp(x^2 + y^2),ln(1 + x^2 + y^2). - Constants: numeric constants such as
3.14or2.5work as usual; in many setups,piandeare also defined.
A few expressions that make the Hessian calculator show different curvature patterns are:
x^2 + x*y + y^2sin(x) * cos(y)exp(x^2 + y^2)ln(1 + x^2 + y^2)(x^2 - y^2)/(1 + x^2*y^2)
Enter the point as ordinary real numbers. Because x and y are just coordinates, you do not need to convert any units; what matters is that both values describe the same location in the same coordinate system. If the function is not defined at the chosen point, for example because of division by zero, the calculator may return an error or an undefined result.
The second-derivative test in this Hessian calculator
When you evaluate a critical point of f(x, y) with this Hessian calculator, the second-derivative test plays the same role that the second derivative plays in single-variable calculus.
Suppose that at a specific point you have the Hessian
H = [[a, b], [b, c]],
where a = f_xx, b = f_xy = f_yx, and c = f_yy evaluated at that point. Define the determinant
D = a*c - b^2.
The classical second-derivative test states:
- If
D > 0anda > 0, the point is a local minimum. - If
D > 0anda < 0, the point is a local maximum. - If
D < 0, the point is a saddle point (the surface curves up in one direction and down in another). - If
D = 0, the test is inconclusive; higher-order derivatives or other arguments are needed.
The calculator computes a, b, c, and D from your expression at the point you enter, then applies this decision rule automatically.
Worked example: a quadratic surface with a constant Hessian
Consider the quadratic function
f(x, y) = x^2 + x*y + y^2.
We will compute the Hessian at the point (0, 0) and classify that point using the second-derivative test. This example is convenient because the Hessian does not depend on the point, so the calculator should show the same matrix anywhere you evaluate it.
1. First partial derivatives
f_x(x, y) = 2x + yf_y(x, y) = x + 2y
2. Second partial derivatives
f_xx(x, y) = d/dx (2x + y) = 2f_xy(x, y) = d/dy (2x + y) = 1f_yx(x, y) = d/dx (x + 2y) = 1f_yy(x, y) = d/dy (x + 2y) = 2
3. Form the Hessian
At any point (x, y), the Hessian is
H(x, y) = [[2, 1], [1, 2]].
Because this particular function is quadratic, the Hessian is constant and does not depend on the point. At (0, 0) you have
H(0, 0) = [[2, 1], [1, 2]].
4. Compute the determinant and classify
In this case, a = 2, b = 1, and c = 2. The determinant is
D = a*c - b^2 = 2*2 - 1^2 = 4 - 1 = 3.
This satisfies D > 0 and a = 2 > 0, so by the second-derivative test the point (0, 0) is a local minimum of f(x, y). For this positive-definite quadratic surface, the same calculation also shows that the origin is the unique global minimum.
If you enter this function and the point (0, 0) into the calculator, it should output the Hessian matrix [[2, 1], [1, 2]], report D = 3, and classify the point as a local minimum.
Interpreting the Hessian results at a point
After the Hessian calculator finishes, the table shows the second derivatives and the determinant used for classification. Those values tell you how the surface bends near the point you chose.
- The four Hessian entries
f_xx,f_xy,f_yx, andf_yyshow the local curvature along the axes and in mixed directions. - The determinant
D = f_xx * f_yy - (f_xy)^2combines that curvature into a single test quantity. - A classification of local minimum, local maximum, saddle point, or inconclusive tells you which branch of the second-derivative test was triggered.
You can interpret these pieces as follows:
- Hessian entries tell you how the surface bends along the coordinate directions and how the two variables interact.
- Positive determinant means the principal curvatures share the same sign, so the surface bends the same way in both main directions.
- Negative determinant means one principal direction curves up while another curves down, which is the signature of a saddle.
- The sign of
f_xx(or equivalently, the eigenvalues ofH) distinguishes between a bowl-shaped minimum and a dome-shaped maximum whenD > 0.
Remember that the second-derivative test assumes you are looking at a critical point where the gradient is zero. If you evaluate some other point on the surface, the Hessian still describes local curvature, but it does not by itself say whether that point is an extremum.
Comparison: Hessian patterns at critical points
This table summarizes the main curvature patterns the Hessian calculator may report when you are at a critical point.
| Condition on Hessian | Determinant D |
Typical classification | Geometric picture |
|---|---|---|---|
f_xx > 0, D > 0 |
Positive | Local minimum | Surface shaped like a bowl, curving upward in all directions. |
f_xx < 0, D > 0 |
Positive | Local maximum | Surface shaped like an upside-down bowl, curving downward in all directions. |
D < 0 |
Negative | Saddle point | Surface rising in some directions and falling in others. |
D = 0 |
Zero | Inconclusive | Higher-order terms determine the behavior; more analysis is required. |
Typical use cases
This Hessian matrix calculator is especially helpful for:
- Multivariable calculus students who are learning about critical points and want to check hand calculations.
- Optimization and machine learning learners who want to inspect curvature at candidate optima in simple two-variable models.
- Applied scientists and engineers who use small toy models to understand stability or behavior near equilibrium points.
By automating the second partial derivatives and determinant, the tool lets you focus on the shape of the surface rather than getting bogged down in algebra.
Assumptions and limitations for Hessian evaluation
Like any symbolic or numeric Hessian tool, this calculator works under a set of assumptions that are worth checking before you trust the classification:
- Two real variables only: the calculator is designed for functions of the form
f(x, y). It does not directly handle three or more variables, complex variables, or vector-valued functions. - Existence of derivatives: the Hessian is only defined where the required partial derivatives exist. If the function is not differentiable at the chosen point, for example because of an absolute value kink or a discontinuity, the output may be undefined or misleading.
- Sufficient smoothness: symmetry of the mixed partials (
f_xy = f_yx) relies on the function being sufficiently smooth. If that condition fails, the theoretical interpretation of the Hessian becomes more subtle. - Single-point evaluation: the calculator evaluates the Hessian at one specified point at a time. It does not search for critical points automatically or analyze global behavior over a region.
- Second-derivative test limitations: when
D = 0, the test is inherently inconclusive. Even whenD ≠ 0, the test describes local behavior near the point, not global minima or maxima over all of ℝ². - Expression parsing: only functions expressible in the supported syntax can be processed. Symbolic parameters, piecewise definitions, or highly nonstandard expressions may not parse or differentiate correctly.
- Numerical issues: if the implementation uses numerical differentiation internally, very large or very small coordinate values can introduce rounding errors.
If the result looks surprising, recheck the expression, confirm that the point lies in the function's domain, and make sure you are interpreting the Hessian at a critical point rather than at an arbitrary location on the surface.
Summary: what this Hessian matrix calculator tells you
The Hessian matrix condenses second-order information about f(x, y) into a compact 2×2 snapshot of curvature. This calculator evaluates that snapshot at the point you enter, computes the determinant used by the second-derivative test, and helps you decide whether the local shape is bowl-like, dome-like, saddle-shaped, or undecidable from second derivatives alone. It is a compact way to verify homework, explore examples, and build intuition about multivariable curvature and optimization.
How the Hessian result is built
For this Hessian calculator, the displayed result is assembled from the second partial derivatives of the function at the point you enter. The tool differentiates f(x, y) twice, places the results into the 2×2 Hessian, and uses the diagonal terms and mixed term to compute the determinant shown in the result box. Enter x and y as ordinary real-number coordinates; the app does not convert units or rescale the point for you.
Arcade Mini-Game: Hessian Matrix Calculator Calibration Run
Use this quick arcade run to practice separating useful scenario inputs from common planning mistakes before you rely on the calculator output.
Start the game, then use your pointer or arrow keys to catch useful inputs and avoid bad assumptions.
