Calculus · Functions of several variables

Taylor's Formula, Extrema and Singular Points in Several Variables

Where does a landscape have its peaks and valleys? Which point of a road is closest to a lake? Where does a curve cross itself? These look like different questions, but all three are answered by the same tool: Taylor's formula in two variables, and in particular its second-order part, a quadratic form whose sign is decided by one number, \(D = AC - B^2\).

1. Taylor's formula for two variables

For one variable, Taylor's formula approximates \(f(x)\) near \(a\) by a polynomial in \((x - a)\). In two variables the polynomial is in \((x - a)\) and \((y - b)\), and the derivatives become partial derivatives.

Taylor's formula If \(f(x, y)\) has all partial derivatives up to order \(n + 1\) (continuous) in a neighbourhood of \((a, b)\), then in that neighbourhood \[ f(x, y) = f(a, b) + \sum_{i=1}^n\frac{1}{i!}\Big[(x - a)\frac{\partial}{\partial x} + (y - b)\frac{\partial}{\partial y}\Big]^{(i)}f(a, b) + R_n(x, y), \tag{1} \] with the remainder \[ R_n(x, y) = \frac{1}{(n + 1)!}\Big[(x - a)\frac{\partial}{\partial x} + (y - b)\frac{\partial}{\partial y}\Big]^{(n+1)}f\big(a + \theta(x - a),\ b + \theta(y - b)\big), \qquad 0 < \theta < 1. \]

The bracket with a power is the symbolic notation from the previous post: expand it like a binomial, then read \( \frac{\partial^i}{\partial x^{i-j}\partial y^j} \) as derivatives of \(f\). Written out to second order, with \(h = x - a\), \(k = y - b\):

\[ f(a + h, b + k) = f + (f_x h + f_y k) + \frac{1}{2!}\big(f_{xx}h^2 + 2f_{xy}hk + f_{yy}k^2\big) + \cdots \]

(all derivatives at \((a, b)\)). The first-order part is the differential \(df\) and the second-order part is \( \frac12 d^2f \): Taylor's formula is \( f + df + \frac{1}{2!}d^2f + \cdots \), exactly as in one variable.

Why it holds: restrict \(f\) to the segment from \((a, b)\) to \((x, y)\): \( g(t) = f(a + th, b + tk) \), \(0 \le t \le 1\). This is a function of one variable, so the familiar Taylor formula with Lagrange's remainder applies to \(g\) at \(t = 0\), \(t = 1\). By the chain rule, \( g^{(i)}(0) \) is exactly \( \big(h\partial_x + k\partial_y\big)^{(i)}f(a, b) \). The \(\theta\) in the remainder is the intermediate point on that segment.

Taylor series If \(f\) is infinitely differentiable and \( R_n(x, y) \to 0 \) as \(n \to \infty\), then \[ f(x, y) = f(a, b) + \sum_{i + j \ge 1}\frac{1}{i!\,j!}\,\frac{\partial^{i+j}f(a, b)}{\partial x^i\,\partial y^j}\,(x - a)^i(y - b)^j. \tag{2} \] For \(a = b = 0\), formulas (1) and (2) are called Maclaurin's formula and Maclaurin's series.

