Linear Algebra
16.18 min read

Second Partial Derivatives

The first partial derivatives fxf_x and fyf_y are themselves functions of (x,y)(x, y). Nothing stops us from differentiating them with respect to xx or yy again — these are the second partial derivatives.

For f(x,y)f(x, y), there are four second partials: differentiate fxf_x with respect to xx or yy, and differentiate fyf_y with respect to xx or yy. We write them as fxxf_{xx}, fxyf_{xy}, fyxf_{yx}, fyyf_{yy}.

The "mixed" partials fxyf_{xy} and fyxf_{yx} both differentiate once in xx and once in yy, just in different orders. As we will see shortly, they are usually equal.

For a function f(x)f(\mathbf{x}) on Rn\mathbb{R}^n, there are n2n^2 second partials 2fxixj\frac{\partial^2 f}{\partial x_i \partial x_j}, which we can organize into a matrix.

Formal View

Definition 16.1 — Second Partial Derivatives
For f(x,y)f(x, y) with partial derivative functions fxf_x and fyf_y, the four second partial derivatives at (x0,y0)(x_0, y_0) are:
fxx=2fx2,fxy=2fyx=(fx)y,fyx=2fxy=(fy)x,fyy=2fy2f_{xx} = \frac{\partial^2 f}{\partial x^2}, \quad f_{xy} = \frac{\partial^2 f}{\partial y \partial x} = (f_x)_y, \quad f_{yx} = \frac{\partial^2 f}{\partial x \partial y} = (f_y)_x, \quad f_{yy} = \frac{\partial^2 f}{\partial y^2}
Definition 16.2 — Twice Differentiable ($D^2$)
A function f(x)f(\mathbf{x}) on Rn\mathbb{R}^n is twice differentiable at x0\mathbf{x}_0 if all nn first partial derivative functions exist in a neighborhood and are themselves differentiable at x0\mathbf{x}_0. The class of everywhere twice differentiable functions is D2D^2.

If first partials are differentiable they are certainly continuous, giving the hierarchy: C0D1C1D2C2C^0 \supsetneq D^1 \supsetneq C^1 \supsetneq D^2 \supsetneq C^2.

Why This Matters

Second derivatives tell us about curvature — whether a function bends upward (bowl), downward (dome), or twists (saddle). This is what the second derivative test is built on.

  • Curvature of neural network loss landscapes (flat vs. sharp minima)
  • Newton's method uses second derivatives for faster convergence than gradient descent
  • Structural engineering: beam bending involves second derivatives of displacement
  • Image processing: Laplacian (fxx+fyyf_{xx} + f_{yy}) detects edges and blobs

Quiz

Question 1

For f(x,y)=x2y+y3f(x,y) = x^2 y + y^3, what is fxyf_{xy}?

Question 2

How many second partial derivatives does f(x,y,z)f(x, y, z) have?

Question 3

What does fyxf_{yx} mean?

Question 4

If fC1f \in C^1 (continuously differentiable), then fD2f \in D^2.

Common Mistakes

  • Confusing fxyf_{xy} and fyxf_{yx}fxy=(fx)yf_{xy} = (f_x)_y means differentiate first by xx, then by yy.
  • Thinking that nn variables always give 2n2n second partials — there are n2n^2 (including mixed partials).
  • Assuming second partial derivative functions exist just because the function is smooth-looking.