Unit 3, lesson 16

Total Derivative, Tangent Planes, and Differentials

What it means for a function of several variables to be differentiable, how the Jacobian matrix, tangent plane and differential express it, and why partial derivatives alone do not guarantee it.

  • Theory part 31
  • Practice part 32
  • Derivatives and Approximation

Zoom in far enough on a smooth hill and the ground under your feet looks flat. That flat piece is the tangent plane, and the whole idea of a derivative in several variables is that the function looks like a linear map plus an error that shrinks faster than the step you take. Partial derivatives only test the function along the two axis directions, so they cannot by themselves tell you whether such a plane exists.

Key terms

Differentiability

Definition Let U⊆RnU \subseteq \mathbb{R}^n be open, let f ⁣:U→Rmf \colon U \to \mathbb{R}^m, and let a\mathbf{a} be a point of UU. The function ff is differentiable at a\mathbf{a} if there is a linear map L ⁣:Rn→RmL \colon \mathbb{R}^n \to \mathbb{R}^m such that

lim⁡h→0∥R(h)∥∥h∥=0,whereR(h)=f(a+h)−f(a)−L(h).\begin{gathered} \lim_{\mathbf{h} \to \mathbf{0}} \frac{\lVert R(\mathbf{h}) \rVert}{\lVert \mathbf{h} \rVert} = 0, \quad \text{where} \\[0.4em] R(\mathbf{h}) = f(\mathbf{a} + \mathbf{h}) - f(\mathbf{a}) - L(\mathbf{h}). \end{gathered}

Equivalently, the remainder R(h)R(\mathbf{h}) is o(∥h∥)o(\lVert \mathbf{h} \rVert). Such an LL is unique when it exists. It is called the total derivative of ff at a\mathbf{a} and written Df(a)Df(\mathbf{a}). The limit is a genuine multivariable limit, so h\mathbf{h} may approach 0\mathbf{0} from every direction and along every path. A function differentiable at a\mathbf{a} is continuous at a\mathbf{a}.

In plain words The change in ff is a linear part plus an error, and the error becomes small even compared with the size of the step. Being small is not enough, since every continuous function has an error that goes to zero. It has to vanish faster than ∥h∥\lVert \mathbf{h} \rVert.

Example Take f(x,y)=xyf(x, y) = xy at (1,2)(1, 2) with step (h,k)(h, k). Expanding gives the exact change

f(1+h,2+k)−f(1,2)=2h+k+hk.\begin{aligned} f(1 + h, 2 + k) &- f(1, 2) \\[0.4em] &= 2h + k + hk. \end{aligned}

The candidate linear map is L(h,k)=2h+kL(h, k) = 2h + k and the exact remainder is R=hkR = hk. Since ∣hk∣≤12(h2+k2)\lvert hk \rvert \le \frac{1}{2}(h^2 + k^2),

∣hk∣h2+k2≤12h2+k2→0,\frac{\lvert hk \rvert}{\sqrt{h^2 + k^2}} \le \frac{1}{2}\sqrt{h^2 + k^2} \to 0,

so ff is differentiable at (1,2)(1, 2) with Df(1,2)(h,k)=2h+kDf(1, 2)(h, k) = 2h + k.

Jacobian matrix

Definition Write f=(f1,…,fm)f = (f_1, \dots, f_m). If ff is differentiable at a\mathbf{a}, then every partial derivative ∂fi∂xj(a)\frac{\partial f_i}{\partial x_j}(\mathbf{a}) exists, and Df(a)Df(\mathbf{a}) is multiplication by the m×nm \times n Jacobian matrix

Jf(a)=[∂fi∂xj(a)],Jf(\mathbf{a}) = \left[ \frac{\partial f_i}{\partial x_j}(\mathbf{a}) \right],

whose row ii holds the partial derivatives of the component fif_i and whose column jj holds the partial derivatives with respect to xjx_j. The matrix can be written down whenever the partial derivatives exist, but it represents a derivative of ff only when ff is differentiable at a\mathbf{a}. For a real valued ff (the case m=1m = 1) the Jacobian is the single row [fx1(a) ⋯ fxn(a)]\left[ f_{x_1}(\mathbf{a}) \ \cdots \ f_{x_n}(\mathbf{a}) \right].

In plain words Once you know ff is differentiable, the linear map is found by computing partial derivatives and stacking them in a matrix. Each row describes one output, each column one input.

