Chapter 6 · Functions of Several Variables

6.1 Partial, Directional and Total Derivatives

Limits and continuity in $\mathbb{R}^n$, partial and directional derivatives, and the total derivative $Df(a)$ as the best linear approximation — with the chain rule, Schwarz's theorem on mixed partials and Taylor's formula in several variables.

In one variable a function is differentiable at $a$ when its graph, seen under a stronger and stronger microscope, becomes a straight line; the slope of that line is $f'(a)$. In several variables the same idea survives, but the "line" becomes a linear map: $f:\mathbb{R}^n\to\mathbb{R}^m$ is differentiable at $a$ when $f(a+h)-f(a)$ is, up to an error much smaller than $\|h\|$, a linear function of $h$. This linear map — the total derivative $Df(a)$, recorded by the Jacobian matrix — is what the chain rule multiplies, what the inverse and implicit function theorems of §6.2 invert, and what optimisation, mechanics and machine learning compute every day.

The new feature of several variables is that a point can be approached from infinitely many directions and along curves of every shape. As a result, the familiar one-variable implications break: a function can have both partial derivatives at a point and still be discontinuous there; it can have a directional derivative in every direction and still fail to be differentiable; its mixed partial derivatives $f_{xy}$ and $f_{yx}$ can differ. CSIR NET examines exactly these gaps — "which of the following is true at the origin?" — and this section collects the standard examples, together with the positive theorems ($C^1\Rightarrow$ differentiable, Schwarz's theorem) that close the gaps.

Limits and Continuity in $\mathbb{R}^n$

Throughout, $\mathbb{R}^n$ carries the Euclidean norm $\|x\|=\left(x_1^2+\cdots+x_n^2\right)^{1/2}$, and $U\subseteq\mathbb{R}^n$ denotes an open set. Since $\max_i|x_i|\le\|x\|\le\sqrt n\,\max_i|x_i|$, "$x\to a$" means the same thing whether we measure with $\|\cdot\|$ or coordinate by coordinate (Chapter 7 shows that all norms on $\mathbb{R}^n$ give the same convergence).

📘 Definition 6.1 — Limits and continuity in $\mathbb{R}^n$

The open ball of radius $r\gt0$ about $a$ is $B(a,r)=\{x\in\mathbb{R}^n:\|x-a\|\lt r\}$; a set $U$ is open if every point of $U$ is the centre of a ball contained in $U$. Let $E\subseteq\mathbb{R}^n$, let $f:E\to\mathbb{R}^m$, and let $a$ be a limit point of $E$.

  • $\displaystyle\lim_{x\to a}f(x)=L$ means: for every $\varepsilon\gt0$ there is $\delta\gt0$ such that $\|f(x)-L\|\lt\varepsilon$ for all $x\in E$ with $0\lt\|x-a\|\lt\delta$.
  • $f$ is continuous at $a\in E$ if for every $\varepsilon\gt0$ there is $\delta\gt0$ with $\|f(x)-f(a)\|\lt\varepsilon$ whenever $x\in E$, $\|x-a\|\lt\delta$.

For $n=2$ we write $\lim_{(x,y)\to(a,b)}f(x,y)$ and call it the double limit, to distinguish it from the iterated limits $\lim_{x\to a}\lim_{y\to b}f(x,y)$ and $\lim_{y\to b}\lim_{x\to a}f(x,y)$.

📐 Theorem 6.1 — Componentwise and sequential criteria; algebra of limits

Let $f=(f_1,\dots,f_m):E\to\mathbb{R}^m$ and let $a$ be a limit point of $E$.

  1. $\lim_{x\to a}f(x)=L$ if and only if $\lim_{x\to a}f_i(x)=L_i$ for every $i=1,\dots,m$.
  2. $\lim_{x\to a}f(x)=L$ if and only if $f(x_k)\to L$ for every sequence $x_k\in E\setminus\{a\}$ with $x_k\to a$.
  3. Limits of sums, scalar multiples, products and quotients (nonzero denominator limit) of real-valued functions are the sums, multiples, products and quotients of the limits. Consequently polynomials and rational functions in $x_1,\dots,x_n$ are continuous wherever they are defined, and compositions of continuous maps are continuous.

Proof. (1) follows from $|f_i(x)-L_i|\le\|f(x)-L\|\le\sqrt m\,\max_i|f_i(x)-L_i|$. (2) If the limit is $L$ and $x_k\to a$ with $x_k\ne a$, given $\varepsilon$ take $\delta$ from the definition and $K$ with $\|x_k-a\|\lt\delta$ for $k\ge K$; then $\|f(x_k)-L\|\lt\varepsilon$. Conversely, if the limit is not $L$, there is $\varepsilon\gt0$ such that for every $k$ some $x_k\in E$ has $0\lt\|x_k-a\|\lt1/k$ but $\|f(x_k)-L\|\ge\varepsilon$: this sequence violates the sequential condition. (3) is proved exactly as in one variable (§3.1), using (2) and the algebra of limits of sequences; each coordinate function $x\mapsto x_j$ is continuous because $|x_j-a_j|\le\|x-a\|$. ∎

📐 Theorem 6.2 — The two-path test and the squeeze test

Let $f$ be real-valued near $a\in\mathbb{R}^n$ (except possibly at $a$).

  1. Paths. If $\gamma_1,\gamma_2:(0,1]\to\mathbb{R}^n\setminus\{a\}$ satisfy $\gamma_j(t)\to a$ as $t\to0^+$, and $f(\gamma_1(t))\to L_1$, $f(\gamma_2(t))\to L_2$ with $L_1\ne L_2$ (or if one of these limits fails to exist), then $\lim_{x\to a}f(x)$ does not exist.
  2. Squeeze. If $|f(x)-L|\le g(\|x-a\|)$ for $0\lt\|x-a\|\lt r_0$, where $g(r)\to0$ as $r\to0^+$, then $\lim_{x\to a}f(x)=L$. In the plane this is often used in polar form: $|f(a+r\cos\theta,\,b+r\sin\theta)-L|\le g(r)$ with $g$ independent of $\theta$.

Proof. (1) If $\lim_{x\to a}f(x)=L$ existed, then by Theorem 6.1(2) (applied to the sequences $\gamma_j(1/k)$, and more generally to $\gamma_j(t_k)$ for any $t_k\to0^+$) we would have $f(\gamma_j(t))\to L$ for both $j$, forcing $L_1=L=L_2$. (2) Given $\varepsilon$, choose $\delta\le r_0$ with $g(r)\lt\varepsilon$ for $0\lt r\lt\delta$. ∎

Paths can only disprove a limit: agreement along every line, or even along every line and every parabola, proves nothing (Example 1(b)). A limit is proved by an estimate valid uniformly in all directions, as in part (2). The polar bound must not depend on $\theta$; "for each fixed $\theta$ the expression tends to $0$" is only the statement that the limit along each ray is $0$.

✏️ Example 1 — Four limits at the origin
Decide whether each limit as $(x,y)\to(0,0)$ exists, and find it if it does: (a) $\dfrac{xy}{x^2+y^2}$; (b) $\dfrac{x^2y}{x^4+y^2}$; (c) $\dfrac{x^2y^2}{x^2+y^2}$; (d) $\dfrac{x^3-y^3}{x^2+y^2}$.
(a) No limit Along the line $y=mx$, $x\ne0$: $\dfrac{x\cdot mx}{x^2+m^2x^2}=\dfrac{m}{1+m^2}$, a constant depending on $m$ ($0$ for $m=0$, $\tfrac12$ for $m=1$). Two paths, two limits: by Theorem 6.2(1) there is no limit.
(b) No limit Along $y=mx$: $\dfrac{mx^3}{x^4+m^2x^2}=\dfrac{mx}{x^2+m^2}\to0$ (for $m=0$ the function is $0$), and along the $y$-axis it is $0$. So every line gives $0$. But along the parabola $y=kx^2$: $\dfrac{kx^4}{x^4+k^2x^4}=\dfrac{k}{1+k^2}$, which is $\tfrac12$ for $k=1$. No limit.
(c) Limit $0$ From $2|xy|\le x^2+y^2$ we get $x^2y^2\le\tfrac14(x^2+y^2)^2$, so $0\le\dfrac{x^2y^2}{x^2+y^2}\le\tfrac14(x^2+y^2)=\tfrac14r^2\to0$. Squeeze (Theorem 6.2(2)).
(d) Limit $0$ In polar form the expression is $r(\cos^3\theta-\sin^3\theta)$, and $|\cos^3\theta-\sin^3\theta|\le2$; so it is at most $2r$ in absolute value, uniformly in $\theta$.
Pattern A quotient of homogeneous polynomials of degrees $p$ (top) and $q$ (bottom), with bottom vanishing only at $0$, tends to $0$ when $p\gt q$ and has no limit when $p=q$ (unless it is constant). (b) is not of this type — its denominator mixes degrees $4$ and $2$ — which is why a curved path is needed.
Interactive 1 — Approaching the Origin Along Lines and Parabolas

The left panel colours the square $[-1,1]^2$ by the value of $f$ (red positive, blue negative). A point slides along the chosen path into the origin; the right panel graphs $f$ along the path against the parameter $t$ (the point is at $x=t\cdot x_{\max}$, so $t\to0$ means "arriving at the origin"). Change the slope $m$ or the coefficient $k$: if different paths produce different end values, the limit does not exist. For the second function, lines all agree — try a parabola.

path—
point (x, y)—
f(x, y)—
limit along this path—

For functions of two variables one can also take the limits one variable at a time. The two procedures are genuinely different, and neither iterated limit determines the double limit.

📐 Theorem 6.3 — Double limits and iterated limits
Suppose $\lim_{(x,y)\to(a,b)}f(x,y)=L$ exists, and that for every $y\ne b$ near $b$ the limit $\varphi(y)=\lim_{x\to a}f(x,y)$ exists. Then the iterated limit $\lim_{y\to b}\varphi(y)$ exists and equals $L$. In particular, if both iterated limits exist but are different, the double limit does not exist.

Proof. Given $\varepsilon\gt0$, choose $\delta$ with $|f(x,y)-L|\lt\varepsilon$ whenever $0\lt\|(x,y)-(a,b)\|\lt\delta$. Fix $y$ with $0\lt|y-b|\lt\delta/2$. For $0\lt|x-a|\lt\delta/2$ the point $(x,y)$ is within $\delta$ of $(a,b)$ and differs from it, so $|f(x,y)-L|\lt\varepsilon$; letting $x\to a$ gives $|\varphi(y)-L|\le\varepsilon$. Thus $\varphi(y)\to L$ as $y\to b$. ∎

✏️ Example 2 — Iterated limits can mislead in both directions
(a) For $f(x,y)=\dfrac{xy}{x^2+y^2}$, compute both iterated limits at $(0,0)$. (b) Let $g(x,y)=x\sin\dfrac1y+y\sin\dfrac1x$ for $xy\ne0$ and $g=0$ on the axes. Show that the double limit of $g$ at $(0,0)$ is $0$ although neither iterated limit exists.
(a) For fixed $y\ne0$, $f(x,y)\to0$ as $x\to0$; so $\lim_{y\to0}\lim_{x\to0}f=0$, and by symmetry the other iterated limit is $0$ too. Yet the double limit does not exist (Example 1(a)). Equal iterated limits prove nothing.
(b) Double limit $|g(x,y)|\le|x|+|y|\le2\|(x,y)\|$, so $g\to0$ by the squeeze test.
(b) Iterated limits Fix $x\ne0$. As $y\to0$, the term $y\sin\frac1x\to0$ while $x\sin\frac1y$ oscillates between $\pm|x|$; so $\lim_{y\to0}g(x,y)$ does not exist, and $\lim_{x\to0}\lim_{y\to0}g$ is meaningless. By symmetry the other iterated limit fails too.
Moral Theorem 6.3 needs the inner limits to exist; when they do, they must lead to the double limit. The only safe use of iterated limits in an exam is the negative one: two different iterated limits kill the double limit.

Partial and Directional Derivatives

The simplest way to differentiate a function of several variables is to freeze all variables but one. More generally we can move from $a$ along any straight line and differentiate the resulting function of one variable.

📘 Definition 6.2 — Partial derivatives, directional derivatives, gradient

Let $f:U\to\mathbb{R}$, $a\in U$, and let $e_1,\dots,e_n$ be the standard basis of $\mathbb{R}^n$. For $v\in\mathbb{R}^n$, the derivative of $f$ at $a$ along $v$ is

$$D_vf(a)=\lim_{t\to0}\frac{f(a+tv)-f(a)}{t},$$

when this limit exists. For a unit vector $u$, $D_uf(a)$ is the directional derivative in the direction $u$ (CSIR questions use unit vectors unless they say otherwise). The partial derivatives are $\dfrac{\partial f}{\partial x_j}(a)=D_jf(a)=D_{e_j}f(a)$; in the plane we write $f_x,f_y$. If all $n$ partial derivatives exist, the gradient is $\nabla f(a)=\left(D_1f(a),\dots,D_nf(a)\right)$. For $f=(f_1,\dots,f_m):U\to\mathbb{R}^m$ everything is taken componentwise.

Two remarks. First, $D_vf(a)$ is the ordinary derivative at $t=0$ of the one-variable function $t\mapsto f(a+tv)$, so every one-variable rule applies; and $D_{cv}f(a)=c\,D_vf(a)$ for every scalar $c$. Second, and this is the trap, partial and directional derivatives only look at $f$ on lines through $a$. They cannot see what happens along curves, so they do not control continuity: for $f(x,y)=\dfrac{xy}{x^2+y^2}$, $f(0,0)=0$, we have $f(x,0)=0=f(0,y)$, hence $f_x(0,0)=f_y(0,0)=0$, although $f$ is not even continuous at the origin (Example 1(a)).

The Total Derivative as a Linear Map

The right generalisation of differentiability asks for a single linear map that approximates $f(a+h)-f(a)$ for all small $h$ simultaneously, with an error that is small compared with $\|h\|$.

📘 Definition 6.3 — Differentiability, the total derivative and the Jacobian

Let $f:U\to\mathbb{R}^m$ and $a\in U$. $f$ is differentiable at $a$ if there is a linear map $T:\mathbb{R}^n\to\mathbb{R}^m$ such that

$$\lim_{h\to0}\frac{\|f(a+h)-f(a)-Th\|}{\|h\|}=0.$$

Equivalently, $f(a+h)=f(a)+Th+\|h\|\,\varepsilon(h)$ with $\varepsilon(h)\to0=\varepsilon(0)$. The map $T$ is the total derivative (or Fréchet derivative) $Df(a)$. Its matrix with respect to the standard bases is the $m\times n$ Jacobian matrix $J_f(a)$; when $m=n$, $\det J_f(a)$ is the Jacobian determinant. $f$ is differentiable on $U$ if it is differentiable at every point of $U$.

📐 Theorem 6.4 — What differentiability gives

Let $f=(f_1,\dots,f_m):U\to\mathbb{R}^m$ be differentiable at $a$, with $T=Df(a)$. Then:

  1. $T$ is unique, and $f$ is continuous at $a$.
  2. For every $v\in\mathbb{R}^n$ the derivative along $v$ exists and $D_vf(a)=Df(a)v$; in particular $v\mapsto D_vf(a)$ is linear.
  3. All partial derivatives exist and $J_f(a)=\left[\dfrac{\partial f_i}{\partial x_j}(a)\right]_{i,j}$ (row $i$ is $\nabla f_i(a)$).
  4. For real-valued $f$: $D_uf(a)=\nabla f(a)\cdot u$ for every unit vector $u$. Hence $|D_uf(a)|\le\|\nabla f(a)\|$; if $\nabla f(a)\ne0$, the largest directional derivative is $\|\nabla f(a)\|$, attained only for $u=\nabla f(a)/\|\nabla f(a)\|$, and $D_uf(a)=0$ exactly for $u\perp\nabla f(a)$.

Proof. (2) Fix $v\ne0$ and put $h=tv$ with $t\to0$, $t\ne0$. Then

$$\left\|\frac{f(a+tv)-f(a)}{t}-Tv\right\|=\frac{\|f(a+tv)-f(a)-T(tv)\|}{\|tv\|}\,\|v\|\to0,$$

so $D_vf(a)$ exists and equals $Tv$ (for $v=0$ both sides are $0$). (1) If $T'$ also satisfies the definition, then $Tv=D_vf(a)=T'v$ for every $v$ by (2), so $T=T'$. Continuity: $\|f(a+h)-f(a)\|\le\|Th\|+\|h\|\,\|\varepsilon(h)\|$, which is at most $\left(\|T\|+\|\varepsilon(h)\|\right)\|h\|\to0$, where $\|T\|=\max_{\|v\|=1}\|Tv\|$ is finite because a linear map on $\mathbb{R}^n$ is continuous and the unit sphere is compact. (3) The $(i,j)$ entry of the matrix of $T$ is the $i$-th component of $Te_j=D_{e_j}f(a)=\left(D_jf_1(a),\dots,D_jf_m(a)\right)$. (4) For real $f$, $J_f(a)$ is the row vector $\nabla f(a)$, so $D_uf(a)=\nabla f(a)\cdot u$. By the Cauchy–Schwarz inequality $|\nabla f(a)\cdot u|\le\|\nabla f(a)\|\,\|u\|=\|\nabla f(a)\|$, with equality (and positive sign) iff $u$ is a positive multiple of $\nabla f(a)$. ∎

Geometrically, for $f:U\to\mathbb{R}$ with $U\subseteq\mathbb{R}^2$ the graph of $h\mapsto f(a)+\nabla f(a)\cdot h$ is the tangent plane $z=f(a)+f_x(a)(x-a_1)+f_y(a)(y-a_2)$, and the gradient is perpendicular to the level curve of $f$ through $a$ (the derivative of $f$ along the curve is $0$).

✏️ Example 3 — A gradient and a directional derivative
Let $f(x,y,z)=x^2y+e^{yz}$ and $a=(1,2,0)$. Find $\nabla f(a)$, the directional derivative of $f$ at $a$ in the direction of $v=(2,-1,2)$, the maximal rate of increase of $f$ at $a$, and the tangent plane to the level surface $f=f(a)$ at $a$.
Gradient $f_x=2xy$, $f_y=x^2+ze^{yz}$, $f_z=ye^{yz}$. These are continuous everywhere, so $f$ is differentiable (Theorem 6.5 below) and $\nabla f(1,2,0)=(4,\ 1+0,\ 2)=(4,1,2)$.
Direction $\|v\|=\sqrt{4+1+4}=3$, so $u=\tfrac13(2,-1,2)$ and $D_uf(a)=\nabla f(a)\cdot u=\tfrac13(8-1+4)=\tfrac{11}{3}$. (Using $v$ itself instead of $u$ would give $D_vf(a)=11$ — always normalise.)
Maximal rate $\|\nabla f(a)\|=\sqrt{16+1+4}=\sqrt{21}\approx4.583$, in the direction $(4,1,2)/\sqrt{21}$. Check: $\tfrac{11}3\approx3.667\le\sqrt{21}$.
Tangent plane $f(a)=1\cdot2+e^0=3$, and the plane through $a$ perpendicular to $\nabla f(a)$ is $4(x-1)+(y-2)+2z=0$, i.e. $4x+y+2z=6$.
🧭 Testing differentiability at a point
  1. Is $f$ continuous at $a$? If not, stop: $f$ is not differentiable (Theorem 6.4(1)).
  2. Compute the partial derivatives at $a$ from the definition (do not differentiate a formula that is valid only away from $a$). If one fails to exist, $f$ is not differentiable. Otherwise the only candidate is $Th=\nabla f(a)\cdot h$ (componentwise for vector $f$).
  3. Quick necessary test: if some directional derivative is missing, or $D_uf(a)\ne\nabla f(a)\cdot u$ for some $u$, then $f$ is not differentiable.
  4. Decisive test: examine $\rho(h)=\dfrac{f(a+h)-f(a)-\nabla f(a)\cdot h}{\|h\|}$. Prove $\rho\to0$ by a bound uniform in direction (polar form), or disprove it with a path along which $\rho\not\to0$.
  5. Shortcut: if the partials exist near $a$ and are continuous at $a$, $f$ is differentiable (Theorem 6.5). The converse fails (Example 4(d)).
📘 Definition 6.4 — $C^1$ maps; the operator norm
$f:U\to\mathbb{R}^m$ is continuously differentiable, or of class $C^1$, on $U$ if all partial derivatives $\partial f_i/\partial x_j$ exist and are continuous on $U$. For a linear map (or matrix) $T:\mathbb{R}^n\to\mathbb{R}^m$, the operator norm is $\|T\|=\max_{\|v\|=1}\|Tv\|$; it satisfies $\|Tv\|\le\|T\|\,\|v\|$, $\|ST\|\le\|S\|\,\|T\|$ and $\|T\|\le\left(\sum_{i,j}t_{ij}^2\right)^{1/2}$.
📐 Theorem 6.5 — Continuous partial derivatives imply differentiability
Let $f:U\to\mathbb{R}^m$ and $a\in U$. If all partial derivatives $D_jf_i$ exist on a ball $B(a,r)\subseteq U$ and are continuous at $a$, then $f$ is differentiable at $a$. In particular every $C^1$ map is differentiable on $U$, and so is every polynomial map.

Proof. By Theorem 6.1(1) applied to the quotient in Definition 6.3, it suffices to treat a real-valued $f$. Let $h=(h_1,\dots,h_n)$ with $\|h\|\lt r$, and walk from $a$ to $a+h$ along the edges of a box: put $p_0=a$ and $p_j=a+h_1e_1+\cdots+h_je_j$, so $p_n=a+h$, and every $p_j$ lies in $B(a,r)$ (indeed $\|p_j-a\|\le\|h\|$). Then

$$f(a+h)-f(a)=\sum_{j=1}^n\left[f(p_{j-1}+h_je_j)-f(p_{j-1})\right].$$

On the $j$-th edge only the $j$-th coordinate changes, so $s\mapsto f(p_{j-1}+se_j)$ is a function of one variable with derivative $D_jf(p_{j-1}+se_j)$; by the one-variable mean value theorem (§3.3) the $j$-th bracket equals $h_j\,D_jf(q_j)$ for some point $q_j$ on that edge, so $\|q_j-a\|\le\|h\|$. Hence

$$\left|f(a+h)-f(a)-\sum_jD_jf(a)h_j\right|=\left|\sum_j\left(D_jf(q_j)-D_jf(a)\right)h_j\right|\le\|h\|\sum_j\left|D_jf(q_j)-D_jf(a)\right|.$$

As $h\to0$ we have $q_j\to a$, and continuity of $D_jf$ at $a$ makes the last sum tend to $0$. So $f$ is differentiable at $a$ with $Df(a)h=\nabla f(a)\cdot h$. ∎

The proof uses continuity at $a$ of only $n-1$ of the partials: on the first edge one can use the definition of $D_1f(a)$ directly, because $p_0=a$. So if $f_y$ is continuous at $a$ and $f_x(a)$ merely exists, $f$ is differentiable at $a$ — a refinement that occasionally decides a Part C option.

✏️ Example 4 — Four functions at the origin
Define each function to be $0$ at $(0,0)$. Decide continuity, existence of directional derivatives and differentiability at the origin: (a) $f_1=\dfrac{xy}{x^2+y^2}$; (b) $f_2=\dfrac{x^2y}{x^2+y^2}$; (c) $f_3=\dfrac{x^3y}{x^4+y^2}$; (d) $f_4=(x^2+y^2)\sin\dfrac1{\sqrt{x^2+y^2}}$; for (d) also decide whether the partial derivatives are continuous at $0$.
(a) Discontinuous (Example 1(a)), so not differentiable, although $f_x(0,0)=f_y(0,0)=0$. Directional derivatives in non-axis directions do not exist: $f_1(tu)/t=u_1u_2/t$ is unbounded when $u_1u_2\ne0$.
(b) Continuous: $|f_2|\le|y|$. For a unit vector $u$, $f_2(tu)=t\,u_1^2u_2$, so $D_uf_2(0)=u_1^2u_2$ exists for every $u$. In particular $f_x=f_y=0$, so differentiability would force $D_uf_2(0)=\nabla f_2(0)\cdot u=0$ for all $u$; but $D_uf_2(0)=\tfrac{1}{2\sqrt2}\ne0$ for $u=\tfrac1{\sqrt2}(1,1)$. Not differentiable: $u\mapsto D_uf_2(0)$ is not linear.
(c) Continuous: $x^4+y^2\ge2x^2|y|$ gives $|f_3|\le\tfrac12|x|$. For $u_2\ne0$, $f_3(tu)/t=\dfrac{t\,u_1^3u_2}{t^2u_1^4+u_2^2}\to0$, and $f_3=0$ on the $x$-axis; so $D_uf_3(0)=0$ for all $u$ — perfectly linear. Still, along $h=(s,s^2)$, $s\gt0$: $\dfrac{f_3(h)}{\|h\|}=\dfrac{s^5/(2s^4)}{s\sqrt{1+s^2}}\to\tfrac12\ne0$. Not differentiable.
(d) $|f_4(h)|\le\|h\|^2$, so $f_4(h)/\|h\|\to0$: differentiable with $Df_4(0)=0$. For $(x,y)\ne0$, with $r=\sqrt{x^2+y^2}$, $\ \dfrac{\partial f_4}{\partial x}=2x\sin\dfrac1r-\dfrac{x}{r}\cos\dfrac1r$. On the positive $x$-axis this is $2x\sin\frac1x-\cos\frac1x$, which has no limit as $x\to0^+$. So $f_4$ is differentiable at $0$ but not $C^1$ near $0$: Theorem 6.5 is not reversible.
Summary partials exist $\not\Rightarrow$ continuous; all $D_uf$ exist $\not\Rightarrow$ differentiable; all $D_uf$ exist and are linear in $u$ $\not\Rightarrow$ differentiable; differentiable $\not\Rightarrow C^1$. But: $C^1\Rightarrow$ differentiable $\Rightarrow$ continuous and all $D_uf=\nabla f\cdot u$.
Interactive 2 — The Directional-Derivative Dial and the Remainder Test

The unit vector $u=(\cos\theta,\sin\theta)$ (purple) turns around the point $a$; the green arrow is $\nabla f(a)$. On the right, the solid curve is $\theta\mapsto D_uf(a)$, and the dashed curve is what differentiability predicts, $\nabla f(a)\cdot u$ — always a sinusoid. Below, $R(\rho)$ is the largest value of $|f(a+h)-f(a)-\nabla f(a)\cdot h|/\rho$ over the circle $\|h\|=\rho$: $f$ is differentiable at $a$ exactly when $R(\rho)\to0$. Move the $\rho$ slider towards $0$.

θ—
D_u f(a)—
∇f(a)·u—
ρ—
R(ρ)—

The Chain Rule, Euler's Theorem and the Mean Value Theorem

The great advantage of the total derivative over partial derivatives is that it composes: the derivative of a composite is the composite of the derivatives, and in coordinates Jacobian matrices multiply.

📐 Theorem 6.6 — Chain rule
Let $U\subseteq\mathbb{R}^n$ and $V\subseteq\mathbb{R}^m$ be open, $g:U\to\mathbb{R}^m$ with $g(U)\subseteq V$, and $f:V\to\mathbb{R}^p$. If $g$ is differentiable at $a$ and $f$ is differentiable at $b=g(a)$, then $f\circ g$ is differentiable at $a$ and $$D(f\circ g)(a)=Df(b)\circ Dg(a),\qquad J_{f\circ g}(a)=J_f(b)\,J_g(a).$$ In particular, $\dfrac{\partial(f\circ g)_i}{\partial x_j}(a)=\displaystyle\sum_{k=1}^m\frac{\partial f_i}{\partial y_k}(b)\,\frac{\partial g_k}{\partial x_j}(a)$.

Proof. Write $A=Dg(a)$, $B=Df(b)$ and

$$g(a+h)=b+Ah+\|h\|\,\varepsilon_1(h),\qquad f(b+k)=f(b)+Bk+\|k\|\,\varepsilon_2(k),$$

with $\varepsilon_1(h)\to0$ as $h\to0$, $\varepsilon_2(k)\to0$ as $k\to0$, and $\varepsilon_1(0)=0$, $\varepsilon_2(0)=0$. Put $k(h)=g(a+h)-b=Ah+\|h\|\varepsilon_1(h)$. Then $\|k(h)\|\le\left(\|A\|+\|\varepsilon_1(h)\|\right)\|h\|$, so $k(h)\to0$, and

$$f(g(a+h))-f(b)-BAh=\|h\|\,B\varepsilon_1(h)+\|k(h)\|\,\varepsilon_2(k(h)).$$

Divide by $\|h\|$: the first term is at most $\|B\|\,\|\varepsilon_1(h)\|\to0$, and the second at most $\left(\|A\|+\|\varepsilon_1(h)\|\right)\|\varepsilon_2(k(h))\|\to0$, since $k(h)\to0$ and $\varepsilon_2$ is continuous at $0$ with value $0$. (Setting $\varepsilon_2(0)=0$ is what handles the points where $k(h)=0$ — the step at which the naive "multiply and divide by $\Delta g$" proof breaks down, exactly as in one variable.) Hence $D(f\circ g)(a)=BA$; the matrix of a composite is the product of the matrices. ∎

The most used special case: if $x(t),y(t)$ are differentiable and $f$ is differentiable, then $\dfrac{d}{dt}f(x(t),y(t))=f_x\,x'(t)+f_y\,y'(t)=\nabla f\cdot\gamma'(t)$ with $\gamma=(x,y)$. Note that $f$ must be differentiable, not merely have partial derivatives: for $f_2=\frac{x^2y}{x^2+y^2}$ and $\gamma(t)=(t,t)$, $f_2(\gamma(t))=t/2$ has derivative $\tfrac12$, whereas $\nabla f_2(0)\cdot\gamma'(0)=0$.

✏️ Example 5 — Jacobians multiply; polar coordinates
(a) Let $G(x,y)=(x+y,\ x-y)$ and $F(u,v)=(u^2+v,\ uv)$. Compute $J_{F\circ G}(1,0)$ with the chain rule and check it directly. (b) Let $f$ be differentiable on $\mathbb{R}^2$ and $w(r,\theta)=f(r\cos\theta,r\sin\theta)$. Express $w_r,w_\theta$ through $f_x,f_y$ and show that $f_x^2+f_y^2=w_r^2+\dfrac1{r^2}w_\theta^2$ for $r\gt0$.
(a) Chain rule $G(1,0)=(1,1)$, $J_G=\begin{pmatrix}1&1\\1&-1\end{pmatrix}$, $J_F(u,v)=\begin{pmatrix}2u&1\\v&u\end{pmatrix}$, so $J_F(1,1)=\begin{pmatrix}2&1\\1&1\end{pmatrix}$ and $$J_{F\circ G}(1,0)=\begin{pmatrix}2&1\\1&1\end{pmatrix}\begin{pmatrix}1&1\\1&-1\end{pmatrix}=\begin{pmatrix}3&1\\2&0\end{pmatrix}.$$
(a) Check $F\circ G(x,y)=\left((x+y)^2+x-y,\ x^2-y^2\right)$. Its partials are $(2x+2y+1,\ 2x+2y-1)$ and $(2x,\ -2y)$, which at $(1,0)$ give the rows $(3,1)$ and $(2,0)$. ✓ Also $\det J_{F\circ G}=-2=\det J_F(1,1)\cdot\det J_G=1\cdot(-2)$.
(b) With $x=r\cos\theta$, $y=r\sin\theta$: $$w_r=f_x\cos\theta+f_y\sin\theta,\qquad w_\theta=-f_x\,r\sin\theta+f_y\,r\cos\theta.$$ Then $w_r^2+\tfrac1{r^2}w_\theta^2=(f_x\cos\theta+f_y\sin\theta)^2+(-f_x\sin\theta+f_y\cos\theta)^2=f_x^2+f_y^2$, the cross terms cancelling and $\cos^2+\sin^2=1$.
Meaning $\|\nabla f\|^2$ does not depend on the coordinates used: in polar coordinates the gradient is $w_r\,\hat e_r+\tfrac1rw_\theta\,\hat e_\theta$ with orthonormal $\hat e_r,\hat e_\theta$.
📘 Definition 6.5 — Homogeneous functions
Let $C\subseteq\mathbb{R}^n\setminus\{0\}$ be an open cone ($x\in C$, $t\gt0\Rightarrow tx\in C$). A function $f:C\to\mathbb{R}$ is (positively) homogeneous of degree $k\in\mathbb{R}$ if $f(tx)=t^kf(x)$ for all $x\in C$ and $t\gt0$. Examples: $x^2y-3y^3$ (degree $3$), $\sqrt{x^2+y^2}$ (degree $1$), $\dfrac{xy}{x^2+y^2}$ (degree $0$), $\dfrac{x^4+y^4}{x+y}$ on $\{x+y\gt0\}$ (degree $3$).
📐 Theorem 6.7 — Euler's theorem on homogeneous functions
Let $f$ be differentiable on an open cone $C$. Then $f$ is homogeneous of degree $k$ if and only if $$x\cdot\nabla f(x)=\sum_{i=1}^nx_i\frac{\partial f}{\partial x_i}(x)=k\,f(x)\qquad(x\in C).$$ If moreover $f$ is $C^2$ and homogeneous of degree $k$, then $\displaystyle\sum_{i,j}x_ix_j\frac{\partial^2f}{\partial x_i\partial x_j}=k(k-1)f$.

Proof. Fix $x\in C$ and let $\varphi(t)=f(tx)$, $t\gt0$. By the chain rule $\varphi'(t)=\nabla f(tx)\cdot x$. If $f$ is homogeneous, $\varphi(t)=t^kf(x)$, so $\varphi'(1)=kf(x)$, which is the identity. Conversely, if the identity holds everywhere on $C$, then $t\varphi'(t)=tx\cdot\nabla f(tx)=k\varphi(t)$, so $\dfrac{d}{dt}\left(t^{-k}\varphi(t)\right)=t^{-k-1}\left(t\varphi'(t)-k\varphi(t)\right)=0$ on $(0,\infty)$; hence $t^{-k}\varphi(t)=\varphi(1)$, i.e. $f(tx)=t^kf(x)$. For the second identity, each $\partial f/\partial x_j$ is homogeneous of degree $k-1$ (differentiate $f(tx)=t^kf(x)$ with respect to $x_j$), so by the first part $\sum_ix_i\,\partial_i\partial_jf=(k-1)\partial_jf$; multiply by $x_j$ and sum: $\sum_{i,j}x_ix_j\,\partial_i\partial_jf=(k-1)\,x\cdot\nabla f=k(k-1)f$. ∎

