Multivariable Calculus

Last updated: August 2026

Disclaimer: These are my personal notes compiled for my own reference and learning. They may contain errors, incomplete information, or personal interpretations. While I strive for accuracy, these notes are not peer-reviewed and should not be considered authoritative sources. Please consult official textbooks, research papers, or other reliable sources for academic or professional purposes.

1. Partial derivatives and the gradient

Definition

The partial derivative of $f(x,y)$ with respect to $x$ at $(a,b)$ is $\displaystyle f_x(a,b)=\lim_{h\to0}\frac{f(a+h,b)-f(a,b)}{h}$ — the ordinary derivative of the single-variable slice $x\mapsto f(x,b)$ at $x=a$. $f_y(a,b)$ is defined symmetrically. The gradient is $\nabla f(a,b)=\big(f_x(a,b),f_y(a,b)\big)$.

Nothing new is needed to compute a partial derivative — it is exactly the single-variable machinery of the differentiation note, applied to a function of one variable at a time while the other is frozen. What genuinely is new, and is the subject of Section 2, is what it means for $f$ to be differentiable as a function of both variables together.

2. Differentiability: why partial derivatives are not enough

Definition

$f$ is (totally) differentiable at $(a,b)$ if $\displaystyle\lim_{(h,k)\to(0,0)}\frac{f(a+h,b+k)-f(a,b)-f_x(a,b)h-f_y(a,b)k}{\sqrt{h^2+k^2}}=0$ — the plane $z=f(a,b)+f_x(a,b)h+f_y(a,b)k$ approximates $f$ with an error that is $o$ of the distance moved, in every direction simultaneously.

Example — partial derivatives exist, but $f$ is not even continuous

$f(x,y)=\dfrac{xy}{x^2+y^2}$ for $(x,y)\neq(0,0)$, $f(0,0)=0$. Along each axis $f\equiv0$, so $f_x(0,0)=f_y(0,0)=0$ exist. But along $y=x$: $f(x,x)=\frac{x^2}{2x^2}=\frac12$ for every $x\neq0$, while $f(0,0)=0$ — so $f$ is not continuous at the origin, let alone differentiable there. Existence of both partial derivatives says nothing about behavior in directions other than the two axes; total differentiability, unlike the one-variable case (differentiation note, Section 2), is not automatic from one-directional information.

Theorem

If $f_x,f_y$ exist and are continuous near $(a,b)$ (i.e. $f\in C^1$), then $f$ is differentiable at $(a,b)$.

Proof. Write $f(a+h,b+k)-f(a,b)=\big[f(a+h,b+k)-f(a,b+k)\big]+\big[f(a,b+k)-f(a,b)\big]$. By the Mean Value Theorem (differentiation note, Section 7) applied to $x\mapsto f(x,b+k)$ on $[a,a+h]$, the first bracket is $f_x(c,b+k)h$ for some $c$ between $a,a+h$; applied to $y\mapsto f(a,y)$ on $[b,b+k]$, the second is $f_y(a,d)k$ for some $d$ between $b,b+k$. So $f(a+h,b+k)-f(a,b)-f_x(a,b)h-f_y(a,b)k=\big[f_x(c,b+k)-f_x(a,b)\big]h+\big[f_y(a,d)-f_y(a,b)\big]k$. As $(h,k)\to(0,0)$, $(c,b+k)\to(a,b)$ and $(a,d)\to(a,b)$, so continuity of $f_x,f_y$ at $(a,b)$ makes both bracketed terms $\to0$; since $|h|,|k|\leq\sqrt{h^2+k^2}$, dividing the whole expression by $\sqrt{h^2+k^2}$ still sends it to $0$.

3. The multivariable chain rule

Theorem

If $f$ is differentiable at $(a,b)=(x(t_0),y(t_0))$ and $x,y$ are differentiable at $t_0$, then $\dfrac{d}{dt}f(x(t),y(t))\Big|_{t_0}=f_x(a,b)x'(t_0)+f_y(a,b)y'(t_0)=\nabla f(a,b)\cdot\big(x'(t_0),y'(t_0)\big)$.