(The coefficient \( \frac{1}{i!\,j!} \) comes from \( \frac{1}{(i+j)!}\binom{i+j}{i} \): the factorial from Taylor's formula times the binomial coefficient from expanding the bracket.)

Example 1 Expand \( f = e^x\cos y \) around \((0, 0)\) to second order. At the origin: \( f = 1 \); \( f_x = 1 \), \( f_y = 0 \); \( f_{xx} = 1 \), \( f_{xy} = 0 \), \( f_{yy} = -1 \). So \[ e^x\cos y \approx 1 + x + \frac{x^2 - y^2}{2}. \] At \((0.1, 0.2)\) this gives \(1.0850\), against the true \(1.08314\). Adding the third-order term \( \frac{x^3 - 3xy^2}{6} \) gives \(1.08317\). (You get the same result by multiplying the one-variable series \( e^x = 1 + x + \frac{x^2}2 + \cdots \) and \( \cos y = 1 - \frac{y^2}{2} + \cdots \), a useful shortcut.)

2. Local extrema

A function \(f(\xi_1, \dots, \xi_n)\) has a local maximum at \(x_0\) if \( f(x) \le f(x_0) \) for all \(x\) in some neighbourhood of \(x_0\), and a local minimum if \( f(x) \ge f(x_0) \).

Necessary condition If a differentiable function \(f\) has an extremum at an interior point \(x_0\) of its domain \(D\), then \( df(x_0) = 0 \), that is \[ \frac{\partial f}{\partial\xi_i}(x_0) = 0 \qquad (i = 1, 2, \dots, n). \] Such a point is called a stationary point.

Why: if \(f\) has, say, a maximum at \(x_0\), then moving along the \(\xi_i\)-axis alone, the one-variable function \( \xi_i \mapsto f(\dots, \xi_i, \dots) \) also has a maximum there, so its derivative \( \frac{\partial f}{\partial\xi_i} \) is zero (Fermat's theorem). Geometrically, for \(z = f(x, y)\): the tangent plane at a peak or valley is horizontal.

As in one variable, this is not sufficient. The typical counterexample is the saddle \( f = x^2 - y^2 \): at the origin both partial derivatives vanish, but along the \(x\)-axis the origin is a minimum and along the \(y\)-axis a maximum. A mountain pass looks like this.

Sufficient condition Let \(f\) have continuous second derivatives, and \( df(x_0) = 0 \). Then \(f\) has
  • a maximum at \(x_0\) if \( d^2f(x_0) < 0 \) for all \( (d\xi_1, \dots, d\xi_n) \ne (0, \dots, 0) \);
  • a minimum at \(x_0\) if \( d^2f(x_0) > 0 \) for all \( (d\xi_1, \dots, d\xi_n) \ne (0, \dots, 0) \).

Why: by Taylor's formula with \(df = 0\), \( \Delta f = \frac12 d^2f + (\text{smaller terms}) \). Near the point, the sign of \(\Delta f\) is the sign of \(d^2f\). If \(d^2f\) is negative in every direction, \(f\) decreases whichever way we step: a maximum.

3. The second-derivative test: \(D = AC - B^2\)

For two variables, \( d^2f = A\,dx^2 + 2B\,dx\,dy + C\,dy^2 \) with

\[ A = \frac{\partial^2 f}{\partial x^2}, \qquad B = \frac{\partial^2 f}{\partial x\,\partial y}, \qquad C = \frac{\partial^2 f}{\partial y^2} \]

at the stationary point. Whether this quadratic form keeps one sign is a high-school question: completing the square (for \(A \ne 0\)),

\[ A\,dx^2 + 2B\,dx\,dy + C\,dy^2 = \frac{1}{A}\Big[(A\,dx + B\,dy)^2 + (AC - B^2)\,dy^2\Big]. \]

If \( AC - B^2 > 0 \), the bracket is positive (for \((dx, dy) \ne 0\)), so the form has the sign of \(A\). If \( AC - B^2 < 0 \), the bracket is positive in some directions and negative in others.

The test At a stationary point \((x_0, y_0)\), let \( D = AC - B^2 \). Then:
  • \(D > 0\), \(A < 0\) (equivalently \(C < 0\)): maximum;
  • \(D > 0\), \(A > 0\) (equivalently \(C > 0\)): minimum;
  • \(D < 0\): no extremum (a saddle point);
  • \(D = 0\): the test is inconclusive; higher-order terms decide.

(When \(D > 0\), \(AC > B^2 \ge 0\), so \(A\) and \(C\) automatically have the same sign; that is why either can be checked.)

Example 2 \( f = x^3 + y^3 - 3xy \). Stationary points: \( f_x = 3x^2 - 3y = 0 \), \( f_y = 3y^2 - 3x = 0 \). From the first, \(y = x^2\); then \(x^4 = x\), so \(x = 0\) or \(x = 1\): points \((0, 0)\) and \((1, 1)\).
Second derivatives: \( A = 6x \), \( B = -3 \), \( C = 6y \).
  • At \((0, 0)\): \( D = 0 - 9 < 0 \): saddle, no extremum.
  • At \((1, 1)\): \( D = 36 - 9 = 27 > 0 \) and \(A = 6 > 0\): minimum, \( f(1, 1) = -1 \).
\(D = 0\) really is undecided At the origin, \( x^4 + y^4 \) (minimum), \( -x^4 - y^4 \) (maximum) and \( x^4 - y^4 \) (no extremum) all have \( A = B = C = 0 \), so \(D = 0\). The second-order part is blind here, and the point must be examined directly, for instance by looking at the sign of \(f - f(x_0, y_0)\) along different lines.

4. Constrained extrema: Lagrange multipliers

Often the variables are not free. We want the extrema of \( f(x) = f(\xi_1, \dots, \xi_n) \) only over points satisfying conditions

\[ \varphi_i(x) = 0 \qquad (i = 1, 2, \dots, m), \quad m < n. \]

For example: the largest volume of a box with a given surface area, or the point on a curve nearest to a given point.

Lagrange's method Form the Lagrange function \[ F(x) = f(x) + \sum_{i=1}^m\lambda_i\,\varphi_i(x), \] and look for its stationary points: solve the \(n + m\) equations \[ \frac{\partial F}{\partial\xi_j} = 0 \quad (j = 1, \dots, n), \qquad \varphi_i = 0 \quad (i = 1, \dots, m) \] for the \(n + m\) unknowns \(\xi_1, \dots, \xi_n, \lambda_1, \dots, \lambda_m\). The constrained extrema of \(f\) are among the solutions.

The geometric idea (one condition, two variables). Walk along the curve \(\varphi(x, y) = 0\) and watch the values of \(f\). At a constrained extremum, \(f\) stops increasing or decreasing along the curve, which means the curve touches a level line \(f = c\) there instead of crossing it. Touching curves have parallel normals, and the normals are the gradients:

\[ \nabla f = -\lambda\,\nabla\varphi \quad\Longleftrightarrow\quad \nabla(f + \lambda\varphi) = 0. \]

That is exactly the condition \( F_x = F_y = 0 \). The multiplier \(\lambda\) is the proportionality factor between the two gradients.

x y f = −2.5 f = 0 f = 2.5 f = 5 max min ∇f x² + y² = 5
Figure 1. Extrema of \( f = x + 2y \) on the circle \( x^2 + y^2 = 5 \). The level lines of \(f\) (dashed) cross the circle, except the two that just touch it: at \((1, 2)\) (maximum, \(f = 5\)) and \((-1, -2)\) (minimum, \(f = −5\)). There \(\nabla f\) (arrow) is perpendicular to the circle.
Example 3 Extrema of \( f = x + 2y \) subject to \( x^2 + y^2 = 5 \). Take \( F = x + 2y + \lambda(x^2 + y^2 - 5) \): \[ F_x = 1 + 2\lambda x = 0, \qquad F_y = 2 + 2\lambda y = 0, \qquad x^2 + y^2 = 5. \] The first two give \( x = -\frac{1}{2\lambda} \), \( y = -\frac1\lambda \), so \(y = 2x\). Then \(5x^2 = 5\), \(x = \pm1\): the points \((1, 2)\) with \(f = 5\) and \((-1, -2)\) with \(f = −5\). The circle is closed and bounded, so \(f\) has both a maximum and a minimum on it, and these must be them.
Example 4 · The best rectangle Among rectangles with perimeter \(2(x + y) = 20\), maximize the area \(xy\). With \( F = xy + \lambda(x + y - 10) \): \( y + \lambda = 0 \), \( x + \lambda = 0 \), so \(x = y = 5\). The square wins, with area \(25\).

5. Absolute extrema on a closed region

A continuous function on a closed and bounded region always attains its largest and smallest value (Weierstrass's theorem). Where?

Absolute extremum A differentiable function \(f\) attains its greatest or least value on a closed bounded region either at a stationary point inside the region or at a point of its boundary.

Inside the region, an extreme value is in particular a local extremum, so it must occur at a stationary point. On the boundary this argument fails (we cannot step out of the region in every direction), so the boundary has to be examined separately, usually as a constrained problem or by parametrizing it. The recipe:

  1. Find the stationary points inside the region and compute \(f\) there.
  2. Find the largest and smallest values of \(f\) on the boundary.
  3. Compare all these values. No second-derivative test is needed.
Example 5 \( f = x^2 + y^2 - 2x \) on the disk \( x^2 + y^2 \le 4 \).
  • Inside: \( f_x = 2x - 2 = 0 \), \( f_y = 2y = 0 \) gives \((1, 0)\), \( f = -1 \).
  • Boundary: \( x^2 + y^2 = 4 \), so \( f = 4 - 2x \) with \(-2 \le x \le 2\): from \(0\) (at \((2, 0)\)) to \(8\) (at \((-2, 0)\)).
So the greatest value is \(8\) at \((-2, 0)\) and the least is \(-1\) at \((1, 0)\). (Indeed \( f = (x - 1)^2 + y^2 - 1 \): squared distance from \((1, 0)\), minus 1.)

6. Singular points of plane curves

A curve given implicitly by \( f(x, y) = 0 \) usually has a well-defined tangent: its slope is \( y' = -\frac{f_x}{f_y} \), from implicit differentiation. This breaks down when both partial derivatives vanish.

Definition A point \(M(x_0, y_0)\) of the curve \( f(x, y) = 0 \) is singular if simultaneously \[ f(x_0, y_0) = 0, \qquad f'_x(x_0, y_0) = 0, \qquad f'_y(x_0, y_0) = 0. \]

Near a singular point, Taylor's formula starts at the second order:

\[ f(x_0 + h, y_0 + k) \approx \tfrac12\big(Ah^2 + 2Bhk + Ck^2\big). \]

So the curve near \(M\) looks like the set where this quadratic form is zero, and that is decided by the same discriminant as for extrema. Directions \((h, k)\) along which the curve can leave \(M\) satisfy \( Ah^2 + 2Bhk + Ck^2 = 0 \); for the slope \( m = k/h \) of a tangent this is \( Cm^2 + 2Bm + A = 0 \).

Classification Let not all of \(A, B, C\) be zero at the singular point \(M\), and \( D = AC - B^2 \). Then \(M\) is
  • \(D > 0\): an isolated point: the form is never zero in any direction, so no branch passes through \(M\);
  • \(D < 0\): a double point (node): two branches cross at \(M\), with two different tangents;
  • \(D = 0\): there is one (double) tangent direction, and \(M\) can be a cusp of the first kind (branches on opposite sides of the common tangent), a cusp of the second kind (both branches on the same side), an isolated point, or a double point with contact (tacnode: two branches touching each other).

The parallel with extrema is exact: \(D > 0\) means \(f\) has a strict extremum at \(M\), so \(f \ne 0\) nearby and \(M\) is alone on the curve; \(D < 0\) means a saddle, and the zero level of a saddle is two crossing lines.

(a) isolated point, D > 0 M (b) node, D < 0 M (c) cusp, 1st kind, D = 0 M (d) cusp, 2nd kind, D = 0 M
Figure 2. The four basic types of singular points at the origin \(M\): (a) isolated point of \( y^2 = x^2(x - 1) \); (b) node of the folium of Descartes \( x^3 + y^3 - 3xy = 0 \); (c) cusp of the first kind of \( y^2 = x^3 \); (d) cusp of the second kind of \( (y - x^2)^2 = x^5 \). The dashed lines are tangents at \(M\).
Example 6 · Checking Figure 2
  • (a) \( f = y^2 - x^3 + x^2 \): \( A = -6x + 2 = 2 \), \( B = 0 \), \( C = 2 \), so \( D = 4 > 0 \): isolated. Indeed \( y^2 = x^2(x - 1) \) needs \(x \ge 1\) except for \(x = 0\).
  • (b) \( f = x^3 + y^3 - 3xy \): \( A = 6x = 0 \), \( B = -3 \), \( C = 6y = 0 \), so \( D = -9 < 0 \): node. Tangents: \( -6m = 0 \) and the vertical direction, i.e. the two axes.
  • (c) \( f = y^2 - x^3 \): \( A = 0 \), \( B = 0 \), \( C = 2 \), so \( D = 0 \). The branches \( y = \pm x^{3/2} \) lie on opposite sides of the tangent \(y = 0\): first kind.
  • (d) \( f = (y - x^2)^2 - x^5 \): again \(A = B = 0\), \(C = 2\), \(D = 0\). The branches \( y = x^2 \pm x^{5/2} \) both lie above the tangent \(y = 0\) for small \(x > 0\): second kind.
For \(D = 0\), the type is not decided by \(D\): \( y^2 - x^4 = 0 \) (two parabolas \(y = \pm x^2\) touching, a tacnode) and \( y^2 + x^4 = 0 \) (only the origin, isolated) also have \(D = 0\).

7. Summary

TopicKey statement
Taylor's formula\( f = f(a, b) + df + \frac{1}{2!}d^2f + \cdots + \frac{1}{n!}d^nf + R_n \)
Stationary point\( f_x = f_y = 0 \) (necessary for an interior extremum)
Second-derivative test\(D = AC - B^2\): \(D > 0\) extremum (max if \(A < 0\), min if \(A > 0\)); \(D < 0\) saddle; \(D = 0\) undecided
Constrained extremumstationary points of \( F = f + \sum\lambda_i\varphi_i \) with \( \varphi_i = 0 \)
Absolute extremumcompare values at interior stationary points and on the boundary
Singular point\( f = f_x = f_y = 0 \); \(D > 0\) isolated, \(D < 0\) node, \(D = 0\) cusp / isolated / tacnode

8. Practice problems

Try each one before opening the solution. More solved problems from this topic are in Limits.

Problem 1: Write the Maclaurin formula of \( f = \sin x\cdot\sin y \) to second order.

At the origin, \(f = f_x = f_y = 0\), \( f_{xx} = f_{yy} = 0 \), \( f_{xy} = \cos x\cos y = 1 \). So \( \sin x\sin y \approx xy \). (Also from \( \sin x \approx x \), \( \sin y \approx y \).)

Problem 2: Find the extrema of \( f = x^2 + xy + y^2 - 3x - 6y \).

\( 2x + y = 3 \), \( x + 2y = 6 \) gives \((0, 3)\). \( A = 2, B = 1, C = 2 \), \( D = 3 > 0 \), \(A > 0\): minimum, \( f(0, 3) = 9 - 18 = -9 \).

Problem 3: Classify the stationary point of \( f = xy \).

Only \((0, 0)\). \( A = C = 0 \), \( B = 1 \), \( D = -1 < 0 \): a saddle (\(f > 0\) in the 1st and 3rd quadrants, \(f < 0\) in the 2nd and 4th).

Problem 4: Find the point of the line \( x + y = 2 \) closest to the origin.

Minimize \( x^2 + y^2 \) with \( F = x^2 + y^2 + \lambda(x + y - 2) \): \( 2x + \lambda = 0 \), \( 2y + \lambda = 0 \), so \(x = y = 1\). Distance \(\sqrt2\).

Problem 5: Find the greatest and least values of \( f = xy \) on the square \( -1 \le x, y \le 1 \), and on the square \( 0 \le x, y \le 1 \).

The only stationary point is \((0, 0)\) with \(f = 0\). On the boundary of \([-1, 1]^2\), \(f\) is linear on each side, so the extremes are at corners: \( f = 1 \) at \((1, 1), (-1, -1)\) and \( f = -1 \) at \((1, -1), (-1, 1)\). Greatest \(1\), least \(-1\). On \([0, 1]^2\): greatest \(1\) at \((1, 1)\), least \(0\) along the two sides on the axes.

Problem 6: Find and classify the singular point of the lemniscate \( (x^2 + y^2)^2 = x^2 - y^2 \).

\( f = (x^2 + y^2)^2 - x^2 + y^2 \); at the origin \(f = f_x = f_y = 0\). \( A = -2 \), \( B = 0 \), \( C = 2 \): \( D = -4 < 0 \), a node. Tangents: \( 2m^2 - 2 = 0 \), \( m = \pm1 \), the lines \( y = \pm x \).

Final thoughts

The key to this whole chapter is the second-order part of Taylor's formula, the quadratic form \( Ah^2 + 2Bhk + Ck^2 \). At a stationary point its sign pattern tells peaks, valleys and saddles apart; at a singular point of a curve its zero set tells isolated points, crossings and cusps apart; and in both cases \(D = AC - B^2\) is the deciding number. Lagrange's method extends the hunt for extrema to points tied to a constraint, and the closed-region recipe finds the overall greatest and least values. When \(D = 0\), the quadratic part says nothing, and the answer has to come from looking closer.

Related posts: partial derivatives and the chain rule, Taylor's formula for one variable, and extrema of functions of one variable.