A typical use: for $u=\log\dfrac{x^4+y^4}{x+y}$ on $x+y\gt0$, the function $e^u$ is homogeneous of degree $3$, and $x(e^u)_x+y(e^u)_y=e^u(xu_x+yu_y)=3e^u$ gives $xu_x+yu_y=3$ without computing a single derivative.

📐 Theorem 6.8 — Mean value theorem and mean value inequality

Let $U\subseteq\mathbb{R}^n$ be open and let the segment $[a,b]=\{a+t(b-a):0\le t\le1\}$ lie in $U$.

  1. If $f:U\to\mathbb{R}$ is differentiable on $U$, then $f(b)-f(a)=\nabla f(c)\cdot(b-a)$ for some $c$ on the open segment between $a$ and $b$.
  2. If $f:U\to\mathbb{R}^m$ is differentiable on $U$ and $\|Df(x)\|\le M$ for all $x\in[a,b]$, then $\|f(b)-f(a)\|\le M\|b-a\|$. For $m\ge2$ there need not be any $c$ with $f(b)-f(a)=Df(c)(b-a)$.
  3. If $U$ is open and connected and $Df(x)=0$ for every $x\in U$, then $f$ is constant on $U$.

Proof. (1) $\varphi(t)=f(a+t(b-a))$ is differentiable on a neighbourhood of $[0,1]$ with $\varphi'(t)=\nabla f(a+t(b-a))\cdot(b-a)$ (chain rule). The one-variable mean value theorem gives $\varphi(1)-\varphi(0)=\varphi'(\tau)$ for some $\tau\in(0,1)$; take $c=a+\tau(b-a)$.

