Back to Top

Hessian Matrix Calculator 

By inputting the function and specifying the variables in the Hessian matrix calculator, the tool returns the matrix of second-order partial derivatives. 

It finds both the matrix and the determinant of the matrix. Users can find all the necessary steps of the calculation below the result. Use the examples from three different complexity levels to increase the understanding of this particular multivariable tool. 

How to use this tool?

The instructions to use this calculator are given below. 

  1. Choose the function type (i.e. either 2 or 3 variables).
  2. Enter the values of variables in the designated boxes. 
  3. Click calculate.
  4. Click on the “show step” for the complete calculation.

What is the Hessian matrix?

The Hessian matrix is a square matrix of second-order partial derivatives of a scalar-valued function with respect to its multiple input variables. 

Explaining the Hessian matrix using the multivariable function Concept:

To understand the Hessian matrix, we first need to discuss functions with multiple input variables. A multivariable function takes multiple inputs and yields a single output. For example, a function f(x, y) has two input variables, x, and y, and produces one output value.

To study the behavior of a multivariable function, we use partial derivatives. A partial derivative of a function is the rate of change of the function with respect to one of its variables while keeping the other variables constant. For a function f(x, y), we can compute two first-order partial derivatives: ∂f/∂x and ∂f/∂y.

In addition to first-order partial derivatives, we can also compute second-order partial derivatives, which show how the rate of change of a first-order partial derivative varies with respect to the input variables. For a function f(x, y), there are four possible second-order partial derivatives: ∂²f/∂x², ∂²f/∂y², ∂²f/∂x∂y, and ∂²f/∂y∂x.

Hessian matrix formation:

The Hessian matrix is a square matrix that organizes these second-order partial derivatives in the following way:

H(f) = | ∂²f/∂x²     ∂²f/∂x∂y |

          | ∂²f/∂y∂x     ∂²f/∂y² |

For functions with more variables, the Hessian matrix will have a larger size, but the idea remains the same.

The Hessian matrix is crucial for understanding the local properties of a function, such as its curvature and critical points (local maxima, local minima, or saddle points). By examining the eigenvalues of the Hessian matrix, we can determine the convexity or concavity of the function at a specific point:

  1. Positive eigenvalues: The function is locally convex (local minimum)
  2. Negative eigenvalues: The function is locally concave (local maximum)
  3. Mixed-sign eigenvalues: The function has a saddle point

How to find the Hessian matrix?

As discussed before, find the necessary second partial derivatives of the function and place them in the matrix. Let’s see examples of both 2 and 3-variable functions. 

2-variable function:

Let's consider a simple example: the function f(x, y) = x² + y². This function represents a paraboloid, and we will compute its Hessian matrix.

Step 1: Find the first-order partial derivatives:

∂f/∂x = 2x

∂f/∂y = 2y

Step 2: Compute the second-order partial derivatives:

∂²f/∂x² = 2

∂²f/∂y² = 2

∂²f/∂x∂y = 0

∂²f/∂y∂x = 0

Step 3: Construct the Hessian matrix:

H(f) = | 2 0 |

          | 0 2 |

Since both eigenvalues of the Hessian matrix are positive (2 and 2), the function is locally convex, indicating that it has a local minimum at the origin (0, 0).

“Hessian” means both matrix or its determinant depending on the context.

3-variable function:

Let's consider a more complex function with three input variables: f(x, y, z) = x^3 - 3x^2y + 2xz^2 + y^2z.

Step 1: Compute the first-order partial derivatives:

∂f/∂x = 3x^2 - 6xy + 2z^2

∂f/∂y = -3x^2 + 2yz

∂f/∂z = 4xz + 2yz

Step 2: Find the second-order partial derivatives:

∂²f/∂x² = 6x - 6y

∂²f/∂x∂y = -6x

∂²f/∂x∂z = 4z

∂²f/∂y² = 2z

∂²f/∂y∂z = 2y

∂²f/∂z² = 4x + 2y

Step 3: Construct the Hessian matrix:

H(f) = | 6x - 6y    -6x             4z |

          | -6x          2z              2y |

          | 4z           2y      4x + 2y |

As the Hessian matrix depends on the variables x, y, and z, its eigenvalues and the local properties of the function (such as convexity, concavity, or saddle points) will vary depending on the specific point at which the Hessian is evaluated. 

To analyze the function's local behavior at a particular point, simply substitute the coordinates of that point into the Hessian matrix and examine its eigenvalues.

Applications of the Hessian matrix:

Apart from helping in the optimization problems to analyze the local properties of objective functions, the Hessian matrix has numerous real-life applications across various fields, including but not limited to computer vision, machine learning, economics, and physics. 

Computer vision: The Hessian matrix is applied in computer vision tasks, such as feature detection and image segmentation. For example, the Hessian matrix can be used to detect corners and blob-like structures in images, which are important features for object recognition and tracking.

Economics: In economics, the Hessian matrix is employed to study the properties of functions that model consumer preferences, production functions, or utility functions. By analyzing the curvature of these functions, economists can make predictions and design policies based on the behavior of agents in the market.

Physics: In molecular modeling and computational chemistry, the Hessian matrix is used to calculate vibrational frequencies and normal modes of molecules. The Hessian matrix also appears in the analysis of potential energy surfaces, which helps in understanding chemical reactions and predicting molecular properties.

Use android or iOS app of our limit calculator on your mobile

Download Download
Limit Calculator