Example For f(x,y)=⟨x2y, x−y3⟩f(x, y) = \langle x^2 y, \ x - y^3 \rangle, a polynomial map and so differentiable everywhere (see the last key term), the Jacobian at (1,2)(1, 2) is

Jf(1,2)=[2xyx21−3y2](1,2)=[411−12].\begin{aligned} Jf(1, 2) &= \begin{bmatrix} 2xy & x^2 \\ 1 & -3y^2 \end{bmatrix}_{(1,2)} \\[0.4em] &= \begin{bmatrix} 4 & 1 \\ 1 & -12 \end{bmatrix}. \end{aligned}

For the step h=⟨0.01,−0.02⟩\mathbf{h} = \langle 0.01, -0.02 \rangle the linear prediction is Jf(1,2)h=⟨0.02,0.25⟩Jf(1, 2)\mathbf{h} = \langle 0.02, 0.25 \rangle. The exact change is f(1.01,1.98)−f(1,2)=⟨0.019798,0.247608⟩f(1.01, 1.98) - f(1, 2) = \langle 0.019798, 0.247608 \rangle, off by less than 0.0030.003 in each component.

Linearization

Definition If ff is differentiable at a\mathbf{a}, its linearization at a\mathbf{a} is the affine map (a constant plus the linear map Df(a)Df(\mathbf{a}))

L(x)=f(a)+Jf(a)(x−a).L(\mathbf{x}) = f(\mathbf{a}) + Jf(\mathbf{a})(\mathbf{x} - \mathbf{a}).

For a real valued function of two variables this reads

L(x,y)=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b).\begin{aligned} L(x, y) = f(a, b) &+ f_x(a, b)(x - a) \\[0.4em] &+ f_y(a, b)(y - b). \end{aligned}

The approximation f(x)≈L(x)f(\mathbf{x}) \approx L(\mathbf{x}) has error f(x)−L(x)=R(x−a)f(\mathbf{x}) - L(\mathbf{x}) = R(\mathbf{x} - \mathbf{a}), which is o(∥x−a∥)o(\lVert \mathbf{x} - \mathbf{a} \rVert).

In plain words Replace the function near a\mathbf{a} by the value at a\mathbf{a} plus the linear change. Close to a\mathbf{a} the error is tiny compared with the distance from a\mathbf{a}.

Example The distance from the origin f(x,y)=x2+y2f(x, y) = \sqrt{x^2 + y^2} has continuous partial derivatives away from the origin, so it is differentiable at (3,4)(3, 4). There we get f=5f = 5, fx=35f_x = \frac{3}{5} and fy=45f_y = \frac{4}{5}, so

L(x,y)=5+0.6(x−3)+0.8(y−4).\begin{aligned} L(x, y) = 5 &+ 0.6(x - 3) \\[0.4em] &+ 0.8(y - 4). \end{aligned}
PointffLLError f−Lf - L
(3.1,3.9)(3.1, 3.9)4.98196754.98196754.984.980.00196750.0019675
(3.01,3.99)(3.01, 3.99)4.99801964.99801964.9984.9980.00001960.0000196

The values are rounded to seven decimal places. Shrinking the step by a factor of 1010 shrank the error by a factor of about 100100, so the error divided by the step length still goes to 00.

Tangent plane

Definition Let f ⁣:U→Rf \colon U \to \mathbb{R} with U⊆R2U \subseteq \mathbb{R}^2 open, and let ff be differentiable at (a,b)(a, b) in UU. The tangent plane to the graph z=f(x,y)z = f(x, y) at the point (a,b,f(a,b))(a, b, f(a, b)) is the graph of the linearization,

z=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b).\begin{aligned} z = f(a, b) &+ f_x(a, b)(x - a) \\[0.4em] &+ f_y(a, b)(y - b). \end{aligned}

A normal vector to it is ⟨fx(a,b),fy(a,b),−1⟩\langle f_x(a, b), f_y(a, b), -1 \rangle. If ff is not differentiable at (a,b)(a, b), the graph has no tangent plane of this form there, even when both partial derivatives exist.

In plain words The tangent plane is the plane that hugs the surface at the point, so closely that the vertical gap between them shrinks faster than your horizontal distance from the point.

Example For f(x,y)=x2+3y2f(x, y) = x^2 + 3y^2 at (1,1)(1, 1) we have f=4f = 4, fx=2x=2f_x = 2x = 2 and fy=6y=6f_y = 6y = 6. The tangent plane is