(2) If $f(b)=f(a)$ there is nothing to prove. Otherwise let $w=\dfrac{f(b)-f(a)}{\|f(b)-f(a)\|}$, a unit vector, and apply (1) to the real function $g(x)=w\cdot f(x)$, whose gradient satisfies $\nabla g(x)\cdot v=w\cdot Df(x)v$. We get $c$ with $\|f(b)-f(a)\|=g(b)-g(a)$ $=w\cdot Df(c)(b-a)$, and by Cauchy–Schwarz this is at most $\|Df(c)\|\,\|b-a\|\le M\|b-a\|$. For the failure of equality take $f(t)=(\cos t,\sin t)$ on $[0,2\pi]$: $f(2\pi)-f(0)=0$, while $f'(c)=(-\sin c,\cos c)$ is never $0$.

(3) Fix $a\in U$ and let $S=\{x\in U:f(x)=f(a)\}$. $S$ is nonempty, and closed in $U$ because $f$ is continuous. It is open: if $x\in S$ and $B(x,r)\subseteq U$, every $y\in B(x,r)$ is joined to $x$ by a segment inside the ball, and (2) with $M=0$ gives $f(y)=f(x)=f(a)$. A nonempty subset of a connected set that is both open and closed in it is the whole set (§7.3), so $S=U$. ∎

