Tutorials › Calculus III › Taylor Expansion Behind the Second Derivative Test

Critical Points and Local Extrema · Tutorial 406 of 999

Taylor Expansion Behind the Second Derivative Test

See how the Hessian gives the leading quadratic change near a stationary point, and what smoothness does—and does not—guarantee about the error.

Intermediate 10 min read

What You'll Learn

  • State the second-order Taylor formula for a function of two variables near a stationary point.
  • Identify the continuity assumptions needed for a remainder that is small relative to the squared distance.
  • Derive the formula by restricting the function to a line through the point.
  • Distinguish a little-o remainder from a cubic-order error bound.
  • Compute and check Taylor approximations at stationary points.
  • Explain when the quadratic term controls nearby changes and when the remainder cannot be ignored.

Why a Quadratic Approximation Appears

A stationary point is a point where the first-order change vanishes. Near such a point, a differentiable function has no linear term in its local approximation. If the function is twice continuously differentiable, the leading possible change is therefore quadratic, and the Hessian records that change.

This is the mathematical reason the second derivative is central to local analysis. The quadratic approximation describes the function’s leading behavior near the point, while the remainder measures what the approximation leaves out. The size of that remainder—and the assumptions that guarantee its size—matter whenever we draw conclusions from the quadratic term.

The Second-Order Taylor Formula

Let \(f\) be a real-valued function defined on an open subset of \(\mathbb{R}^2\), and let \(\mathbf{a}=(a_1,a_2)\) be a point in its domain. Write a nearby point as \(\mathbf{a}+\mathbf{h}\), where \(\mathbf{h}=(h_1,h_2)\). The gradient \(\nabla f(\mathbf{a})\) is the vector of first partial derivatives, and the Hessian \(\mathbf{H}_f(\mathbf{a})\) is the matrix of second partial derivatives at \(\mathbf{a}\).

Definition: The point \(\mathbf{a}\) is a stationary point of \(f\) if \(\nabla f(\mathbf{a})=\mathbf{0}\). The second-order Taylor approximation of \(f\) at \(\mathbf{a}\), evaluated at \(\mathbf{a}+\mathbf{h}\), is
$$ f(\mathbf{a})+\nabla f(\mathbf{a})^{\top}\mathbf{h} +\frac{1}{2}\mathbf{h}^{\top}\mathbf{H}_f(\mathbf{a})\mathbf{h}. $$

For a stationary point, the linear term is zero. The formula then takes the particularly useful form below. Here \(\|\mathbf{h}\|\) denotes the Euclidean length of the displacement, and \(r(\mathbf{h})=o(\|\mathbf{h}\|^2)\) means that \(r(\mathbf{h})/\|\mathbf{h}\|^2\) tends to zero as \(\mathbf{h}\) tends to \(\mathbf{0}\), with \(\mathbf{h}\ne\mathbf{0}\).

Theorem: If \(f\) is twice continuously differentiable in a neighborhood of \(\mathbf{a}\), and \(\mathbf{a}\) is stationary, then
$$ f(\mathbf{a}+\mathbf{h}) = f(\mathbf{a}) +\frac{1}{2}\mathbf{h}^{\top}\mathbf{H}_f(\mathbf{a})\mathbf{h} +o(\|\mathbf{h}\|^2). $$

In two variables, if the Hessian entries at \(\mathbf{a}\) are \(f_{xx}(\mathbf{a})\), \(f_{xy}(\mathbf{a})\), \(f_{yx}(\mathbf{a})\), and \(f_{yy}(\mathbf{a})\), the quadratic term is

$$ \frac{1}{2} \left( f_{xx}(\mathbf{a})h_1^2+ \bigl(f_{xy}(\mathbf{a})+f_{yx}(\mathbf{a})\bigr)h_1h_2+ f_{yy}(\mathbf{a})h_2^2 \right). $$

When the second partial derivatives are continuous, the mixed partials agree, so this becomes \(\frac{1}{2}f_{xx}(\mathbf{a})h_1^2+f_{xy}(\mathbf{a})h_1h_2+\frac{1}{2}f_{yy}(\mathbf{a})h_2^2\). The factor of one half applies to the whole Hessian quadratic form; it does not mean that every displayed cross term has a half coefficient after the equal mixed partials are combined.

Why the Formula Holds

The multivariable formula can be obtained from one-variable Taylor expansion along the straight line from \(\mathbf{a}\) to \(\mathbf{a}+\mathbf{h}\). Define \(g(t)=f(\mathbf{a}+t\mathbf{h})\) for \(0\le t\le1\). For sufficiently small \(\mathbf{h}\), this segment remains in the neighborhood where \(f\) is twice continuously differentiable.

