Calculus · Functions of 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\).
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.
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.
(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.)
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) \).
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.
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.
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.
(When \(D > 0\), \(AC > B^2 \ge 0\), so \(A\) and \(C\) automatically have the same sign; that is why either can be checked.)
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.
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.
A continuous function on a closed and bounded region always attains its largest and smallest value (Weierstrass's theorem). Where?
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:
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.
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 \).
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.
| Topic | Key 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 extremum | stationary points of \( F = f + \sum\lambda_i\varphi_i \) with \( \varphi_i = 0 \) |
| Absolute extremum | compare 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 |
Try each one before opening the solution. More solved problems from this topic are in Limits.
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 \).)
\( 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 \).
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).
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\).
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.
\( 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 \).
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.