Proof. Let $h=x(t_0+s)-x(t_0)$, $k=y(t_0+s)-y(t_0)$. Differentiability of $f$ at $(a,b)$ gives $f(x(t_0+s),y(t_0+s))-f(a,b)=f_x(a,b)h+f_y(a,b)k+\varepsilon(h,k)\sqrt{h^2+k^2}$ where $\varepsilon(h,k)\to0$ as $(h,k)\to(0,0)$ (and $\varepsilon(0,0):=0$). Dividing by $s$: $\dfrac{f(x(t_0+s),y(t_0+s))-f(a,b)}{s}=f_x(a,b)\dfrac hs+f_y(a,b)\dfrac ks+\varepsilon(h,k)\dfrac{\sqrt{h^2+k^2}}{s}$. As $s\to0$: $h/s\to x'(t_0)$, $k/s\to y'(t_0)$ (definitions of the one-variable derivatives), $\sqrt{h^2+k^2}/s\to\sqrt{x'(t_0)^2+y'(t_0)^2}$ (bounded), and $(h,k)\to(0,0)$ (continuity of $x,y$ at $t_0$, from their differentiability — differentiation note, Section 2), so $\varepsilon(h,k)\to0$. The last term is (something $\to0$) $\times$ (something bounded) $\to0$, leaving the claimed limit.

Taking $f=F$, $x(t)=t$, $y(t)=g(t)$ for an implicitly defined $y=g(x)$ solving $F(x,y)=0$ recovers exactly the informal computation of implicit differentiation in the differentiation note (Section 10): $F_x+F_y\,g'(x)=0$, so $g'(x)=-F_x/F_y$ wherever $F_y\neq0$ — now derived from this section's rigorous chain rule rather than asserted. Section 8 below supplies the missing piece that note deferred: why a differentiable $g$ solving $F(x,y)=0$ exists near a point with $F_y\neq0$ in the first place.

4. Directional derivatives and steepest ascent

Definition and theorem

For a unit vector $\mathbf u=(u_1,u_2)$, the directional derivative is $D_{\mathbf u}f(a,b)=\lim_{t\to0}\frac{f(a+tu_1,b+tu_2)-f(a,b)}{t}$. If $f$ is differentiable at $(a,b)$, $D_{\mathbf u}f(a,b)=\nabla f(a,b)\cdot\mathbf u$ — an immediate corollary of the chain rule (Section 3) with $x(t)=a+tu_1$, $y(t)=b+tu_2$.

By the Cauchy–Schwarz inequality, $D_{\mathbf u}f(a,b)=\nabla f(a,b)\cdot\mathbf u\leq\|\nabla f(a,b)\|\,\|\mathbf u\|=\|\nabla f(a,b)\|$, with equality iff $\mathbf u$ points in the same direction as $\nabla f(a,b)$ (the Cauchy–Schwarz equality case). So among all directions, the gradient's own direction is exactly the one maximizing the instantaneous rate of increase, and that maximum rate is $\|\nabla f(a,b)\|$ itself — the fact that makes $-\nabla f$ the universal choice of descent direction in gradient-based optimization.