Connectedness cannot be dropped in (3): on $U=(0,1)\cup(2,3)$ the function equal to $0$ on the first interval and $1$ on the second has derivative $0$. And a single vanishing partial is weaker than one might think — $f_x\equiv0$ on a connected $U$ means that $f$ is constant on each horizontal segment in $U$, not that $f$ is independent of $x$ (Exercise III.7).

Higher Derivatives: Schwarz's Theorem and Taylor's Formula

📘 Definition 6.6 — Higher partial derivatives, $C^k$, the Hessian

If $D_jf$ exists near $a$ and has a partial derivative with respect to $x_i$ at $a$, we write $D_iD_jf(a)=\dfrac{\partial^2f}{\partial x_i\,\partial x_j}(a)$. In the plane we use the subscript convention $f_{xy}=(f_x)_y=\dfrac{\partial^2f}{\partial y\,\partial x}$ — differentiate first in $x$, then in $y$. $f$ is of class $C^k$ on $U$ if all partial derivatives of order $\le k$ exist and are continuous on $U$; $C^\infty$ means $C^k$ for every $k$. For $f\in C^2$, the Hessian matrix at $a$ is $H_f(a)=\left[D_iD_jf(a)\right]_{i,j=1}^n$.

✏️ Example 6 — Mixed partial derivatives that differ
Let $f(x,y)=\dfrac{xy(x^2-y^2)}{x^2+y^2}$ for $(x,y)\ne(0,0)$ and $f(0,0)=0$. Show that $f$ is $C^1$ on $\mathbb{R}^2$, but $f_{xy}(0,0)=-1$ and $f_{yx}(0,0)=1$.
$f_x$ on the $y$-axis $f(0,y)=0$, and for $y\ne0$: $\dfrac{f(h,y)-f(0,y)}{h}=\dfrac{y(h^2-y^2)}{h^2+y^2}\to\dfrac{-y^3}{y^2}=-y$ as $h\to0$. Also $f_x(0,0)=0$ since $f(h,0)=0$. So $f_x(0,y)=-y$ for every $y$.
$f_y$ on the $x$-axis Similarly $\dfrac{f(x,k)-f(x,0)}{k}=\dfrac{x(x^2-k^2)}{x^2+k^2}\to x$, so $f_y(x,0)=x$ for every $x$.
Mixed partials $f_{xy}(0,0)=\dfrac{d}{dy}\Big|_{y=0}f_x(0,y)=-1$, while $f_{yx}(0,0)=\dfrac{d}{dx}\Big|_{x=0}f_y(x,0)=+1$.
$C^1$ Away from the origin $f$ is rational, hence $C^\infty$. In polar form $f=\tfrac14r^2\sin4\theta$, and its first partials are homogeneous of degree $1$ — for instance $f_x=\dfrac{y(x^4+4x^2y^2-y^4)}{(x^2+y^2)^2}$ satisfies $|f_x|\le\dfrac{|y|\cdot6r^4}{r^4}\le6r$ — so $f_x,f_y\to0=f_x(0,0)=f_y(0,0)$. Thus $f\in C^1$; but the second partials are homogeneous of degree $0$ and non-constant, hence discontinuous at $0$. Schwarz's theorem below explains why some discontinuity was unavoidable.
📐 Theorem 6.9 — Schwarz's (Clairaut's) theorem on mixed partials
Let $f:U\to\mathbb{R}$, $U\subseteq\mathbb{R}^2$ open, $(a,b)\in U$. Suppose $f_x$, $f_y$ and $f_{xy}$ exist on a neighbourhood of $(a,b)$ and $f_{xy}$ is continuous at $(a,b)$. Then $f_{yx}(a,b)$ exists and $f_{yx}(a,b)=f_{xy}(a,b)$. In particular, if $f\in C^2(U)$ then $f_{xy}=f_{yx}$ on $U$; for $f\in C^k$ on an open set in $\mathbb{R}^n$, a partial derivative of order $\le k$ does not depend on the order of differentiation, and the Hessian of a $C^2$ function is symmetric.

