Mathematics for AI and Machine Learning

Foundations for modern AI and machine learning

Hessian

Chapter 11 Optimization

Chapter 11: Matrix Calculus — Hessian(Sym)

High-resolution PNG
Hessian — high-resolution mind-map icon

From the book

Chapter 11: Matrix Calculus. In the chapter mind map this icon labels Hessian(Sym): $H_{ij} = \frac{\partial^2 f}{\partial x_i \partial x_j}$. The discussion below is excerpted and lightly edited from § Definition: Partial Derivative in Mathematics for AI and Machine Learning.

Let $f : \mathbb{R}^N \to \mathbb{R}$. The partial derivative with respect to $x_n$ is

where $f(x_{-n}, x_n + h)$ means to evaluate $f$ at the point where only the $n$-th coordinate is perturbed by $h$, and all other coordinates stay exactly the same. Here, $x_{-n}$ denotes the vector $\mathbf{x}$ with the $n$-th coordinate removed (or held fixed). The $-$ is an index-removal operator, not arithmetic subtraction. The same pattern appears in $X_{-i}$ in statistics for dataset without sample $i$, $\theta_{-k}$ in optimization for all parameters except block $k$, and $S_{-j}$ in combinatorics for set with element $j$ removed.

Many texts use the equivalent "holding constant" rule: treat all other variables as constants and differentiate with respect to $x_n$. While this computational approach is often more practical, the explicit limit-based definition with notation $f(x_{-n}, x_n + h)$ is necessary for generalizing to matrix calculus and Fréchet derivatives, where we must precisely specify which variables are being perturbed.

the book figure illustrates $\frac{\partial f}{\partial x_1}$ for $f(x_1,x_2)=x_1^2+x_2^2$ at a point $(x_1,x_2)=(2,0.5)$: the white curve is the slice with $x_2$ fixed; the pink line is the tangent (slope $2x_1=4$); the value $\frac{\partial f}{\partial x_1}=4$ is shown on the floor.

What this drawing shows

What you see. Represents second-order curvature information for scalar functions.

In the mind map. Chapter 11 — Hessian(Sym). See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 11 companion →

Read the full definitions, figures, and worked examples in Chapter 11: Matrix Calculus — see the mind-map node Hessian(Sym).