Left panel: contour plot of a paraboloid with the gradient vector drawn perpendicular to the level curve at a point. Right panel: the directional derivative as a function of direction angle, a cosine-shaped curve peaking exactly at the gradient's own angle and reaching the gradient's norm there.
Figure — The gradient: perpendicular to level curves, pointing toward steepest increase. Left: for $f(x,y)=x^2+2y^2$ at $(1,0.5)$, $\nabla f=(2,2)$ is drawn as an arrow; it is visibly perpendicular to the level curve of $f$ passing through that point (a general fact: $f$ is constant along a level curve, so the rate of change along the curve's tangent is $0$, forcing $\nabla f$ orthogonal to the tangent). Right: $D_{\mathbf u}f(1,0.5)$ as a function of the direction angle $\theta$ traces exactly the cosine curve $\|\nabla f\|\cos(\theta-\theta_0)$ predicted by the Cauchy–Schwarz argument, peaking precisely at $\theta_0=\arctan(2/2)=\pi/4$, the gradient's own angle, and reaching the value $\|\nabla f\|=\sqrt8\approx2.83$ there — visible confirmation of the equality case.

5. Clairaut's theorem: equality of mixed partials

Theorem

If $f_{xy}$ and $f_{yx}$ exist and are continuous near $(a,b)$, then $f_{xy}(a,b)=f_{yx}(a,b)$.

Proof. Let $\Delta(h,k)=f(a+h,b+k)-f(a+h,b)-f(a,b+k)+f(a,b)$. Setting $g(x)=f(x,b+k)-f(x,b)$, $\Delta(h,k)=g(a+h)-g(a)$; the Mean Value Theorem gives $\Delta(h,k)=g'(c)h$ for some $c$ between $a,a+h$, and $g'(x)=f_x(x,b+k)-f_x(x,b)$. Applying the MVT again, now to $y\mapsto f_x(c,y)$ on $[b,b+k]$: $f_x(c,b+k)-f_x(c,b)=f_{xy}(c,d)k$ for some $d$ between $b,b+k$. So $\Delta(h,k)=f_{xy}(c,d)\,hk$. Symmetrically, setting $\psi(y)=f(a+h,y)-f(a,y)$ gives $\Delta(h,k)=\psi(b+k)-\psi(b)=\psi'(d')k$ (MVT in $y$) $=\big[f_y(a+h,d')-f_y(a,d')\big]k=f_{yx}(c',d')\,hk$ (MVT in $x$), for some $c'$ between $a,a+h$ and $d'$ between $b,b+k$. Equating the two expressions for $\Delta(h,k)$ and dividing by $hk\neq0$: $f_{xy}(c,d)=f_{yx}(c',d')$. As $(h,k)\to(0,0)$, both $(c,d)$ and $(c',d')\to(a,b)$ (squeezed by construction), so continuity of $f_{xy},f_{yx}$ at $(a,b)$ gives $f_{xy}(a,b)=f_{yx}(a,b)$.

The proof is two applications of the one-variable MVT in each order, then a squeeze — the same double-MVT pattern used again in Section 6's proof of Taylor's theorem below, and structurally the same "compute two ways, equate, take a limit" strategy as the Cauchy Mean Value Theorem's role in L'Hôpital's rule (differentiation note, Section 8).

6. Taylor's theorem in two variables and the Hessian

Definition

The Hessian is $H(x,y)=\begin{pmatrix}f_{xx}&f_{xy}\\f_{yx}&f_{yy}\end{pmatrix}$, symmetric by Clairaut's theorem (Section 5) whenever $f\in C^2$.

Theorem (Taylor, second order)

If $f\in C^2$ near $(a,b)$, then $f(a+h,b+k)=f(a,b)+\nabla f(a,b)\cdot(h,k)+\dfrac12(h,k)\,H(a+\xi h,b+\xi k)\,(h,k)^T$ for some $\xi\in(0,1)$.

Proof. Reduce to one variable: let $\phi(t)=f(a+th,b+tk)$ for $t\in[0,1]$. By the chain rule (Section 3), $\phi'(t)=f_x(a+th,b+tk)h+f_y(a+th,b+tk)k$; differentiating again, each of $f_x,f_y$ is itself a function of $(x(t),y(t))=(a+th,b+tk)$, so the chain rule applies once more to each term: $\phi''(t)=\big[f_{xx}h+f_{xy}k\big]h+\big[f_{yx}h+f_{yy}k\big]k=(h,k)\,H(a+th,b+tk)\,(h,k)^T$ (using Clairaut's theorem to write $f_{xy}=f_{yx}$, matching the symmetric matrix form). The one-variable Taylor's theorem with Lagrange remainder (differentiation note, Section 9), applied to $\phi$ on $[0,1]$ at degree $1$: $\phi(1)=\phi(0)+\phi'(0)+\frac12\phi''(\xi)$ for some $\xi\in(0,1)$. Substituting $\phi(1)=f(a+h,b+k)$, $\phi(0)=f(a,b)$, $\phi'(0)=\nabla f(a,b)\cdot(h,k)$, and $\phi''(\xi)$ as computed above gives the claim.