z=4+2(x−1)+6(y−1)=2x+6y−4,\begin{aligned} z &= 4 + 2(x - 1) + 6(y - 1) \\[0.4em] &= 2x + 6y - 4, \end{aligned}

with normal vector ⟨2,6,−1⟩\langle 2, 6, -1 \rangle. The exact vertical gap is f−z=(x−1)2+3(y−1)2f - z = (x - 1)^2 + 3(y - 1)^2, which is at most 33 times the squared distance to (1,1)(1, 1).

Total differential

Definition For z=f(x,y)z = f(x, y) differentiable at (x,y)(x, y), the total differential is

dz=fx(x,y) dx+fy(x,y) dy,dz = f_x(x, y)\, dx + f_y(x, y)\, dy,

where dxdx and dydy are independent increments. It is the linear part of the change, and the actual change Δz=f(x+dx,y+dy)−f(x,y)\Delta z = f(x + dx, y + dy) - f(x, y) satisfies Δz=dz+o(dx2+dy2)\Delta z = dz + o\big(\sqrt{dx^2 + dy^2}\big). The same formula with nn terms holds for nn variables.

In plain words The differential is the quick estimate of how much the output moves when each input moves a little. It is used for error estimates and small corrections.

Example A can has radius r=3r = 3 cm and height h=10h = 10 cm, so V=πr2hV = \pi r^2 h. If the radius grows by dr=0.05dr = 0.05 cm and the height changes by dh=−0.1dh = -0.1 cm, then

dV=2πrh dr+πr2 dh=3π−0.9π=2.1π≈6.597 cm3.\begin{aligned} dV &= 2\pi r h\, dr + \pi r^2\, dh \\[0.4em] &= 3\pi - 0.9\pi = 2.1\pi \\[0.4em] &\approx 6.597 \text{ cm}^3. \end{aligned}

The exact change is π(3.052⋅9.9−90)≈6.581\pi(3.05^2 \cdot 9.9 - 90) \approx 6.581 cubic centimeters, so the differential is off by about 0.0160.016.

Partial derivatives alone are not enough

Definition The existence of all partial derivatives at a\mathbf{a} does not imply that ff is differentiable at a\mathbf{a}, and it does not even imply that ff is continuous there. To show ff is not differentiable at a\mathbf{a} when the partial derivatives exist, use the only possible candidate, the Jacobian, and show that the remainder divided by ∥h∥\lVert \mathbf{h} \rVert does not tend to 00 along some path.

In plain words Partial derivatives look only along the coordinate axes. The function can behave badly along a diagonal, and differentiability notices that.

Example Let f(x,y)=x2yx2+y2f(x, y) = \frac{x^2 y}{x^2 + y^2} for (x,y)≠(0,0)(x, y) \ne (0, 0) and f(0,0)=0f(0, 0) = 0. On both axes ff is 00, so fx(0,0)=fy(0,0)=0f_x(0, 0) = f_y(0, 0) = 0, and the only candidate is L=0L = 0. Along the diagonal h=kh = k with h>0h > 0,

f(h,h)−02 h=h/22 h=24≠0,\frac{f(h, h) - 0}{\sqrt{2}\,h} = \frac{h/2}{\sqrt{2}\,h} = \frac{\sqrt{2}}{4} \ne 0,

so ff is not differentiable at the origin and its graph has no tangent plane there. The function is continuous at the origin, since ∣f(x,y)∣≤∣y∣\lvert f(x, y) \rvert \le \lvert y \rvert. The function xyx2+y2\frac{xy}{x^2 + y^2}, set to 00 at the origin, is worse. It has both partial derivatives equal to 00 there but equals 12\frac{1}{2} along the line y=xy = x, so it is not even continuous.

Continuous partial derivatives are sufficient

Definition Let U⊆RnU \subseteq \mathbb{R}^n be open, let f ⁣:U→Rmf \colon U \to \mathbb{R}^m, and let a\mathbf{a} be in UU. Suppose there is an open ball B⊆UB \subseteq U centered at a\mathbf{a} such that every partial derivative ∂fi∂xj\frac{\partial f_i}{\partial x_j} exists at every point of BB, and suppose each of these partial derivatives is continuous at a\mathbf{a}. Then ff is differentiable at a\mathbf{a}. In particular, a function of class C1C^1 on UU, meaning all first partial derivatives exist and are continuous on UU, is differentiable at every point of UU. The condition is sufficient but not necessary.