Proof. For small $h,k\ne0$ consider the second difference

$$\Delta(h,k)=f(a+h,b+k)-f(a+h,b)-f(a,b+k)+f(a,b).$$

Step 1. Let $\varphi(s)=f(s,b+k)-f(s,b)$. Then $\Delta=\varphi(a+h)-\varphi(a)$, and $\varphi'(s)=f_x(s,b+k)-f_x(s,b)$ exists near $a$. By the mean value theorem, for some $\theta\in(0,1)$,

$$\Delta=h\,\varphi'(a+\theta h)=h\left[f_x(a+\theta h,b+k)-f_x(a+\theta h,b)\right].$$

The function $t\mapsto f_x(a+\theta h,t)$ has derivative $f_{xy}(a+\theta h,t)$, so a second application gives $\Delta=hk\,f_{xy}(a+\theta h,b+\theta'k)$ with $\theta'\in(0,1)$. Since $f_{xy}$ is continuous at $(a,b)$: for every $\varepsilon\gt0$ there is $\delta\gt0$ with

$$\left|\frac{\Delta(h,k)}{hk}-f_{xy}(a,b)\right|\lt\varepsilon\qquad\text{whenever }0\lt|h|,|k|\lt\delta.$$

Step 2. Fix $h$ with $0\lt|h|\lt\delta$ and let $k\to0$. Because $f_y$ exists near $(a,b)$,

$$\frac{\Delta(h,k)}{k}=\frac{f(a+h,b+k)-f(a+h,b)}{k}-\frac{f(a,b+k)-f(a,b)}{k}\to f_y(a+h,b)-f_y(a,b).$$

Passing to the limit in the inequality of Step 1 gives $\left|\dfrac{f_y(a+h,b)-f_y(a,b)}{h}-f_{xy}(a,b)\right|\le\varepsilon$ for $0\lt|h|\lt\delta$. This says precisely that $f_{yx}(a,b)=\lim_{h\to0}\dfrac{f_y(a+h,b)-f_y(a,b)}{h}$ exists and equals $f_{xy}(a,b)$. The statements for $C^k$ and $n$ variables follow by applying the two-variable result to pairs of variables, the others being frozen. ∎

In Example 6, $f_{xy}$ exists near $0$ but is discontinuous at $0$, so Theorem 6.9 does not apply — and the conclusion fails. (Young's theorem gives a different sufficient condition: if $f_x$ and $f_y$ are differentiable at $(a,b)$, then $f_{xy}(a,b)=f_{yx}(a,b)$.)

📐 Theorem 6.10 — Taylor's theorem in several variables
Let $f\in C^{k+1}(U)$, $U\subseteq\mathbb{R}^n$ open, and let the segment $[a,a+h]$ lie in $U$. Write $(h\cdot\nabla)^jf(a)=\displaystyle\sum_{i_1,\dots,i_j=1}^nh_{i_1}\cdots h_{i_j}\,D_{i_1}\cdots D_{i_j}f(a)$. Then for some $c$ on the open segment between $a$ and $a+h$, $$f(a+h)=\sum_{j=0}^k\frac{1}{j!}(h\cdot\nabla)^jf(a)+\frac{1}{(k+1)!}(h\cdot\nabla)^{k+1}f(c).$$ For $k=1$, i.e. $f\in C^2$: $$f(a+h)=f(a)+\nabla f(a)\cdot h+\tfrac12h^{\mathsf T}H_f(c)h,$$ and also $$f(a+h)=f(a)+\nabla f(a)\cdot h+\tfrac12h^{\mathsf T}H_f(a)h+o(\|h\|^2).$$ In two variables, writing the increment as $(h,k)$, the quadratic term is $\tfrac12\left(f_{xx}h^2+2f_{xy}hk+f_{yy}k^2\right)$.

Proof. Let $\varphi(t)=f(a+th)$ on an open interval containing $[0,1]$. By the chain rule $\varphi'(t)=\sum_ih_iD_if(a+th)=(h\cdot\nabla)f(a+th)$; applying the same rule to each $D_if$ (a $C^k$ function) and inducting, $\varphi^{(j)}(t)=(h\cdot\nabla)^jf(a+th)$ for $j\le k+1$, and $\varphi\in C^{k+1}$. The one-variable Taylor theorem with Lagrange remainder (§3.3) gives $\varphi(1)=\sum_{j=0}^k\frac{\varphi^{(j)}(0)}{j!}+\frac{\varphi^{(k+1)}(\tau)}{(k+1)!}$ for some $\tau\in(0,1)$; put $c=a+\tau h$. For the $o(\|h\|^2)$ form with $k=1$: $\left|h^{\mathsf T}(H_f(c)-H_f(a))h\right|\le\|H_f(c)-H_f(a)\|\,\|h\|^2$, and $\|H_f(c)-H_f(a)\|\to0$ as $h\to0$ because the second partials are continuous and $\|c-a\|\le\|h\|$. ∎

✏️ Example 7 — A second-order Taylor polynomial
Find the second-order Taylor polynomial of $f(x,y)=x^y$ (for $x\gt0$) about $(1,1)$, and use it to estimate $(1.02)^{1.01}$.
Derivatives $f=e^{y\log x}$ is $C^\infty$ on $x\gt0$. $f_x=yx^{y-1}$, $f_y=x^y\log x$, $f_{xx}=y(y-1)x^{y-2}$, $f_{xy}=x^{y-1}+yx^{y-1}\log x$ (the same as $f_{yx}$, by Theorem 6.9), $f_{yy}=x^y(\log x)^2$.
At $(1,1)$ $f=1$, $f_x=1$, $f_y=0$, $f_{xx}=0$, $f_{xy}=1$, $f_{yy}=0$.
Polynomial With $h=x-1$, $k=y-1$: $T_2=1+h+\tfrac12(0\cdot h^2+2\cdot1\cdot hk+0\cdot k^2)=1+(x-1)+(x-1)(y-1)$.
Estimate $h=0.02$, $k=0.01$: $T_2=1+0.02+0.0002=1.0202$. A calculator gives $(1.02)^{1.01}=e^{1.01\log1.02}=1.020202\ldots$; the error is about $2\times10^{-6}$, of the size of the cubic terms $\|h\|^3\approx10^{-5}$.
⚠️ Counterexamples and pitfalls
  1. Lines do not decide limits. $\frac{x^2y}{x^4+y^2}\to0$ along every line through $0$ but equals $\tfrac12$ on $y=x^2$; $\frac{xy^2}{x^2+y^4}$ likewise on $x=y^2$.
  2. Equal iterated limits prove nothing. $\frac{xy}{x^2+y^2}$ has both iterated limits $0$ and no double limit. Conversely $x\sin\frac1y+y\sin\frac1x$ has double limit $0$ and no iterated limits.
  3. Partials exist $\not\Rightarrow$ continuous. $\frac{xy}{x^2+y^2}$ at $0$: $f_x=f_y=0$, yet $f$ is discontinuous.
  4. All directional derivatives exist $\not\Rightarrow$ continuous. $\frac{x^2y}{x^4+y^2}$ at $0$: $D_uf(0)=u_1^2/u_2$ for $u_2\ne0$, $0$ for $u_2=0$; discontinuous.
  5. Continuous with all $D_uf$ $\not\Rightarrow$ differentiable. $\frac{x^2y}{x^2+y^2}$: $D_uf(0)=u_1^2u_2$, not linear in $u$.
  6. Even linear $u\mapsto D_uf(a)$ is not enough. $\frac{x^3y}{x^4+y^2}$: continuous, all $D_uf(0)=0$, not differentiable (remainder ratio $\tfrac12$ on $y=x^2$).
  7. Differentiable $\not\Rightarrow C^1$. $(x^2+y^2)\sin\frac{1}{\sqrt{x^2+y^2}}$ is differentiable at $0$ with discontinuous partials.
  8. $\sqrt{|xy|}$ is continuous, has $f_x(0)=f_y(0)=0$, and is not differentiable at $0$ (on $y=x$ the ratio is $1/\sqrt2$).
  9. Mixed partials can differ. $\frac{xy(x^2-y^2)}{x^2+y^2}$ is $C^1$ with $f_{xy}(0)=-1\ne1=f_{yx}(0)$. Existence of both mixed partials is not enough; continuity of one of them at the point is.
  10. The chain rule needs differentiability. For $f=\frac{x^2y}{x^2+y^2}$ and $\gamma(t)=(t,t)$: $(f\circ\gamma)'(0)=\tfrac12$ but $\nabla f(0)\cdot\gamma'(0)=0$.
  11. No mean value equality for vector functions. $(\cos t,\sin t)$ on $[0,2\pi]$; only the inequality $\|f(b)-f(a)\|\le\sup\|Df\|\,\|b-a\|$ survives.
  12. Normalise the direction. "The directional derivative along $(2,-1,2)$" means along $u=\tfrac13(2,-1,2)$; $\nabla f\cdot v$ with $\|v\|\ne1$ is $\|v\|$ times too big.

Exercises

I
Limits and continuity in $\mathbb{R}^n$. In parts 1–5 decide whether the limit as $(x,y)\to(0,0)$ exists, and find it if it does.
  • 1 $\dfrac{x^2-y^2}{x^2+y^2}$.
  • 2 $\dfrac{xy^2}{x^2+y^4}$.
  • 3 $\dfrac{\sin(x^2+y^2)}{x^2+y^2}$.
  • 4 $\dfrac{xy}{\sqrt{x^2+y^2}}$.
  • 5 $\dfrac{x^3+y^3}{x^2+y^2}$.
  • 6 Let $f(x,y)=\dfrac{x^2y^2}{x^2y^2+(x-y)^2}$ for $(x,y)\ne(0,0)$. Show that both iterated limits at $(0,0)$ exist and are equal, but the double limit does not exist.
  • 7 Let $f(x,y)=x\sin\dfrac1y$ for $y\ne0$ and $f(x,0)=0$. Show that $\lim_{(x,y)\to(0,0)}f=0$ and $\lim_{y\to0}\lim_{x\to0}f=0$, but $\lim_{x\to0}\lim_{y\to0}f$ does not exist.
  • 8 For $\alpha\gt0$ let $f(x,y)=\dfrac{|x|^\alpha\,|y|}{x^2+y^2}$ for $(x,y)\ne(0,0)$ and $f(0,0)=0$. Find all $\alpha$ for which $f$ is continuous at the origin.
1 Along $y=mx$ the value is $\frac{1-m^2}{1+m^2}$: $1$ for $m=0$, $0$ for $m=1$. No limit.
2 Along $y=mx$: $\frac{m^2x^3}{x^2+m^4x^4}=\frac{m^2x}{1+m^4x^2}\to0$; along $x=y^2$: $\frac{y^4}{2y^4}=\frac12$. No limit.
3 With $s=x^2+y^2\to0^+$ the expression is $\frac{\sin s}{s}\to1$, a function of $\|(x,y)\|$ only. Limit $1$.
4 $|xy|\le\tfrac12(x^2+y^2)$, so $\left|\frac{xy}{\sqrt{x^2+y^2}}\right|\le\tfrac12\sqrt{x^2+y^2}\to0$. Limit $0$.
5 $|x^3+y^3|\le|x|^3+|y|^3\le r(x^2+y^2)$ with $r=\|(x,y)\|$, since $|x|,|y|\le r$. So the quotient is at most $r$ in absolute value. Limit $0$.
6 For fixed $y\ne0$, as $x\to0$ the numerator $\to0$ and the denominator $\to y^2\ne0$: inner limit $0$; so $\lim_y\lim_xf=0$, and by symmetry $\lim_x\lim_yf=0$. Along $y=x$, $x\ne0$: $f=\frac{x^4}{x^4+0}=1$, while along $y=0$, $f=0$. No double limit. (Theorem 6.3 is not contradicted: it assumes that the double limit exists.)
7 $|f|\le|x|$, so the double limit is $0$. For fixed $y\ne0$, $x\sin\frac1y\to0$ as $x\to0$, so $\lim_y\lim_x f=0$. For fixed $x\ne0$, $x\sin\frac1y$ has no limit as $y\to0$, so the other iterated limit does not exist. (Theorem 6.3 is not contradicted: its hypothesis concerns the inner limits that do exist.)
8 $f(r\cos\theta,r\sin\theta)=r^{\alpha-1}|\cos\theta|^\alpha|\sin\theta|$. If $\alpha\gt1$, $|f|\le r^{\alpha-1}\to0$: continuous. If $\alpha=1$, $f=|\cos\theta\sin\theta|$ on each ray: $\tfrac12$ on $y=x$, $0$ on the axes — discontinuous. If $\alpha\lt1$, on $y=x$ the value $r^{\alpha-1}2^{-(\alpha+1)/2}\to\infty$. Answer: $\alpha\gt1$.
II
Partial, directional and total derivatives.
  • 1 For $f(x,y,z)=xe^{yz}+y^2$ and $P=(1,0,2)$, find $\nabla f(P)$, the directional derivative at $P$ in the direction of $(1,2,-2)$, and the maximal directional derivative at $P$.
  • 2 Find the Jacobian matrix of $F(x,y,z)=\left(xy^2,\ x+\sin(yz)\right)$ at $(1,1,0)$, and use it to approximate $F(1.01,\,0.98,\,0.02)$.
  • 3 Show that $f(x,y)=\sqrt{|xy|}$ is continuous at $(0,0)$ with $f_x(0,0)=f_y(0,0)=0$, but not differentiable there. In which directions $u$ does $D_uf(0,0)$ exist?
  • 4 For which $\alpha\gt0$ is $f(x,y)=|xy|^\alpha$ differentiable at $(0,0)$?
  • 5 Let $f(x,y)=\sqrt[3]{x^3+y^3}$. Compute $D_uf(0,0)$ for every unit vector $u$ and decide whether $f$ is differentiable at $(0,0)$.
  • 6 Prove: if $f:\mathbb{R}^n\to\mathbb{R}$ satisfies $|f(x)|\le\|x\|^2$ for all $x$, then $f$ is differentiable at $0$ and $Df(0)=0$. Must $f$ be continuous at any point other than $0$?
  • 7 Let $f$ be differentiable at $a$ with $\nabla f(a)\ne0$, and let $f:\mathbb{R}^2\to\mathbb{R}$. Show that there are exactly two unit vectors $u$ with $D_uf(a)=0$, and that if $D_uf(a)=3$ and $D_vf(a)=4$ for orthonormal $u,v$, then $\|\nabla f(a)\|=5$.
  • 8 Show that every linear map $L$ is differentiable with $DL(a)=L$ for all $a$, and that $B(x,y)=x\cdot y$ on $\mathbb{R}^n\times\mathbb{R}^n$ is differentiable with $DB(a,b)(h,k)=a\cdot k+h\cdot b$.
1 $\nabla f=(e^{yz},\ xze^{yz}+2y,\ xye^{yz})$, so $\nabla f(P)=(1,2,0)$. With $u=\frac13(1,2,-2)$: $D_uf(P)=\frac13(1+4+0)=\frac53$. Maximal directional derivative $\|\nabla f(P)\|=\sqrt5$.
2 $J_F=\begin{pmatrix}y^2&2xy&0\\1&z\cos(yz)&y\cos(yz)\end{pmatrix}$, so $J_F(1,1,0)=\begin{pmatrix}1&2&0\\1&0&1\end{pmatrix}$. With $h=(0.01,-0.02,0.02)$: $F(1,1,0)+J_Fh=(1,1)+(0.01-0.04,\ 0.01+0.02)=(0.97,\ 1.03)$. (Exact values: $1.01\cdot0.98^2=0.970004$ and $1.01+\sin0.0196=1.029599\ldots$.)
3 $|f|\le\sqrt{\tfrac12(x^2+y^2)}\to0$: continuous. $f(h,0)=0=f(0,k)$, so both partials are $0$. If $f$ were differentiable, $Df(0)=0$ and $f(h)/\|h\|\to0$; but on $y=x$, $f(t,t)/\|(t,t)\|=|t|/(\sqrt2|t|)=1/\sqrt2$. For a unit $u$, $f(tu)/t=\frac{|t|}{t}\sqrt{|u_1u_2|}$, whose limit exists iff $u_1u_2=0$: only the four axis directions.
4 The partials at $0$ are $0$ (the function vanishes on the axes), so differentiability means $|xy|^\alpha/r\to0$. In polar form this is $r^{2\alpha-1}|\cos\theta\sin\theta|^\alpha$, which tends to $0$ uniformly iff $2\alpha-1\gt0$. For $\alpha\le\tfrac12$ it does not tend to $0$ on $y=x$. Answer: $\alpha\gt\tfrac12$.
5 $f(tu)=t\sqrt[3]{u_1^3+u_2^3}$, so $D_uf(0)=\sqrt[3]{u_1^3+u_2^3}$ for every $u$, and $f_x(0)=f_y(0)=1$. Differentiability would force $D_uf(0)=u_1+u_2$; for $u=\frac1{\sqrt2}(1,1)$ we get $2^{-1/6}\approx0.891\ne\sqrt2$. Not differentiable (though continuous and with all directional derivatives).
6 $f(0)=0$ and $\frac{|f(h)-0-0|}{\|h\|}\le\|h\|\to0$. No: $f(x)=\|x\|^2\,\mathbf 1_{\mathbb{Q}^n}(x)$ satisfies the bound and is discontinuous at every $x\ne0$. Differentiability at a single point says nothing about nearby points.
7 $D_uf(a)=\nabla f(a)\cdot u=0$ iff $u\perp\nabla f(a)$; in $\mathbb{R}^2$ the unit vectors perpendicular to a nonzero vector are $\pm$ one vector. For orthonormal $u,v$, $\nabla f(a)=(\nabla f\cdot u)u+(\nabla f\cdot v)v=3u+4v$, of length $\sqrt{9+16}=5$.
8 $L(a+h)-L(a)-Lh=0$, so the quotient is identically $0$. $B(a+h,b+k)-B(a,b)-(a\cdot k+h\cdot b)=h\cdot k$, and $|h\cdot k|\le\|h\|\,\|k\|\le\|(h,k)\|^2$, so dividing by $\|(h,k)\|$ gives something $\le\|(h,k)\|\to0$; the map $(h,k)\mapsto a\cdot k+h\cdot b$ is linear.
III
Chain rule, Euler's theorem and mean value theorem.
  • 1 Let $f$ be differentiable and $u=f(x-y,\ y-z,\ z-x)$. Show that $u_x+u_y+u_z=0$.
  • 2 Let $w=x^2+yz$ with $x=t^2$, $y=\cos t$, $z=\sin t$. Find $\dfrac{dw}{dt}$ at $t=\dfrac\pi2$ by the chain rule, and check by substituting first.
  • 3 Let $u=\log\dfrac{x^4+y^4}{x+y}$ on $\{x+y\gt0\}$. Find $xu_x+yu_y$.
  • 4 For $f(x,y)=x^2y+3y$, find the point $c$ on the segment from $(0,0)$ to $(1,1)$ given by the mean value theorem.
  • 5 Let $f:\mathbb{R}^2\to\mathbb{R}$ be differentiable with $\|\nabla f(x)\|\le2$ everywhere and $f(0,0)=1$. Give the best possible upper bound for $f(3,4)$, and a function attaining it.
  • 6 Let $g:\mathbb{R}\to\mathbb{R}$ be differentiable and $f(x,y)=g(x^2+y^2)$. Show that $yf_x-xf_y=0$, and interpret this geometrically. Conversely, show that a differentiable $f$ on $\mathbb{R}^2\setminus\{0\}$ with $yf_x-xf_y\equiv0$ is constant on every circle centred at $0$.
  • 7 Find an open connected set $U\subseteq\mathbb{R}^2$ and a $C^1$ function $f$ on $U$ with $f_x\equiv0$ on $U$, but $f(x_1,y)\ne f(x_2,y)$ for some points $(x_1,y),(x_2,y)\in U$.
1 Write $p=x-y$, $q=y-z$, $s=z-x$. Chain rule: $u_x=f_p-f_s$, $u_y=-f_p+f_q$, $u_z=-f_q+f_s$. Adding gives $0$. (Geometrically, $u$ is constant along the direction $(1,1,1)$, since $(x,y,z)+t(1,1,1)$ gives the same $p,q,s$.)
2 $\frac{dw}{dt}=2x\cdot2t+z\cdot(-\sin t)+y\cos t=4t^3-\sin^2t+\cos^2t$. At $t=\frac\pi2$: $4\cdot\frac{\pi^3}{8}-1=\frac{\pi^3}{2}-1\approx14.50$. Check: $w=t^4+\tfrac12\sin2t$, $w'=4t^3+\cos2t$, which at $\frac\pi2$ is $\frac{\pi^3}2-1$. ✓
3 $e^u=\frac{x^4+y^4}{x+y}$ is homogeneous of degree $3$, so by Euler $x(e^u)_x+y(e^u)_y=3e^u$, i.e. $e^u(xu_x+yu_y)=3e^u$. Answer: $3$.
4 $f(1,1)-f(0,0)=4$, and $\nabla f(t,t)\cdot(1,1)=2t^2+(t^2+3)=3t^2+3$. Setting $3t^2+3=4$ gives $t=1/\sqrt3$: $c=\left(\tfrac1{\sqrt3},\tfrac1{\sqrt3}\right)$, which indeed lies inside the segment.
5 Theorem 6.8(2): $|f(3,4)-f(0,0)|\le2\cdot\|(3,4)\|=10$, so $f(3,4)\le11$. Attained by $f(x,y)=1+\tfrac25(3x+4y)$, whose gradient $(\tfrac65,\tfrac85)$ has length $2$.
6 $f_x=2xg'(x^2+y^2)$, $f_y=2yg'(x^2+y^2)$, so $yf_x-xf_y=0$: the derivative of $f$ along the rotation field $(y,-x)$, tangent to circles, vanishes. Conversely, put $\varphi(\theta)=f(r\cos\theta,r\sin\theta)$ for fixed $r\gt0$. Then $\varphi'(\theta)=-r\sin\theta\,f_x+r\cos\theta\,f_y=-(yf_x-xf_y)=0$, so $\varphi$ is constant.
7 Let $U=\mathbb{R}^2\setminus\{(0,y):y\ge0\}$ (the plane minus a vertical ray; it is open and connected — go around below the ray). Let $f(x,y)=y^2$ if $x\gt0$ and $y\gt0$, and $f=0$ elsewhere on $U$. Near the half-line $\{y=0,x\gt0\}$, $f$ is $y^2$ above and $0$ below, which fit together in a $C^1$ way; and no point of $U$ with $x=0$ has $y\gt0$. So $f\in C^1(U)$ and $f_x\equiv0$, but $f(1,1)=1\ne0=f(-1,1)$. The horizontal segment from $(-1,1)$ to $(1,1)$ is not in $U$.
IV
Higher derivatives, Schwarz's theorem and Taylor's formula.
  • 1 Verify $f_{xy}=f_{yx}$ for $f(x,y)=x^2y^3+e^{xy}$.
  • 2 Let $f(x,y)=\dfrac{xy(x^2-2y^2)}{x^2+y^2}$, $f(0,0)=0$. Compute $f_{xy}(0,0)$ and $f_{yx}(0,0)$.
  • 3 Find the second-order Taylor polynomial of $f(x,y)=\log(1+x+2y)$ about $(0,0)$, and use it to approximate $\log1.07$ with $(x,y)=(0.03,0.02)$.
  • 4 Find the second-order Taylor polynomial of $f(x,y)=\sin x\sin y$ about $\left(\frac\pi4,\frac\pi4\right)$.
  • 5 Show that $\log(x^2+y^2)$ is harmonic ($u_{xx}+u_{yy}=0$) on $\mathbb{R}^2\setminus\{0\}$, and find all real $n$ for which $\|x\|^n$ is harmonic on $\mathbb{R}^3\setminus\{0\}$.
  • 6 Prove that if $f\in C^2(\mathbb{R}^2)$ and $f_{xy}\equiv0$, then $f(x,y)=g(x)+h(y)$ for some $C^2$ functions $g,h$.
  • 7 Let $f\in C^2(\mathbb{R}^2\setminus\{0\})$ be homogeneous of degree $k$. Show that $x^2f_{xx}+2xyf_{xy}+y^2f_{yy}=k(k-1)f$, and check it for $f=x^3-5xy^2$.
1 $f_x=2xy^3+ye^{xy}$, $f_{xy}=6xy^2+e^{xy}+xye^{xy}$; $f_y=3x^2y^2+xe^{xy}$, $f_{yx}=6xy^2+e^{xy}+xye^{xy}$. Equal, as Theorem 6.9 guarantees for this $C^\infty$ function.
2 $\frac{f(h,y)-f(0,y)}{h}=\frac{y(h^2-2y^2)}{h^2+y^2}\to-2y$, so $f_x(0,y)=-2y$ and $f_{xy}(0,0)=-2$. $\frac{f(x,k)-f(x,0)}{k}=\frac{x(x^2-2k^2)}{x^2+k^2}\to x$, so $f_y(x,0)=x$ and $f_{yx}(0,0)=1$.
3 $f_x=\frac1{1+x+2y}$, $f_y=\frac2{1+x+2y}$, $f_{xx}=-\frac1{(\cdot)^2}$, $f_{xy}=-\frac2{(\cdot)^2}$, $f_{yy}=-\frac4{(\cdot)^2}$. At $0$: $T_2=x+2y-\tfrac12(x^2+4xy+4y^2)=(x+2y)-\tfrac12(x+2y)^2$. At $(0.03,0.02)$: $0.07-0.00245=0.06755$; true value $\log1.07=0.067659\ldots$.
4 At $(\frac\pi4,\frac\pi4)$: $f=\tfrac12$, $f_x=f_y=\cos\frac\pi4\sin\frac\pi4=\tfrac12$, $f_{xx}=f_{yy}=-\tfrac12$, $f_{xy}=\cos^2\frac\pi4=\tfrac12$. With $h=x-\frac\pi4$, $k=y-\frac\pi4$: $T_2=\tfrac12+\tfrac12(h+k)+\tfrac12\left(-\tfrac12h^2+hk-\tfrac12k^2\right)=\tfrac12+\tfrac12(h+k)-\tfrac14(h-k)^2$.
5 $u_x=\frac{2x}{x^2+y^2}$, $u_{xx}=\frac{2(y^2-x^2)}{(x^2+y^2)^2}$, and by symmetry $u_{yy}=\frac{2(x^2-y^2)}{(x^2+y^2)^2}$: the sum is $0$. In $\mathbb{R}^3$ with $r=\|x\|$: $\partial_ir^n=nr^{n-2}x_i$ and $\partial_i^2r^n=nr^{n-2}+n(n-2)r^{n-4}x_i^2$; summing over $i=1,2,3$ gives $\Delta r^n=\left(3n+n(n-2)\right)r^{n-2}=n(n+1)r^{n-2}$. Harmonic iff $n=0$ or $n=-1$.
6 $(f_x)_y\equiv0$ on $\mathbb{R}^2$, and every vertical line is connected, so $f_x(x,y)=f_x(x,0)=:\varphi(x)$, a continuous function. Let $g(x)=\int_0^x\varphi$, so $g'=\varphi$, and put $h(x,y)=f(x,y)-g(x)$. Then $h_x\equiv0$, so (horizontal lines being connected) $h(x,y)=h(0,y)$; thus $f(x,y)=g(x)+h(0,y)$. $g=f(\cdot,0)-f(0,0)$ and $h(0,\cdot)=f(0,\cdot)$ are $C^2$.
7 This is the second identity of Theorem 6.7 with $n=2$, using $f_{xy}=f_{yx}$. Check: $f=x^3-5xy^2$ has $k=3$, $f_{xx}=6x$, $f_{xy}=-10y$, $f_{yy}=-10x$, and $x^2\cdot6x+2xy(-10y)+y^2(-10x)=6x^3-30xy^2=6f=3\cdot2\,f$. ✓
🎯 Exam corner CSIR Part BCSIR Part CGATE MA

E1. CSIR Part B Let $f(x,y)=\dfrac{xy^2}{x^2+y^4}$ for $(x,y)\ne(0,0)$ and $f(0,0)=0$. Which of the following is true? (A) $f$ is continuous at $(0,0)$; (B) $D_uf(0,0)$ exists for every unit vector $u$; (C) $f$ is differentiable at $(0,0)$; (D) $f$ is unbounded on every neighbourhood of $(0,0)$.

Idea Lines see directional derivatives; the parabola $x=y^2$ sees discontinuity.
Options (B) True: for $u_1\ne0$, $f(tu)/t=\frac{u_1u_2^2}{u_1^2+t^2u_2^4}\to\frac{u_2^2}{u_1}$; for $u_1=0$, $f(tu)=0$. (A) False: on $x=y^2$, $f=\tfrac12$. (C) False, since (A) fails. (D) False: $x^2+y^4\ge2|x|y^2$ gives $|f|\le\tfrac12$.
Answer (B).

E2. CSIR Part B GATE MA For $f(x,y,z)=x^2y+yz^3$, the maximum of the directional derivative $D_uf(1,1,1)$ over all unit vectors $u$ is (A) $7$; (B) $\sqrt{17}$; (C) $17$; (D) $\sqrt7$.

Idea $f$ is a polynomial, hence differentiable; $\max_uD_uf=\|\nabla f\|$ (Theorem 6.4(4)).
Compute $\nabla f=(2xy,\ x^2+z^3,\ 3yz^2)=(2,2,3)$ at $(1,1,1)$; $\|\nabla f\|=\sqrt{4+4+9}=\sqrt{17}$. (A) $7$ is the sum of the components, the derivative along the non-unit vector $(1,1,1)$.
Answer (B).

E3. CSIR Part B Let $f\in C^2(\mathbb{R}^2\setminus\{0\})$ be homogeneous of degree $3$ with $f(1,2)=5$. Then $\left(x^2f_{xx}+2xyf_{xy}+y^2f_{yy}\right)(1,2)$ equals (A) $15$; (B) $30$; (C) $45$; (D) it cannot be determined from the data.

Idea Second-order Euler identity (Theorem 6.7): the expression equals $k(k-1)f$.
Compute $3\cdot2\cdot5=30$. (A) is $kf$, the first-order identity; (D) is the trap — the data do determine it.
Answer (B).

E4. CSIR Part C Let $f(x,y)=\dfrac{x^2y^2}{x^2+y^2}$ for $(x,y)\ne(0,0)$ and $f(0,0)=0$. Which of the following are true? (One or more options may be correct.) (A) $f$ is differentiable at $(0,0)$. (B) $f_x$ is continuous at $(0,0)$. (C) $f_{xy}(0,0)=f_{yx}(0,0)$. (D) $f$ is of class $C^2$ on $\mathbb{R}^2$.

(A) True $0\le f\le\tfrac14(x^2+y^2)$, so $f(h)/\|h\|\to0$ and $Df(0)=0$.
(B) True For $(x,y)\ne0$, $f_x=\dfrac{2xy^4}{(x^2+y^2)^2}$, and $|f_x|\le\dfrac{2r\cdot r^4}{r^4}=2r\to0=f_x(0,0)$.
(C) True $f_x(0,y)=0$ for all $y$ (the formula, or directly from $f(h,y)/h$), so $f_{xy}(0,0)=0$; by the symmetry $f(x,y)=f(y,x)$, $f_{yx}(0,0)=0$ as well.
(D) False Away from $0$, $f_{xy}=\dfrac{8x^3y^3}{(x^2+y^2)^3}$, which equals $1$ on the line $y=x$ but $0=f_{xy}(0,0)$ at the origin: discontinuous. Equal mixed partials do not require $C^2$.
Answer (A), (B) and (C).

E5. CSIR Part C Let $f:\mathbb{R}^2\to\mathbb{R}$. Which of the following statements are true? (A) If $f_x$ and $f_y$ exist at every point of $\mathbb{R}^2$, then $f$ is continuous. (B) If $f$ is differentiable at $a$, then $u\mapsto D_uf(a)$ is a linear function of $u$. (C) If $D_uf(a)$ exists for every $u$ and $u\mapsto D_uf(a)$ is linear, then $f$ is differentiable at $a$. (D) If $f_x$ and $f_y$ exist everywhere and are bounded on $\mathbb{R}^2$, then $f$ is continuous on $\mathbb{R}^2$.

(A) False $\frac{xy}{x^2+y^2}$ (with $0$ at the origin) has partials everywhere — at the origin they are $0$ — and is discontinuous at $0$.
(B) True $D_uf(a)=Df(a)u$ (Theorem 6.4(2)).
(C) False $\frac{x^3y}{x^4+y^2}$: all $D_uf(0)=0$, not differentiable (Example 4(c)).
(D) True If $|f_x|,|f_y|\le M$, then for any two points the one-variable mean value theorem on a horizontal and then a vertical segment gives $|f(x,y)-f(x',y')|\le|f(x,y)-f(x',y)|+|f(x',y)-f(x',y')|\le M|x-x'|+M|y-y'|$. So $f$ is Lipschitz, hence continuous. (In (A) the partials of $\frac{xy}{x^2+y^2}$ are unbounded near $0$.)
Answer (B) and (D).

E6. CSIR Part C GATE MA Let $f\in C^2(\mathbb{R}^2)$, written $f(u,v)$, and $g(x,y)=f(x^2-y^2,\ 2xy)$. Which of the following are true? (A) $g_x=2xf_u+2yf_v$. (B) $g_{xx}+g_{yy}=4(x^2+y^2)(f_{uu}+f_{vv})$. (C) If $f(u,v)=u$, then $g$ is harmonic. (D) The Jacobian determinant of $(x,y)\mapsto(x^2-y^2,2xy)$ is $4xy$.

(A) True Chain rule with $u_x=2x$, $v_x=2y$.
(B) True Differentiating again, $g_{xx}=4x^2f_{uu}+8xyf_{uv}+4y^2f_{vv}+2f_u$ and, from $g_y=-2yf_u+2xf_v$, $g_{yy}=4y^2f_{uu}-8xyf_{uv}+4x^2f_{vv}-2f_u$. Adding (and using $f_{uv}=f_{vu}$, Theorem 6.9) gives $4(x^2+y^2)(f_{uu}+f_{vv})$.
(C) True $g=x^2-y^2$ and $g_{xx}+g_{yy}=2-2=0$ — consistent with (B), since $f=u$ is harmonic.
(D) False $\det\begin{pmatrix}2x&-2y\\2y&2x\end{pmatrix}=4(x^2+y^2)$.
Answer (A), (B) and (C).
🧑‍🏫 For the teacher

Suggested plan — 3 lectures × 60 min.

  1. Limits in $\mathbb{R}^n$. Definition 6.1 and Theorems 6.1–6.2. Project Interactive 1 with $\frac{x^2y}{x^4+y^2}$ on lines first; let the class vote "limit $0$?" before switching to a parabola. Example 1 on the board, then Theorem 6.3 and Example 2. Close with partial derivatives of $\frac{xy}{x^2+y^2}$ at $0$: "derivatives without continuity".
  2. The total derivative. Definition 6.3, Theorem 6.4 with full proof, Example 3. Interactive 2: run the four functions in order; ask students to predict the solid curve before pressing Play. Example 4 and the strategy box; Theorem 6.5 with the box-path proof drawn on the board.
  3. Calculus with derivatives. Chain rule (Theorem 6.6) — stress the $\varepsilon_2(0)=0$ trick; Example 5; Euler's theorem; the mean value theorem and why equality fails for curves. Example 6 (unequal mixed partials) worked carefully; Schwarz's theorem; Taylor's formula and Example 7. Finish with Exam-corner E4 done live.

Discussion questions. (1) Why is "differentiable" defined by one linear map for all directions, rather than by derivatives along lines? What would go wrong with the chain rule otherwise? (2) $f_3=\frac{x^3y}{x^4+y^2}$ has every directional derivative $0$. In what sense is it "flat" at the origin, and in what sense not? (3) Example 6 is $\tfrac14r^2\sin4\theta$ in polar form. Which feature of $\sin4\theta$ makes the mixed partials differ, and what happens for $r^2\sin2\theta$?

Misconceptions to watch for. Proving a limit by checking lines (or lines and parabolas); concluding the double limit from equal iterated limits; differentiating a formula valid only for $(x,y)\ne0$ and "plugging in $0$"; believing that existence of all partials (or all directional derivatives) gives differentiability or continuity; forgetting to normalise the direction vector; treating $f_{xy}=f_{yx}$ as automatic.

Suggested homework. I(2, 4, 6, 8), II(1, 3, 4, 5, 7), III(1, 3, 5, 7), IV(2, 3, 5, 6); Exam corner E1, E4, E5.

🔬 Research–Teaching NexusResearch-tutored · optional, about 60 minutes

Research question. How do machine-learning libraries compute exact gradients of programs with millions of inputs — and why do they not simply use the definition of the derivative with a small step $h$?

Why it matters. Training a neural network, fitting a climate model to satellite observations (the "4D-Var" data assimilation used by weather centres in Europe and Asia), and optimising the shape of an aircraft wing all need gradients of functions of very many variables. The technique behind them, automatic differentiation, is nothing but the chain rule (Theorem 6.6) applied mechanically to the elementary operations of a program.

What to do.

  1. Take $f(x,y)=e^{xy}\sin(x+y^2)$ and compute $\nabla f(1,\tfrac12)$ exactly with a computer algebra system.
  2. Approximate $f_x(1,\tfrac12)$ by the forward difference $\frac{f(1+h,\frac12)-f(1,\frac12)}{h}$ and the central difference $\frac{f(1+h,\frac12)-f(1-h,\frac12)}{2h}$ for $h=10^{-1},10^{-2},\dots,10^{-14}$. Plot the errors on a log–log scale and explain the V-shape: Taylor's theorem gives a truncation error proportional to $h$ (or $h^2$), while rounding contributes about $10^{-16}/h$.
  3. Implement dual numbers $a+b\varepsilon$ with $\varepsilon^2=0$: define $+$, $\times$, $\exp$ and $\sin$ (e.g. $\sin(a+b\varepsilon)=\sin a+b\cos a\,\varepsilon$). Show that evaluating $f$ at $(1+\varepsilon,\tfrac12)$ returns $f(1,\tfrac12)+f_x(1,\tfrac12)\,\varepsilon$ exactly, and explain why this is the chain rule.
  4. Forward mode needs one pass per input variable. Read about reverse mode (backpropagation): it computes the whole gradient of $f:\mathbb{R}^n\to\mathbb{R}$ in a few passes, by multiplying the Jacobians of the chain rule in the opposite order. Why is the order of a matrix product so important when the first factor is a single row?

Tools: Python with sympy (step 1) and plain floating point (steps 2–3); any plotting tool.

Hand in: The error plot with the two optimal step sizes marked, your dual-number code with its output, and a paragraph comparing the costs of forward and reverse mode for $n=10^6$ inputs.

Going further. For $F:\mathbb{R}^n\to\mathbb{R}^m$ built from $L$ layers, $J_F=J_L\cdots J_2J_1$. Find the cheapest way to multiply out such a product when the matrices have very different shapes (the "matrix chain" problem), and relate it to the forward/reverse choice.

Instructor note: $\nabla f(1,\tfrac12)\approx(1.302184,\ 2.084490)$. With double precision the forward difference is best near $h\approx10^{-8}$ (error of order $10^{-9}$–$10^{-8}$) and the central difference near $h\approx10^{-5}$–$10^{-6}$ (error of order $10^{-11}$–$10^{-12}$); for $h=10^{-12}$ both errors are back above $10^{-4}$. Dual numbers reproduce $f_x$ to machine precision for every input.

🧪 Self-check quiz

0/5 correct

Q1. Let $f(x,y)=\dfrac{xy}{x^2+y^2}$ for $(x,y)\ne(0,0)$ and $f(0,0)=0$. At the origin,

Q2. If $f:\mathbb{R}^n\to\mathbb{R}$ is differentiable at $a$ and $u$ is a unit vector, then $D_uf(a)$ equals

Q3. Which condition guarantees that $f:\mathbb{R}^2\to\mathbb{R}$ is differentiable at $a$?

Q4. For $f(x,y)=\dfrac{xy(x^2-y^2)}{x^2+y^2}$, $f(0,0)=0$, the values $\left(f_{xy}(0,0),f_{yx}(0,0)\right)$ are

Q5. If $f$ is differentiable and homogeneous of degree $4$ on $\mathbb{R}^2\setminus\{0\}$ with $f(1,1)=2$, then $f_x(1,1)+f_y(1,1)$ equals