The proof technique — restrict to the line segment joining the two points and invoke the one-variable theorem — is completely general and reduces essentially every multivariable differential fact used in this note back to single-variable calculus applied along a cleverly chosen path; Section 9's proof of the Lagrange multiplier condition uses exactly the same reduction, restricting to a constraint curve instead of a line.

7. Critical points and the second-derivative test

Theorem (Fermat, two variables)

If $f$ has a local extremum at an interior point $(a,b)$ where $f$ is differentiable, then $\nabla f(a,b)=\mathbf 0$.

Proof. If $(a,b)$ is a local extremum of $f$, then $a$ is a local extremum of the single-variable slice $x\mapsto f(x,b)$, and $b$ is a local extremum of $y\mapsto f(a,y)$. Fermat's theorem (differentiation note, Section 6) applied to each slice gives $f_x(a,b)=0$ and $f_y(a,b)=0$.

Points with $\nabla f=\mathbf0$ (or where $f$ fails to be differentiable) are critical points; as in the one-variable case, being critical is necessary but not sufficient for an extremum — classifying which is the job of the following test.

7.1 The test

Theorem (Second-derivative test)

Let $(a,b)$ be a critical point with $f\in C^2$ near it, and $D=f_{xx}(a,b)f_{yy}(a,b)-f_{xy}(a,b)^2$ (the determinant of the Hessian at $(a,b)$). Then: $D>0,\,f_{xx}(a,b)>0\Rightarrow$ local min; $D>0,\,f_{xx}(a,b)<0\Rightarrow$ local max; $D<0\Rightarrow$ saddle point; $D=0\Rightarrow$ inconclusive.

Proof (sketch). Since $\nabla f(a,b)=\mathbf0$, Taylor's theorem (Section 6) gives $f(a+h,b+k)-f(a,b)=Q(h,k)+o(h^2+k^2)$ where $Q(h,k)=\frac12(h,k)H(a,b)(h,k)^T=\frac12\big(f_{xx}h^2+2f_{xy}hk+f_{yy}k^2\big)$. Completing the square (assuming $f_{xx}\neq0$): $2f_{xx}Q(h,k)=(f_{xx}h+f_{xy}k)^2+Dk^2$. If $D>0$ and $f_{xx}>0$, the right side is $\geq0$ and $=0$ only at $(h,k)=(0,0)$, so $Q(h,k)>0$ for all $(h,k)\neq\mathbf 0$; by the Extreme Value Theorem (continuity note, Section 6), $Q$ restricted to the unit circle attains a positive minimum $m$, and homogeneity gives $Q(h,k)\geq m(h^2+k^2)$ everywhere — enough to absorb the $o(h^2+k^2)$ remainder for $(h,k)$ small, giving $f(a+h,b+k)>f(a,b)$ nearby: a local min. $D>0,f_{xx}<0$ is the same argument with signs flipped throughout (local max). If $D<0$: taking $k=0$ gives $2f_{xx}Q=f_{xx}^2h^2$, sign of $f_{xx}$; taking $h=-f_{xy}k/f_{xx}$ gives $2f_{xx}Q=Dk^2$, sign opposite $f_{xx}$ (since $D<0$) — so $Q$ takes both signs arbitrarily close to $(a,b)$, a saddle.

7.2 Classification via Hessian eigenvalues