In plain words Checking that the partial derivatives are continuous is the everyday way to prove differentiability. Polynomials, exponentials, sines and their sums, products, quotients with nonzero denominators and compositions all pass this test on open sets where they are defined.

Example The partial derivatives of f(x,y)=excos⁡yf(x, y) = e^x \cos y are excos⁡ye^x \cos y and −exsin⁡y-e^x \sin y, both continuous on R2\mathbb{R}^2. So ff is differentiable everywhere, and at (0,0)(0, 0) its linearization is L(x,y)=1+xL(x, y) = 1 + x. Continuous partial derivatives are not necessary, though. Let r=x2+y2r = \sqrt{x^2 + y^2} and

g(x,y)={r2sin⁡(1/r),r≠0,0,r=0.g(x, y) = \begin{cases} r^2 \sin(1/r), & r \ne 0, \\ 0, & r = 0. \end{cases}

Since ∣g∣≤r2\lvert g \rvert \le r^2, the remainder ratio ∣g(h)∣/∥h∥\lvert g(\mathbf{h}) \rvert / \lVert \mathbf{h} \rVert is at most ∥h∥\lVert \mathbf{h} \rVert, so gg is differentiable at the origin with derivative 00. In particular gx(0,0)=0g_x(0, 0) = 0. Away from the origin the product and chain rules give

gx=2xsin⁡(1/r)−xrcos⁡(1/r).g_x = 2x \sin(1/r) - \frac{x}{r}\cos(1/r).

On the positive xx axis this is 2xsin⁡(1/x)−cos⁡(1/x)2x\sin(1/x) - \cos(1/x). The first term tends to 00 as x→0+x \to 0^+, while cos⁡(1/x)\cos(1/x) takes the values 11 and −1-1 at points arbitrarily close to 00, so gxg_x has no limit at the origin and is not continuous there. By symmetry the same holds for gyg_y.

Check yourself

  1. Find the linearization of f(x,y)=xeyf(x, y) = x e^y at (2,0)(2, 0) and use it to estimate f(2.1,−0.1)f(2.1, -0.1).
Show the answer

The partial derivatives are fx=ey=1f_x = e^y = 1 and fy=xey=2f_y = x e^y = 2 at (2,0)(2, 0), and they are continuous everywhere. So

L(x,y)=2+(x−2)+2y,L(x, y) = 2 + (x - 2) + 2y,

and L(2.1,−0.1)=2+0.1−0.2=1.9L(2.1, -0.1) = 2 + 0.1 - 0.2 = 1.9. The true value is 2.1e−0.1≈1.900162.1 e^{-0.1} \approx 1.90016.

  1. Let g(x,y)=x2y2x2+y2g(x, y) = \frac{x^2 y^2}{x^2 + y^2} for (x,y)≠(0,0)(x, y) \ne (0, 0) and g(0,0)=0g(0, 0) = 0. Prove that gg is differentiable at the origin.
Show the answer

On the axes gg is 00, so both partial derivatives at the origin are 00 and the candidate is L=0L = 0. Since x2y2≤14(x2+y2)2x^2 y^2 \le \frac{1}{4}(x^2 + y^2)^2,

∣g(h,k)∣h2+k2≤14h2+k2→0.\frac{\lvert g(h, k) \rvert}{\sqrt{h^2 + k^2}} \le \frac{1}{4}\sqrt{h^2 + k^2} \to 0.

So gg is differentiable at the origin with total derivative 00.

  1. Show that f(x,y)=∣xy∣f(x, y) = \sqrt{\lvert xy \rvert} has both partial derivatives at the origin but no tangent plane there.
Show the answer

The function is 00 on both axes, so fx(0,0)=fy(0,0)=0f_x(0, 0) = f_y(0, 0) = 0 and the only candidate plane is z=0z = 0. Along h=k≠0h = k \ne 0 the ratio is

f(h,h)2 ∣h∣=∣h∣2 ∣h∣=12,\frac{f(h, h)}{\sqrt{2}\,\lvert h \rvert} = \frac{\lvert h \rvert}{\sqrt{2}\,\lvert h \rvert} = \frac{1}{\sqrt{2}},

which does not tend to 00. So ff is not differentiable at the origin and has no tangent plane there.

How this lesson connects

It also uses Partial derivatives, Linear maps and matrices and Limits using Euclidean distance.