1
Differentiate along the segment.
The chain rule gives \(g'(t)=\nabla f(\mathbf{a}+t\mathbf{h})^{\top}\mathbf{h}\), and differentiating again gives \(g''(t)=\mathbf{h}^{\top}\mathbf{H}_f(\mathbf{a}+t\mathbf{h})\mathbf{h}\).
2
Apply the one-variable integral formula.
Twice applying the fundamental theorem of calculus gives \(g(1)=g(0)+g'(0)+\int_0^1(1-t)g''(t)\,dt\).
3
Separate the Hessian at the base point.
Substitute the expressions for \(g'\) and \(g''\), then add and subtract \(\mathbf{H}_f(\mathbf{a})\) inside the integral.

Since \(\int_0^1(1-t)\,dt=1/2\), this yields

$$ f(\mathbf{a}+\mathbf{h}) = f(\mathbf{a})+\nabla f(\mathbf{a})^{\top}\mathbf{h} +\frac{1}{2}\mathbf{h}^{\top}\mathbf{H}_f(\mathbf{a})\mathbf{h} +r(\mathbf{h}), $$

where the remainder is exactly

$$ r(\mathbf{h})= \int_0^1(1-t)\, \mathbf{h}^{\top} \bigl(\mathbf{H}_f(\mathbf{a}+t\mathbf{h})-\mathbf{H}_f(\mathbf{a})\bigr) \mathbf{h}\,dt. $$

To see why this remainder is small relative to \(\|\mathbf{h}\|^2\), let \(\|\mathbf{M}\|\) denote the operator norm of a matrix \(\mathbf{M}\). The inequality \(|\mathbf{u}^{\top}\mathbf{M}\mathbf{u}|\le \|\mathbf{M}\|\|\mathbf{u}\|^2\) implies

$$ |r(\mathbf{h})| \le \frac{1}{2}\|\mathbf{h}\|^2 \sup_{0\le t\le1} \|\mathbf{H}_f(\mathbf{a}+t\mathbf{h})-\mathbf{H}_f(\mathbf{a})\|. $$

Continuity of the Hessian makes the supremum tend to zero as \(\mathbf{h}\) tends to \(\mathbf{0}\). Thus \(r(\mathbf{h})=o(\|\mathbf{h}\|^2)\). At a stationary point, \(g'(0)=\nabla f(\mathbf{a})^{\top}\mathbf{h}=0\), proving the stated formula.

What the Remainder Guarantees

The statement \(r(\mathbf{h})=o(\|\mathbf{h}\|^2)\) says that the error is eventually small compared with the size of the quadratic scale. It does not say that the error is zero, and it does not, on its own, give a cubic error bound. A function can be twice continuously differentiable while its second derivatives approach their values at \(\mathbf{a}\) more slowly than linearly in the distance.

If \(f\) has continuous third partial derivatives in a neighborhood of \(\mathbf{a}\), then a stronger estimate is available on a sufficiently small closed ball: there is a constant \(C\) such that \(|r(\mathbf{h})|\le C\|\mathbf{h}\|^3\) there. This stronger conclusion needs the extra smoothness; it should not be inferred from the twice-continuous-differentiability assumption alone.

The remainder also explains when the quadratic term can control nearby values. If the quadratic form is positive definite, it is bounded below by \(c\|\mathbf{h}\|^2\) for some \(c>0\). Because \(r(\mathbf{h})/\|\mathbf{h}\|^2\) tends to zero, for sufficiently small nonzero \(\mathbf{h}\) the remainder has magnitude less than \((c/2)\|\mathbf{h}\|^2\). The full change is then positive. A negative definite quadratic form gives the corresponding negative change. If the quadratic form has directions where it is zero, this uniform comparison is unavailable; the remainder can matter in those directions.

Worked Examples

Worked Example: A Polynomial with a Cubic Remainder

Consider \(f(x,y)=4+x^2+3xy+2y^2+x^3-2xy^2\) at \(\mathbf{a}=(0,0)\). First compute the gradient:

$$ f_x=2x+3y+3x^2-2y^2,\qquad f_y=3x+4y-4xy. $$

At \((0,0)\), both partial derivatives are zero, so the point is stationary. The second derivatives are \(f_{xx}=2+6x\), \(f_{xy}=3-4y\), and \(f_{yy}=4\). Therefore

$$ f(0,0)=4,\qquad \mathbf{H}_f(0,0)=\begin{pmatrix}2&3\\3&4\end{pmatrix}. $$

For \(\mathbf{h}=(x,y)\), the quadratic Taylor term is

$$ \frac{1}{2}\begin{pmatrix}x&y\end{pmatrix}\begin{pmatrix}2&3\\3&4\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}=x^2+3xy+2y^2. $$

Thus the expansion is \(f(x,y)=4+x^2+3xy+2y^2+r(x,y)\), where \(r(x,y)=x^3-2xy^2\). This is a cubic remainder, so \(r(x,y)=o(x^2+y^2)\). For a direct check at \((x,y)=(0.1,-0.2)\), the quadratic term is \(0.01-0.06+0.08=0.03\), and the remainder is \(0.001-2(0.1)(0.04)=-0.007\). The original expression gives \(f(0.1,-0.2)=4+0.03-0.007=4.023\), matching the expansion.

Worked Example: A Smooth Function with a Quartic Error Bound

Let \(f(x,y)=\cos x+2\cos y\) at \(\mathbf{a}=(0,0)\). The gradient is \((-\sin x,-2\sin y)\), so it vanishes at the origin. The Hessian is diagonal, with entries \(-\cos x\) and \(-2\cos y\); hence \(f(0,0)=3\) and \(\mathbf{H}_f(0,0)=\begin{pmatrix}-1&0\\0&-2\end{pmatrix}\). The quadratic approximation is therefore

$$ f(x,y)\approx 3-\frac{1}{2}x^2-y^2. $$

For the error, Taylor's theorem for cosine through degree three gives \(\cos t=1-t^2/2+R(t)\), with \(|R(t)|\le |t|^4/24\), since the fourth derivative of cosine has absolute value at most one. Applying this once to \(x\) and once to \(y\) gives

$$ f(x,y)=3-\frac{1}{2}x^2-y^2+r(x,y),\qquad |r(x,y)|\le\frac{x^4}{24}+\frac{y^4}{12}\le\frac{(x^2+y^2)^2}{12}. $$

The last inequality follows from \(x^4+y^4\le(x^2+y^2)^2\). In particular, the error is bounded by a constant times \(\|(x,y)\|^4\), and is therefore \(o(\|(x,y)\|^2)\). The derivatives and the error bound confirm the expansion and its order.

Worked Example: A Shifted Stationary Point

Consider \(f(x,y)=5+(x-1)^2+2(y+2)^2+(x-1)^3\), and set \(u=x-1\), \(v=y+2\). Then \(f=5+u^2+2v^2+u^3\). Its first derivatives are \(f_x=2u+3u^2\) and \(f_y=4v\). At \(\mathbf{a}=(1,-2)\), where \(u=v=0\), the gradient is zero. Its Hessian there is \(\begin{pmatrix}2&0\\0&4\end{pmatrix}\), so the quadratic approximation is \(5+u^2+2v^2\), with remainder \(u^3\).

Since \(|u|\le\sqrt{u^2+v^2}=\|\mathbf{h}\|\), the error satisfies \(|u^3|\le\|\mathbf{h}\|^3\), which is \(o(\|\mathbf{h}\|^2)\). In fact, \(u^2+2v^2\ge\|\mathbf{h}\|^2\). If \(0<\|\mathbf{h}\|<1/2\), then

$$ f(\mathbf{a}+\mathbf{h})-f(\mathbf{a})=u^2+2v^2+u^3\ge\|\mathbf{h}\|^2-|u|^3\ge\|\mathbf{h}\|^2-\|\mathbf{h}\|^3>\frac{1}{2}\|\mathbf{h}\|^2>0. $$

This verifies that the function increases from its value at the point for all sufficiently small nonzero displacements. The estimate illustrates how a quadratic term can dominate a controlled remainder.

A Common Mistake: Overstating the Error

A frequent error is to assume that twice continuous differentiability automatically makes the remainder cubic. For instance, the function \(f(x,y)=(x^2+y^2)^{3/2}\) is twice continuously differentiable at the origin, with value, gradient, and Hessian all zero there. Its Taylor formula at the origin has remainder \(r(x,y)=(x^2+y^2)^{3/2}\). If \(\rho=\sqrt{x^2+y^2}\), then \(|r|/\rho^2=\rho\to0\), so this is indeed \(o(\rho^2)\). But \(|r|/\rho^3=1/\rho\), which is not bounded near zero. Thus the remainder is not \(O(\rho^3)\). The correct conclusion under a continuous Hessian is the little-o estimate; a cubic bound requires additional smoothness.

At a stationary point, the Hessian quadratic form is the leading second-order prediction of the change in the function. The Taylor remainder says precisely how closely that prediction matches the actual change. Keeping both parts in view prevents a useful approximation from being mistaken for an exact identity.

Check Your Understanding

Use the definitions and estimates in this tutorial to answer the following questions.

  1. Why does the first-order term vanish in the Taylor formula at a stationary point?
  2. What does \(r(\mathbf{h})=o(\|\mathbf{h}\|^2)\) mean in terms of a limit?
  3. In the line-segment derivation, which continuity assumption makes the remainder small relative to \(\|\mathbf{h}\|^2\)?
  4. Why does twice continuous differentiability not, by itself, guarantee an \(O(\|\mathbf{h}\|^3)\) remainder?
  5. What additional feature of a positive definite quadratic form lets it dominate a remainder that is \(o(\|\mathbf{h}\|^2)\)?