$H(a,b)$ is symmetric (Clairaut, Section 5), so by the spectral theorem (eigenvalues note, Section 6) it has two real eigenvalues $\lambda_1,\lambda_2$ with $\lambda_1\lambda_2=\det H=D$ and $\lambda_1+\lambda_2=\operatorname{tr}H=f_{xx}+f_{yy}$. $D>0$ means $\lambda_1,\lambda_2$ share a sign; $f_{xx}>0$ in that case forces both positive (a positive-definite Hessian — the quadratic form $Q$ from Section 7.1 is exactly the Rayleigh-quotient-flavored object of that note's Section 8), giving a local min, and both negative gives a local max. $D<0$ means $\lambda_1,\lambda_2$ have opposite signs — the Hessian is indefinite, curving up in one eigendirection and down in the other, precisely the saddle geometry in Figure 2. The sign conditions on $D$ and $f_{xx}$ in Section 7.1 are, in this light, just a determinant-and-trace-only way of reading off the eigenvalues' signs without computing them.

Three contour plots side by side: an elliptical bowl of nested ellipses for a local minimum, an elliptical dome for a local maximum, and a hyperbolic saddle pattern of nested hyperbolas for a saddle point, each centered at the origin.
Figure — Level curves at a critical point: elliptical bowl, elliptical dome, or hyperbolic saddle. Three functions, each with a critical point at the origin, classified by $D$ and $f_{xx}$ exactly as Section 7.1 predicts: $f=x^2+xy+y^2$ has $D=3>0,f_{xx}=2>0$ and nested ellipses shrinking toward a genuine minimum; its negation has $D=3>0,f_{xx}=-2<0$ and nested ellipses around a maximum; $f=x^2-y^2$ has $D=-4<0$ and the hyperbolic level-curve pattern characteristic of a saddle, increasing along the $x$-axis and decreasing along the $y$-axis simultaneously.

8. The Implicit Function Theorem

Theorem

Let $F$ be $C^1$ near $(a,b)$ with $F(a,b)=0$ and $F_y(a,b)\neq0$. Then there is an interval $I$ around $a$ and a unique differentiable $g:I\to\mathbb R$ with $g(a)=b$ and $F(x,g(x))=0$ for all $x\in I$, satisfying $g'(x)=-\dfrac{F_x(x,g(x))}{F_y(x,g(x))}$.

Proof (sketch). Assume $F_y(a,b)>0$ (else replace $F$ by $-F$). By continuity of $F_y$, there is a rectangle $[a-\delta,a+\delta]\times[b-\eta,b+\eta]$ on which $F_y>0$. For each fixed $x$ in this range, the monotonicity theorem (differentiation note, Section 8) applied to $y\mapsto F(x,y)$ (differentiable with positive derivative $F_y(x,\cdot)$ throughout $[b-\eta,b+\eta]$) shows this slice is strictly increasing in $y$. At $x=a$: $F(a,b-\eta)<F(a,b)=0<F(a,b+\eta)$; by continuity of $F$ in $x$, shrinking $\delta$ if necessary keeps $F(x,b-\eta)<0<F(x,b+\eta)$ for every $x\in[a-\delta,a+\delta]$. The Intermediate Value Theorem (continuity note, Section 5) then gives, for each such $x$, a $y=g(x)\in(b-\eta,b+\eta)$ with $F(x,g(x))=0$ — unique by the strict monotonicity just established. A similar squeeze argument (shrinking $\eta$ as $x$ varies) gives continuity of $g$; once $g$ is known to be continuous, the derivative formula follows from the same computation as the informal implicit differentiation in Section 3, now legitimate because $g$ is known to exist.

$F_y(a,b)\neq0$ is not a technicality: it is exactly the condition ruling out a vertical tangent to the curve $F=0$ at $(a,b)$ (where no function $y=g(x)$ could locally describe the curve at all, e.g. the circle $x^2+y^2=1$ at $(1,0)$, where $F_y=2y=0$ — precisely where the earlier informal formula $y'=-F_x/F_y$ from Section 3 blows up).

9. Lagrange multipliers

Theorem

Let $f,g\in C^1$ near $(a,b)$ with $\nabla g(a,b)\neq\mathbf0$. If $(a,b)$ is a local extremum of $f$ restricted to the constraint curve $g(x,y)=c$, then $\nabla f(a,b)=\lambda\nabla g(a,b)$ for some scalar $\lambda$.

Proof. WLOG $g_y(a,b)\neq0$. The Implicit Function Theorem (Section 8) gives a differentiable $y=h(x)$ near $a$ with $g(x,h(x))=c$, $h(a)=b$, parametrizing the constraint curve near $(a,b)$. Then $\phi(x)=f(x,h(x))$ has a local extremum at $x=a$ (its domain traces exactly the constraint curve there), so Fermat's theorem (differentiation note, Section 6) gives $\phi'(a)=0$; by the chain rule (Section 3), $\phi'(a)=f_x(a,b)+f_y(a,b)h'(a)=0$. Differentiating $g(x,h(x))=c$ the same way gives $g_x(a,b)+g_y(a,b)h'(a)=0$, i.e. $h'(a)=-g_x(a,b)/g_y(a,b)$. Substituting: $f_x(a,b)-f_y(a,b)\dfrac{g_x(a,b)}{g_y(a,b)}=0$, i.e. $f_x(a,b)g_y(a,b)=f_y(a,b)g_x(a,b)$ — exactly the statement that $\nabla f(a,b)$ and $\nabla g(a,b)$ are parallel, with ratio $\lambda=f_y(a,b)/g_y(a,b)$.

Geometrically: the constraint curve's tangent direction at $(a,b)$ is $(1,h'(a))$, and $g_x(a,b)+g_y(a,b)h'(a)=0$ says this tangent is orthogonal to $\nabla g(a,b)$ (as it must be — $g$ is constant along its own level curve, Section 4). The proof shows $f$'s directional derivative along that same tangent must vanish at an extremum, forcing $\nabla f(a,b)$ orthogonal to the tangent too — and two vectors both orthogonal to the same direction in the plane are parallel to each other.

10. Multiple integrals and vector calculus, stated without proof

The remaining classical machinery of multivariable calculus is integral rather than differential, and proving it rigorously (measure-theoretic Fubini, the change-of-variables formula via a Riemann-sum argument in $\mathbb R^n$, Green's theorem via a decomposition into rectangles) is a substantially larger undertaking than this note's scope. The statements are recorded here for reference, each a direct higher-dimensional generalization of a single-variable fact already proved in the integration note.

Fubini's theorem (iterated integrals)

$\displaystyle\iint_Rf(x,y)\,dA=\int_a^b\int_{g_1(x)}^{g_2(x)}f(x,y)\,dy\,dx$ for suitable regions $R$ — a double integral is computed by integrating one variable at a time, in either order, when $f$ is continuous.

Change of variables

For $T:(u,v)\mapsto(x,y)$ a $C^1$ bijection with Jacobian $J=\det\begin{pmatrix}\partial x/\partial u&\partial x/\partial v\\\partial y/\partial u&\partial y/\partial v\end{pmatrix}$: $\displaystyle\iint_Rf(x,y)\,dA=\iint_Sf(x(u,v),y(u,v))\,|J|\,du\,dv$ — the direct generalization of the one-variable substitution rule (integration note, Section 6), with $|J|$ playing the role $|g'(x)|$ played there.

Green's theorem

For $\mathbf F=P\mathbf i+Q\mathbf j$ and a simple closed curve $C$ bounding a region $D$: $\displaystyle\oint_C\mathbf F\cdot d\mathbf r=\iint_D\left(\frac{\partial Q}{\partial x}-\frac{\partial P}{\partial y}\right)dA$ — a boundary integral equals an integral of a derivative over the interior, the two-dimensional analogue of the FTC (integration note, Section 5), where "boundary" of an interval is just its two endpoints.

(See Marsden & Tromba, 2012, Ch. 6 & 8, for full statements and proofs, including the divergence and Stokes' theorems in three dimensions of which Green's theorem is the planar special case.)

11. Computation

The figures above are generated by multivariable-calculus/generate_figures.py. The snippet below verifies Clairaut's theorem numerically (finite-difference mixed partials computed in both orders) and checks the second-derivative test's predictions against a direct perturbation scan around each critical point.

import numpy as np

def f(x, y):
    return np.sin(x) * y**2 + x**2 * np.cos(y)

h = 1e-4
def fxy(x, y):
    return (f(x+h,y+h) - f(x+h,y-h) - f(x-h,y+h) + f(x-h,y-h)) / (4*h*h)
def fyx(x, y):
    return (f(x+h,y+h) - f(x-h,y+h) - f(x+h,y-h) + f(x-h,y-h)) / (4*h*h)

print(f"f_xy(0.7,-0.3) = {fxy(0.7,-0.3):.8f}")
print(f"f_yx(0.7,-0.3) = {fyx(0.7,-0.3):.8f}")

cases = {
    "x^2+xy+y^2":    (lambda x,y: x**2+x*y+y**2,   2, 2, 1),
    "-(x^2+xy+y^2)": (lambda x,y: -(x**2+x*y+y**2), -2, -2, -1),
    "x^2-y^2":       (lambda x,y: x**2-y**2,        2, -2, 0),
}
for name, (fn, fxx, fyy, fxy_) in cases.items():
    D = fxx*fyy - fxy_**2
    thetas = np.linspace(0, 2*np.pi, 200)
    vals = np.array([fn(0.05*np.cos(t), 0.05*np.sin(t)) - fn(0,0) for t in thetas])
    actual = "local min" if np.all(vals > 0) else "local max" if np.all(vals < 0) else "saddle"
    print(f"f={name:16s} D={D:5.1f} f_xx={fxx:3d}  scan-confirmed={actual}")

Actual output:

f_xy(0.7,-0.3) = -0.04517702
f_yx(0.7,-0.3) = -0.04517702

f=x^2+xy+y^2       D=  3.0 f_xx=  2  scan-confirmed=local min
f=-(x^2+xy+y^2)    D=  3.0 f_xx= -2  scan-confirmed=local max
f=x^2-y^2          D= -4.0 f_xx=  2  scan-confirmed=saddle

The two finite-difference mixed partials agree to 8 decimal places, confirming Clairaut's theorem numerically for a function with no special symmetry; and a fine scan of $f$ around each critical point (sampling $200$ directions on a small circle) confirms every classification the second-derivative test predicts, exactly as the contour figure shows geometrically.

12. Common pitfalls

Pitfall — partial derivatives existing is much weaker than differentiability

Demonstrated in Section 2: $f(x,y)=xy/(x^2+y^2)$ (with $f(0,0)=0$) has both partial derivatives at the origin, yet is not even continuous there. Checking $f_x$ and $f_y$ exist is not a substitute for checking (or invoking the $C^1$ sufficient condition for) total differentiability.

Pitfall — $D=0$ is genuinely inconclusive, not "probably a saddle"

Both $f_1(x,y)=x^4+y^4$ and $f_2(x,y)=x^4-y^4$ have $\nabla f=\mathbf 0$ and every second partial equal to $0$ at the origin, so $D=0$ for both. Yet $f_1$ has a genuine local (in fact global) minimum at the origin ($f_1\geq0$ always), while $f_2$ is a saddle ($f_2(x,0)=x^4>0$ but $f_2(0,y)=-y^4<0$ for $x,y\neq0$). The second-derivative test's $D=0$ case is silent precisely because both outcomes are consistent with it — a higher-order (quartic) expansion is needed to distinguish them, not a refinement of the same quadratic test.

Pitfall — Clairaut's theorem needs continuity of the mixed partials, not just their existence

The classical counterexample is $f(x,y)=\dfrac{xy(x^2-y^2)}{x^2+y^2}$ for $(x,y)\neq(0,0)$, $f(0,0)=0$: both mixed partials exist everywhere, but $f_{xy}(0,0)=-1\neq1=f_{yx}(0,0)$ (see Apostol, 1974, §12.11, for the computation). Continuity of $f_{xy},f_{yx}$ at the point in question — the hypothesis actually used in Section 5's proof, via the final squeeze step — is not optional bookkeeping.

Pitfall — a Lagrange point is a critical point of the constrained problem, not automatically an extremum

Solving $\nabla f=\lambda\nabla g$ finds candidates the same way $f'=0$ finds one-variable candidates (differentiation note, Section 6) — necessary, not sufficient. Distinguishing an actual constrained max from a min or saddle-along-the-constraint needs a second-order argument or, often more simply in practice, comparing $f$'s values across all the candidate points directly (legitimate when the constraint set is compact, by the Extreme Value Theorem, continuity note Section 6).

13. Connections

14. References