Functions of several variables

Most functions which arise in real world applications depend on more than one variable. Examples include:

1.1 Sketching simple surfaces in R3\mathbb{R}^3

The graph of a function ff of one variable, given by y=f(x)y=f(x), gives rise to a curve in R2\mathbb{R}^2. The graph of a function FF of two variables, given by z=F(x,y)z=F(x,y), gives rise to a surface in R3\mathbb{R}^3.

Sketching a graph in R3\mathbb{R}^3 can be challenging because the sketch must be represented in R2\mathbb{R}^2. The conventional orientation is as follows:
Conventional orientation of the x-, y-, and z-axes with the xy-plane highlighted
This is however difficult to properly represent for plots that cannot be visualised clearly from a fixed perspective, and also cannot be easily drawn by hand.

Topographic maps solve this problem by using contour lines to represent the height (above sea level) of the surface of the earth at various points. This idea can be adapted to sketching a surface z=F(x,y)z=F(x,y) described by a function FF. Here, zz represents the height of the surface above the xyxy-plane, and the contours of the surface can be defined as follows:

Note

Contour
A contour or level curve of a function F:R2RF : \mathbb{R}^2 \rightarrow \mathbb{R} is a curve in R2\mathbb{R}^2 corresponding to an equation of the form F(x,y)=CF(x,y)=C, where CC is a constant.

For each level curve, the corresponding value of CC gives the height of the curve above the xyxy-plane.

We can use a profile obtained from a plot of:

  • zz versus yy (with x=constantx=\text{constant}) or
  • zz versus xx (with y=constanty=\text{constant}).
    These can be thought of as vertical cuts through the function surface.

Basically level curves are top-down view; profile's are views from the side of the plane when seen in conventional orientation.

Example Sketch level curves for the function F:R2RF:\mathbb{R}^2 \rightarrow \mathbb{R}, where F(x,y)=x2+y2F(x,y)=x^2+y^2.
Since the level curves are of the form x2+y2=Cx^2+y^2=C, where CC is nonnegative (as there is no solution for C<0C<0), you can interpret this as circles with varying radii.
Concentric circular level curves z = 1, 2, 3, and 4 for z = x² + y²
These are the level curves given by x2+y2={0,1,2,3,4}x^2+y^2=\{0,1,2,3,4\}.

Example Sketch the surface in R3\mathbb{R}^3 described by the equation z=x2+y2z=x^2+y^2.
From the previous example, we know that the surface increases in radius on the xyxy-plane; the level curves for the surface are circles. When x=0x=0, we have z=y2z=y^2. On the yzyz-plane, this is simply a parabola. The yzyz-profile and level curves help produce a sketch of the surface.

  • (You can also use the xzxz-profile but since they are both the same you can just use one)
    Paraboloid z = x² + y² with circular slices at z = 1 through 4 and profile z = y²
    This is the conventional orientation for the xx-, yy- and zz-axes.

Example A surface in R3\mathbb{R}^3 is described by the equation x2+y2z2=1x^2 + y^2 − z^2 = 1. Sketch some level curves and hence sketch the surface in R3\mathbb{R}^3 .

First obtain the level curve by setting zz equal to CC, for some constant CC.
Table and concentric circular level curves for x² + y² − z² = 1 at z = 0, ±1, ±2, and ±3
For the profiles, if x=0x= 0 you get y2z2=1y^2-z^2=1, which is a hyperbola:
Hyperbolic yz-profile y² − z² = 1 with vertices at y = ±1
Combining this, you get a hyperboloid of one sheet
One-sheet hyperboloid x² + y² − z² = 1 with circular slices from z = −3 to 3

Example. Sketch some level curves and profiles for the surface z=x2y2z=x^2-y^2, and hence describe the surface.
The level curves are of the form x2y2=Cx^2-y^2=C:

  • If C=0C=0, then y2=x2y^2=x^2, i.e. the pair of straight lines y=xy=x and y=xy=-x.
  • If C>0C>0, the level curves are hyperbolas opening left-and-right, crossing the xx-axis at x=±Cx=\pm\sqrt{C}.
  • If C<0C<0, the level curves are hyperbolas opening up-and-down, crossing the yy-axis at y=±Cy=\pm\sqrt{-C}.
    For the profiles, setting y=0y=0 gives z=x2z=x^2 (an upward parabola on the xzxz-plane), whilst setting x=0x=0 gives z=y2z=-y^2 (a downward parabola on the yzyz-plane). So the surface rises in the xx-direction but falls in the yy-direction; this is a saddle (formally, a hyperbolic paraboloid). Notice how the two profiles are genuinely different here, so unlike the paraboloid you actually need both of them.

The surface z=xyz=xy is the same saddle shape rotated 4545^\circ (rotating z=x2y2z=x^2-y^2 by 4545^\circ gives exactly z=2xyz=2xy, so z=xyz=xy is that saddle rotated and vertically scaled by 12\frac{1}{2}); its level curves xy=Cxy=C are hyperbolas with the xx- and yy-axes as asymptotes, and along the line y=xy=x the profile is the upward parabola z=x2z=x^2 whilst along y=xy=-x it is the downward parabola z=x2z=-x^2.

Example. The surfaces z=x2+y2z=x^2+y^2 and z=x2+y2z=\sqrt{x^2+y^2} both have circles as their level curves. Explain how a sketch can still tell them apart.
For the paraboloid z=x2+y2z=x^2+y^2, the level curve at height CC is a circle of radius C\sqrt{C}, so the radii for C=1,2,3,4C=1,2,3,4 are

1,2,3,2;1, \sqrt{2}, \sqrt{3}, 2;

the circles bunch closer and closer together, meaning the surface gets steeper as you move outwards. For z=x2+y2z=\sqrt{x^2+y^2}, the level curve at height CC is a circle of radius exactly CC, so the radii are 1,2,3,41,2,3,4; evenly spaced circles, meaning constant steepness. The profiles confirm this: setting x=0x=0 gives z=y2z=y^2 for the first surface but z=yz=|y| (a V shape) for the second, so the second surface is a cone with a sharp tip at the origin.
Two different surfaces can have identical-looking level curves; the spacing of the level curves and the profiles are what actually pin the surface down.

1.2 Partial differentiation

To introduce the notion of a partial derivative, consider the function FF given by

F(x,y)=x2+y2.F(x,y) = x^2+y^2.

The goal is to quantify the rate of change of F(x,y)F(x,y) at the point (1,2)(1,2).

Since there are two variables, there are two places where the rate of change is changing: the xx- and the yy-direction. This means we can differentiate with respect to one of the variables while holding the other variables fixed. Since we are considering (1,2)(1,2), we have x=1x=1 and

z=F(x,y)=F(1,y)=1+y2,z=F(x,y)=F(1,y)=1+y^2,

since xx is constant but yy is not. This can also be thought of as the plane x=1x=1 intersecting with the plot of F(x,y)F(x,y). The gradient in the yy-direction can be calculated in the usual way:

gradient =ddy(1+y2)y=2=2yy=2=4.\text{gradient } = \frac{d}{dy}(1+y^2) \bigg\rvert_{y=2}=2y\bigg\rvert_{y=2}=4.

Thus the rate of change of F(x,y)F(x,y) at (1,2)(1,2) in the yy-direction is 4.

A faster way of doing this is simply just treating xx as a constant:

Fy(x,y)=2yF_y(x,y)=2y

and then evaluating

Fy(1,2)=2×2=4.F_y(1,2)=2\times2=4.

The function FyF_y is called the partial derivative of FF with respect to yy.
Using the same method you can find Fx(1,2)F_x(1,2) and obtain 22.
Paraboloid z = x² + y² cut by x = 1, showing point (1, 2, 5) and y-direction gradient 4

The partial derivatives of a function FF may be defined formally by using limits.

Note

Note
The partial derivatives of FF with respect to xx and yy are defined by

Fx(x,y)=limh0F(x+h,y)F(x,y)hF_x(x,y)=\lim_{h\rightarrow0}\frac{F(x+h,y)-F(x,y)}{h}

and

Fy(x,y)=limh0F(x,y+h)F(x,y)hF_y(x,y)=\lim_{h\rightarrow0}\frac{F(x,y+h)-F(x,y)}{h}

wherever these limits exist.

Example. Using the limit definition, find FxF_x where F(x,y)=x2yF(x,y)=x^2y.

Fx(x,y)=limh0F(x+h,y)F(x,y)h=limh0(x+h)2yx2yh=limh0x2y+2xhy+h2yx2yh=limh02xhy+h2yh=limh0(2xy+hy)=2xy.\begin{align*} F_x(x,y)&=\lim_{h\rightarrow0}\frac{F(x+h,y)-F(x,y)}{h} \\ &=\lim_{h\rightarrow0}\frac{(x+h)^2y-x^2y}{h} \\ &=\lim_{h\rightarrow0}\frac{x^2y+2xhy+h^2y-x^2y}{h} \\ &=\lim_{h\rightarrow0}\frac{2xhy+h^2y}{h} \\ &=\lim_{h\rightarrow0}(2xy+hy) \\ &=2xy. \end{align*}

This agrees with the fast method of just treating yy as a constant and differentiating with respect to xx.

Example. Let F(x,y)=x2+y2F(x,y)=\sqrt{x^2+y^2} (the cone from 1.1). Show that Fx(0,0)F_x(0,0) does not exist.
Blindly differentiating gives Fx=xx2+y2F_x=\dfrac{x}{\sqrt{x^2+y^2}}, which is 00\frac{0}{0} at the origin, so we fall back to the limit definition:

Fx(0,0)=limh0F(h,0)F(0,0)h=limh0h20h=limh0hh,\begin{align*} F_x(0,0)&=\lim_{h\rightarrow0}\frac{F(h,0)-F(0,0)}{h} \\ &=\lim_{h\rightarrow0}\frac{\sqrt{h^2}-0}{h} \\ &=\lim_{h\rightarrow0}\frac{|h|}{h}, \end{align*}

which is 11 from the right but 1-1 from the left, so the limit does not exist. This makes sense geometrically; the cone has a sharp tip at the origin, so there is no well defined slope there (and, looking ahead to 1.3, no tangent plane either). If a question asks about a partial derivative at a point where the usual differentiation rules break down, use the limit definition.

Notation: Regarding FxF_x and FyF_y, they can also be denoted by

Fx or D1F,\frac{\partial F}{\partial x} \quad \text{ or } \quad D_1F,

for FxF_x, while FyF_y may be denoted by

Fy or D2F.\frac{\partial F}{\partial y} \quad \text{ or } \quad D_2F.

It is important to note that the notation involving the 'curly d' is a bit ambiguous. The notation D1F(y,x)D_1F(y,x) simply means differentiate the first variable in the parenthesis and then evaluate the derivative at the point (y,x)(y,x). To do the same with the 'curly d', one would write Fx(y,x)\dfrac{\partial F}{\partial x}(y,x). Here the xx represents the first variable of the function whilst the xx in parenthesis represents the second ordinate of the point (y,x).(y,x).

Geometrical interpretations

  1. Fx\dfrac{\partial F}{\partial x} is the slope of the surface z=F(x,y)z=F(x,y) in the xx direction.
  2. Fx(a,b)F_x(a,b) is the gradient of the tangent to the cross section at (a,b)(a,b) when the surface z=F(x,y)z=F(x,y) is intersected with the plane y=by=b.
    Similar definitions for Fy\dfrac{\partial F}{\partial y} and Fy(a,b)F_y(a,b).

Example. Suppose that F(x,y)=3exy3sinyF(x,y)=3e^{xy^3}\sin{y}. Find Fx\dfrac{\partial F}{\partial x} and Fy.\dfrac{\partial F}{\partial y}.
For Fx\dfrac{\partial F}{\partial x}, we treat yy as a constant to yield

3y3exy3siny.3y^3e^{xy^3}\sin{y}.

For Fy\dfrac{\partial F}{\partial y}, we treat xx as a constant and use the product rule to yield

(3xy2×3exy3×siny)+(3exy3×cosy)=3exy3(3xy2siny+cosy).\begin{align*} (3xy^2 \times 3e^{xy^3}\times\sin{y}) + (3e^{xy^3} \times \cos{y}) &= \\ 3e^{xy^3}(3xy^2\sin{y}+\cos{y}). \end{align*}

Notation p2:
For second order partial derivatives, the notation is as follows:

2Fx2 means Fx(Fx);2Fy2 means Fy(Fy);2Fxy means Fx(Fy);2Fyx means Fy(Fx).\begin{align*} \frac{\partial^2 F}{\partial x^2} &\text{ means } \frac{\partial F}{\partial x} (\frac{\partial F}{\partial x}); \\ \frac{\partial^2 F}{\partial y^2} &\text{ means } \frac{\partial F}{\partial y} (\frac{\partial F}{\partial y}); \\ \frac{\partial^2 F}{\partial x \partial y} &\text{ means } \frac{\partial F}{\partial x} (\frac{\partial F}{\partial y}); \\ \frac{\partial^2 F}{\partial y \partial x} &\text{ means } \frac{\partial F}{\partial y} (\frac{\partial F}{\partial x}). \end{align*}

Note

The mixed derivative theorem
Suppose that FF is a function of two variables. If FF and all its first and second order partial derivatives are continuous then

2Fxy=2Fyx\frac{\partial^2 F}{\partial x \partial y} = \frac{\partial^2 F}{\partial y \partial x}

Since the definition of continuous is sort of ambiguous for two variables, a simple way to determine if it's continuous is simply to see if it's made up of many compositions of single variable functions. This means for a function F(x,y)=3xy4+exsinyF(x,y)=3xy^4+e^x\sin{y}, you can rewrite as
F(x,y)=f(x)g(y)+h(x)k(y)F(x,y)=f(x)g(y)+h(x)k(y).

Most functions of two variables given in this course are continuous on their domains.

To prove the theorem, you use the definition of the partial derivative.
Double difference-quotient proof that the mixed partial derivatives Fxy and Fyx are equal

Example. Compute all second order partial derivatives of FF, where F(x,y)=3xy4+exsinyF(x,y)=3xy^4+e^x\sin{y}, and verify the mixed derivative theorem.
The first order partial derivatives are

Fx(x,y)=3y4+exsiny,Fy(x,y)=12xy3+excosy.\begin{align*} F_x(x,y)&=3y^4+e^x\sin{y}, \\ F_y(x,y)&=12xy^3+e^x\cos{y}. \end{align*}

Differentiating each of these again,

2Fx2=exsiny,2Fy2=36xy2exsiny,2Fyx=y(3y4+exsiny)=12y3+excosy,2Fxy=x(12xy3+excosy)=12y3+excosy.\begin{align*} \frac{\partial^2 F}{\partial x^2}&=e^x\sin{y}, \\ \frac{\partial^2 F}{\partial y^2}&=36xy^2-e^x\sin{y}, \\ \frac{\partial^2 F}{\partial y \partial x}&=\frac{\partial}{\partial y}(3y^4+e^x\sin{y})=12y^3+e^x\cos{y}, \\ \frac{\partial^2 F}{\partial x \partial y}&=\frac{\partial}{\partial x}(12xy^3+e^x\cos{y})=12y^3+e^x\cos{y}. \end{align*}

The two mixed partial derivatives are equal, exactly as the theorem promised; recall from earlier that this FF is continuous since it is built from single variable continuous functions.

Example. Suppose that F(x,y)=x3y2+esinytan1yF(x,y)=x^3y^2+e^{\sin{y}}\tan^{-1}{y}. Find 2Fxy\dfrac{\partial^2 F}{\partial x \partial y}.
Following the notation literally, we would have to differentiate with respect to yy first; but Fy\dfrac{\partial F}{\partial y} requires a product rule on esinytan1ye^{\sin{y}}\tan^{-1}{y}, which is horrible. Instead, notice that FF and all its partial derivatives are continuous (compositions of single variable functions again), so the mixed derivative theorem lets us swap the order for free:

Fx=3x2y2(the ugly term has no x, so it dies),2Fyx=6x2y.\begin{align*} \frac{\partial F}{\partial x}&=3x^2y^2 \quad (\text{the ugly term has no } x \text{, so it dies}), \\ \frac{\partial^2 F}{\partial y \partial x}&=6x^2y. \end{align*}

Therefore 2Fxy=6x2y\dfrac{\partial^2 F}{\partial x \partial y}=6x^2y as well. When one order of differentiation is much messier than the other, check continuity and then use the mixed derivative theorem to pick the easy order.

1.3 Tangent planes to surfaces

A tangent plane is just like a tangent line in R2\mathbb{R}^2, but for surfaces in R3\mathbb{R}^3. While deriving an equation for the tangent plane, a formula for the normal vector to the surface at a given point is also obtained.

Example. Suppose that F(x,y)=x2+y2F(x,y) = x^2+y^2. Find the Cartesian equation of the tangent plane to the surface z=F(x,y)z=F(x,y) at the point where (x,y,z)=(1,2,5)(x,y,z)=(1,2,5). Find also a vector n\mathbf{n} that is normal to the surface at this point.

First, intersect the surface z=x2+y2z=x^2+y^2 with the plane x=1x=1 to get

{z=1+y2x=1.\begin{cases} z = 1+y^2 \\ x = 1. \end{cases}

The gradient is Fy(1,2)=4F_y(1,2)=4. Using the point-gradient formula (yy1)=m(xx1)(y-y_1)=m(x-x_1) but for z=1+y2z=1+y^2, a Cartesian equation for this tangent is given by

z5=4(y2),x=1.z-5=4(y-2), \quad x = 1.

If y=λ+2y= \lambda + 2, then the equation of the tangent line in parametric form is

(xyz)=(125)+λ(014)\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \\ 5 \end{pmatrix} + \lambda \begin{pmatrix} 0 \\ 1 \\ 4 \end{pmatrix}

whenever λR\lambda \in \mathbb{R}.
Similarly, we intersect the surface with the plane y=2y=2 and repeat the previous steps to obtain

{z=4+x2y=2.\begin{cases} z = 4+x^2 \\ y = 2. \end{cases}

If x=μ+1x = \mu + 1 then the parametric vector form is

(xyz)=(125)+μ(102)\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \\ 5 \end{pmatrix} + \mu \begin{pmatrix} 1 \\ 0 \\ 2 \end{pmatrix}

whenever μR\mu \in \mathbb{R}.
Since the two direction vectors lie in the tangent plane and the vectors are nonparallel, the tangent plane to the surface (1,2,5)(1,2,5) is given by

(xyz)=(125)+λ(014)+μ(102).\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 1 \\ 2 \\ 5 \end{pmatrix} + \lambda \begin{pmatrix} 0 \\ 1 \\ 4 \end{pmatrix} + \mu \begin{pmatrix} 1 \\ 0 \\ 2 \end{pmatrix}.

We can now convert the parametric vector form to a point-normal form, where the normal vector is given by the cross product of the two directions,

n=(014)×(102)=(241).\mathbf{n} = \begin{pmatrix} 0 \\ 1 \\ 4 \end{pmatrix} \times \begin{pmatrix} 1 \\ 0 \\ 2 \end{pmatrix} = \begin{pmatrix} 2 \\ 4 \\ -1 \end{pmatrix}.

Finally, you get the dot product of the normal and the coordinate vectors,

(241)(x1y2z5)=0.\begin{pmatrix} 2 \\ 4 \\ -1 \end{pmatrix} \cdot \begin{pmatrix} x-1 \\ y-2 \\ z-5 \end{pmatrix} = 0.

By expanding the dot product, one obtains z=5+2(x1)+4(y2)z=5+2(x-1)+4(y-2), which simplifies to

2x+4yz=5.2x + 4y - z = 5.

This is the cartesian form of the tangent plane.

Notice how Fx(1,2)=2F_x(1,2) = 2 and Fy(1,2)=4F_y(1,2) = 4; each number being the coefficient of the cartesian equation respectively as well as components of the normal vector. This is not an accident;

Note

Proposition
Suppose that FF is a function of two variables and (x0,y0,z0)(x_0, y_0, z_0) is a point that lies on the surface z=F(x,y)z = F(x, y). If the surface has a tangent plane at the point (x0,y0,z0)(x_0, y_0, z_0), then the tangent plane is given by the equation

z=z0+Fx(x0,y0)(xx0)+Fy(x0,y0)(yy0)z = z_0 + F_x(x_0, y_0)(x − x_0) + F_y(x_0, y_0)(y − y_0)

and the normal vector to the surface at (x0,y0,z0)(x_0, y_0, z_0) is given by

(Fx(x0,y0)Fy(x0,y0)1)\begin{pmatrix} F_x(x_0,y_0) \\ F_y(x_0,y_0) \\ -1 \end{pmatrix}

Example. Find a normal vector n\mathbf{n} and the Cartesian equation of the tangent plane to the surface z=4x2yz=4x^2y at the point (2,1,16)(2,-1,-16).
The partial derivatives are

Fx(x,y)=8xy,Fy(x,y)=4x2,\begin{align*} F_x(x,y)&=8xy, \\ F_y(x,y)&=4x^2, \end{align*}

so at the point (2,1)(2,-1),

Fx(2,1)=8(2)(1)=16,Fy(2,1)=4(2)2=16.\begin{align*} F_x(2,-1)&=8(2)(-1)=-16, \\ F_y(2,-1)&=4(2)^2=16. \end{align*}

By the proposition, a normal vector is

n=(16161)\mathbf{n}=\begin{pmatrix} -16 \\ 16 \\ -1 \end{pmatrix}

and the tangent plane is

z=1616(x2)+16(y+1)=3216x+16y.\begin{align*} z&=-16-16(x-2)+16(y+1) \\ &=32-16x+16y. \end{align*}

Therefore the tangent plane is 16x16y+z=3216x-16y+z=32. Notice how much faster this is than the four-step vector geometry method; for a surface given explicitly as z=F(x,y)z=F(x,y), jump straight to the proposition.

Another way to find the normal vector is as follows;
if a surface is given in the form of g(x,y,z)=0g(x,y,z)=0, then the vector n=(gxgygz)\mathbf{n}=\begin{pmatrix} g_x \\ g_y \\ g_z \end{pmatrix} evaluated at some point PP on the surface, is a vector normal to the surface at PP.

Example. Find the equation of the tangent plane to the ellipsoid x24+y22+z28=1\dfrac{x^2}{4}+\dfrac{y^2}{2}+\dfrac{z^2}{8}=1 at the point P(0,1,2)P(0, 1, 2).
To find Fx(x,y)F_x(x,y), we use implicit differentiation and treat zz as a function of xx.

x(x24+y22+z28)=x(1)x2+0+z4Fx=0Fx=2xz.\begin{align*} \frac{\partial}{\partial x}(\frac{x^2}{4}+\frac{y^2}{2}+\frac{z^2}{8})&=\frac{\partial}{\partial x}(1) \\ \frac{x}{2}+0+\frac{z}{4}F_x&=0 \\ F_x&=-\frac{2x}{z}. \end{align*}

Similarly,

Fy=4yz.F_y=-\frac{4y}{z}.

A vector normal to the ellipsoid at PP can be derived by two methods, either from the method described in the earlier proposition or the gradient-vector method.
Using the gradient vector method we obtain,

n1=(x2yz4)P=(011/2).\mathbf{n}_1=\begin{pmatrix} \dfrac{x}{2} \\ y \\ \dfrac{z}{4} \end{pmatrix}_P = \begin{pmatrix} 0 \\ 1 \\ 1/2 \end{pmatrix}.

Using the proposition,

n2=(2024121)=(021)\mathbf{n}_2=\begin{pmatrix} -\dfrac{2 \cdot 0}{2} \\ -\dfrac{4 \cdot 1}{2} \\ -1 \end{pmatrix} = \begin{pmatrix} 0 \\ -2 \\ -1 \end{pmatrix}

Notice that n2=2n1\mathbf{n}_2 = -2\mathbf{n}_1; demonstrating that both methods are valid.

Hence, the equation of the tangent has the form

0x+1y+12z=d0x + 1y + \frac{1}{2}z = d

for some constant dd. Substituting PP, the desired equation is 2y+z=42y+z=4.

Example. Find the equation of the tangent plane to the sphere x2+y2+z2=1x^2+y^2+z^2=1 at the point P(13,12,236)P\left(\dfrac{1}{3},\dfrac{1}{2},\dfrac{\sqrt{23}}{6}\right).
First a quick sanity check that PP actually lies on the sphere: 19+14+2336=4+9+2336=1\frac{1}{9}+\frac{1}{4}+\frac{23}{36}=\frac{4+9+23}{36}=1.
We could rearrange for z=1x2y2z=\sqrt{1-x^2-y^2} and use the proposition, but the square root makes the partial derivatives messy; the gradient-vector method is much cleaner here. Writing g(x,y,z)=x2+y2+z21g(x,y,z)=x^2+y^2+z^2-1,

n=(gxgygz)P=(2x2y2z)P=(2/3123/3).\mathbf{n}=\begin{pmatrix} g_x \\ g_y \\ g_z \end{pmatrix}_P = \begin{pmatrix} 2x \\ 2y \\ 2z \end{pmatrix}_P=\begin{pmatrix} 2/3 \\ 1 \\ \sqrt{23}/3 \end{pmatrix}.

Scaling by 33 to clear the fractions, we may instead use n=(2,3,23)T\mathbf{n}=(2,3,\sqrt{23})^T. The tangent plane then has the form

2x+3y+23z=d,2x+3y+\sqrt{23}z=d,

and substituting PP,

d=23+32+236=4+9+236=6.\begin{align*} d&=\frac{2}{3}+\frac{3}{2}+\frac{23}{6} \\ &=\frac{4+9+23}{6} \\ &=6. \end{align*}

Therefore the tangent plane is 2x+3y+23z=62x+3y+\sqrt{23}z=6. If the surface is given implicitly, do not bother rearranging for zz; use n=(gx,gy,gz)T\mathbf{n}=(g_x,g_y,g_z)^T directly.

Example. Find all points on the saddle z=x2y2z=x^2-y^2 where the tangent plane is horizontal.
A horizontal plane has normal vector (0,0,1)T(0,0,-1)^T (up to scaling), so both partial derivatives must vanish:

Fx(x,y)=2x=0,Fy(x,y)=2y=0,\begin{align*} F_x(x,y)&=2x=0, \\ F_y(x,y)&=-2y=0, \end{align*}

which forces (x,y)=(0,0)(x,y)=(0,0). So the only such point is the origin, where the tangent plane is z=0z=0. Notice however that the plane z=0z=0 intersects the surface along the level curves y=±xy=\pm x, so the tangent plane actually passes through the surface. A horizontal tangent plane does not mean the point is a maximum or a minimum; here it is a saddle point.

1.4 The total differential approximation

Suppose that ff is a differentiable function of one variable. The equation of the tangent to the graph of ff at a point x0x_0 is given by

y=y0+m(xx0),y = y_0 + m(x-x_0),

where y0=f(x0)y_0=f(x_0). When xx is close to x0x_0, the tangent line is close to the graph of ff, meaning

f(x)f(x0)+f(x0)(xx0).f(x) \approx f(x_0) + f'(x_0)(x-x_0).

Example. Let (x)\ell(x) be the tangent line to the function y=p(x)=3x2+4x+3y=p(x)=3x^2+4x+3 at the point [2,23][2,23]. Find (1.9) and p(1.9).\ell(1.9) \text{ and } p(1.9).
Finding (x)\ell(x),

y0=p(2)=23f(x)=6x+4f(2)=6(2)+4=16(x)=23+16(x2)(x)=23+16x32(x)=16x9\begin{align*} y_0 = p(2) = 23 \\ f'(x) = 6x + 4 \\ f'(2) = 6(2) + 4 = 16 \\ \ell(x) = 23 + 16(x-2) \\ \ell(x) = 23 + 16x - 32 \\ \ell(x) = 16x - 9 \end{align*}

Evaluating (1.9)=21.4\ell(1.9) = 21.4 whilst p(1.9)=21.43p(1.9) = 21.43. Therefore, it is clear that the tangent line for a point x0x_0 can be used to evaluate p(x1)p(x_1), where x1x0x_1 \approx x_0.
Graph of quadratic p(x) in red and its tangent line at x = 2 in blue
The image above depicts p(x)p(x) in red and the tangent (x)\ell(x) in blue.

Rewriting Δx=xx0\Delta x = x - x_0 and Δf=f(x)f(x0)\Delta f = f(x) - f(x_0), we have

Δff(x0)Δx.\Delta f \approx f'(x_0) \Delta x.

This is called differential approximation to Δf\Delta f. Extending this to functions with two variables,
suppose that a surface given by z=F(x,y)z=F(x,y) has a tangent plane at the point (x0,y0,z0)(x_0,y_0,z_0). The equation of the tangent is given by

z=z0+Fx(x0,y0)(xx0)+Fy(x0,y0)(yy0).z = z_0 + F_x(x_0,y_0)(x-x_0) + F_y(x_0,y_0)(y-y_0).

If (x,y)(x,y) are near (x0,y0)(x_0,y_0), and rewriting z0=F(x0,y0)z_0=F(x_0,y_0),

F(x,y)F(x0,y0)Fx(x0,y0)(xx0)+Fy(x0,y0)(yy0).F(x,y) - F(x_0,y_0) \approx F_x(x_0,y_0)(x-x_0) + F_y(x_0,y_0)(y-y_0).

There's alot of iterating afterwards with Δ\Delta (image attached)
Derivation of the total differential approximation ΔF ≈ Fx Δx + Fy Δy
This formula is called the total differential approximation to ΔF\Delta F. By suppressing the point of evaluation, the total differential approximation may be written as

ΔFFxΔx+FyΔy.\Delta F \approx \frac{\partial F}{\partial x} \Delta x + \frac{\partial F}{\partial y} \Delta y.

The approximation improves as Δx\Delta x and Δy\Delta y get smaller.

Example. Consider the paraboloid z=F(x,y)=x252+y232z=F(x,y) = \dfrac{x^2}{5^2} + \dfrac{y^2}{3^2} at the point [5,1,10/9][5,1,10/9]. Find the total differential approximation of z=F(x,y)z=F(x,y) at [5.1,1.1][5.1,1.1] and compare it to F(5.1,1.1)F(5.1,1.1).

Evaluating Fx(5,1)F_x(5,1):

F(x,y)=x252+y232,Fx(x,y)=2x52+0,Fx(5,1)=2(5)52=25.\begin{align*} F(x,y)&=\frac{x^2}{5^2} + \frac{y^2}{3^2}, \\ F_x(x,y)&=\frac{2x}{5^2} + 0, \\ F_x(5,1)&=\frac{2(5)}{5^2} \\ &=\frac{2}{5}. \end{align*}

And Fy(5,1)=29.F_y(5,1) = \dfrac{2}{9}.
Since they asked for the approximation for zz and not just the change, you would use z=z0+Fx(x0,y0)(xx0)+Fy(x0,y0)(yy0).z = z_0 + F_x(x_0,y_0)(x-x_0) + F_y(x_0,y_0)(y-y_0).
Plugging in x0=5,y0=1,z0=109x_0=5, y_0=1, z_0=\dfrac{10}{9},

z=109+25(x5)+29(y1).z = \frac{10}{9} + \frac{2}{5}(x - 5) + \frac{2}{9}(y - 1).

After simplifying,

z=2x5+2y9109.z = \frac{2x}{5} + \frac{2y}{9} - \frac{10}{9}.

This is the equation for our tangent plane; plugging in (5.1,1.1)(5.1,1.1) we get 1.1731.173, whilst F(5.1,1.1)F(5.1,1.1) is 1.1751.175.

Example. The ideal gas law asserts that the pressure PP, volume VV and temperature TT of an ideal gas are related by the formula,

PV=kT,PV=kT,

where kk is a constant. If the temperature increased by 44% and the volume is decreased by 5%, estimate the percentage increase in pressure.

Doing this the immediate way, which is simply plugging in V=0.95VV=0.95V and T=1.04TT=1.04T yields P=1.040.95kTV1.0947P,ΔP0.0947PP=\dfrac{1.04}{0.95} \dfrac{kT}{V} \approx 1.0947P, \Delta P \approx 0.0947P, however, the question asks us to estimate, meaning we have to use the total differential approximation. Since we are calculating change, we use

ΔFFxΔx+FyΔy.\Delta F \approx \frac{\partial F}{\partial x} \Delta x + \frac{\partial F}{\partial y} \Delta y.

Rewriting,

P(T,V)=kTV,ΔPPTΔT+PVΔV.\begin{align*} P(T,V) &= \frac{kT}{V}, \\ \Delta P \approx \frac{\partial P}{\partial T} \Delta T &+ \frac{\partial P}{\partial V} \Delta V. \end{align*}

Since we know that ΔT=0.04T\Delta T = 0.04T and ΔV=0.05V\Delta V = -0.05V, we simply calculate PT and PV;\dfrac{\partial P}{\partial T} \text{ and } \dfrac{\partial P}{\partial V};

PT=kV,\frac{\partial P}{\partial T} = \frac{k}{V},

PV=kTV2.\frac{\partial P}{\partial V} = -\frac{kT}{V^2}.

Plugging in,

ΔP(kV)(0.04T)+(kTV2)(0.05V)0.04(kTV)+0.05(kTVV2)0.04(kTV)+0.05(kTV)Therefore, ΔP0.09P(since P=kTV)\begin{align*} \Delta P &\approx \left(\frac{k}{V}\right)(0.04T) + \left(-\frac{kT}{V^2}\right)(-0.05V) \\ &\approx 0.04\left(\frac{kT}{V}\right) + 0.05\left(\frac{kTV}{V^2}\right) \\ &\approx 0.04\left(\frac{kT}{V}\right) + 0.05\left(\frac{kT}{V}\right) \\ \text{Therefore, } \\ \Delta P &\approx 0.09P \quad (\text {since } P= \frac{kT}{V}) \end{align*}

Notice how the 9% we obtained from the estimation is close to the exact answer of 9.47%.

NOTE: Another way to calculate zz or find the linear approximation is to simply calculate ΔF\Delta F and add it onto the original FF value, this might be a bit easier.

Example. Use the total differential approximation of f(x,y)=x2+y2f(x,y)=\sqrt{x^2+y^2} to estimate 2.982+4.032\sqrt{2.98^2+4.03^2}.
Pick the nearby nice point (x0,y0)=(3,4)(x_0,y_0)=(3,4), so that f(3,4)=9+16=5f(3,4)=\sqrt{9+16}=5 and

Δx=2.983=0.02,Δy=4.034=0.03.\begin{align*} \Delta x &= 2.98-3=-0.02, \\ \Delta y &= 4.03-4=0.03. \end{align*}

The partial derivatives are

fx(x,y)=xx2+y2,fy(x,y)=yx2+y2,\begin{align*} f_x(x,y)&=\frac{x}{\sqrt{x^2+y^2}}, \\ f_y(x,y)&=\frac{y}{\sqrt{x^2+y^2}}, \end{align*}

so fx(3,4)=35f_x(3,4)=\dfrac{3}{5} and fy(3,4)=45f_y(3,4)=\dfrac{4}{5}. Then

Δf35×(0.02)+45×0.03=0.012+0.024=0.012.\begin{align*} \Delta f &\approx \frac{3}{5}\times(-0.02)+\frac{4}{5}\times0.03 \\ &=-0.012+0.024 \\ &=0.012. \end{align*}

Adding this onto the original value (as per the note above),

2.982+4.0325+0.012=5.012.\sqrt{2.98^2+4.03^2}\approx 5+0.012=5.012.

A calculator gives 5.0121155.012115, so the approximation is accurate to three decimal places. The whole trick with these 'estimate without a calculator' questions is choosing a nearby point where everything is clean.

Upper bounds on errors

No tools have absolute certainty in measurements; there is always a deviation from the exact value (i.e. a ruler can be off by ±0.1\pm 0.1mm). Given this deviation, it is possible to use the total differential approximation to calculate how the maximum value of this deviation from the exact result. Given a function F(x,y)F(x,y), one can interpret ΔF\Delta F as the error in the output given errors Δx\Delta x and Δy\Delta y. Typically, we don't know precise value of the deviation, but we can use bounds for the absolute errors Δx|\Delta x| and Δy| \Delta y |.

 Error ΔFΔFFxΔx+FyΔyFxΔx+FyΔy\begin{align*} \text{ Error } &\approx |\Delta F| \\ |\Delta F|&\approx |\frac{\partial F}{\partial x} \Delta x + \frac{\partial F}{\partial y} \Delta y| \\ &\leq |\frac{\partial F}{\partial x}|| \Delta x| + |{\frac{\partial F}{\partial y}}| |\Delta y| \end{align*}

Example. The dimensions of a cylinder are measured to the nearest millimeter using a measuring tape. The circumference is measured to be 22.0 cm and height is measured to be 15.0 cm. Use these measurements to (a) estimate the volume of the cylinder, and (b) estimate an upper bound for the percentage error in your answer to part (a).

(a). Since C=2πrC = 2\pi r,

V=πr2h=π(C2π2)h=C2h4πV = \pi r^2 h = \pi (\frac{C}{2\pi}^2) h = \frac{C^2 h}{4 \pi}

By using C=22C =22 and h=15h =15,

V=1815π.V = \frac{1815}{\pi}.

And so the volume is estimated to be 1815πcm3\dfrac{1815}{\pi} \text{cm}^3, which is 577.75cm3\approx 577.75 \text{cm}^3.
It says estimate in the question here only because the measuring tools were also estimated values, hence we "estimate" the final result; we don't use linear approx here.

(b). Notice how the question says nearest millimeter, meaning ±0.5mm\pm 0.5\text{mm}, or 0.05cm0.05\text{cm}. The 0.5mm is for reasons below ig:
Measurement-error rule: maximum error is half the smallest measurable unit
We convert to cm to match the units of the given inputs and make our lives easier.
Since both the circumference and height were measured, we can say that

ΔC0.05 and Δh0.05.|\Delta C| \leq 0.05 \quad \text{ and } \quad |\Delta h| \leq 0.05.

We want to calculate ΔV|\Delta V|.

V=C2h4π,VC=Ch2π and Vh=C24π,V = \frac{C^2h}{4\pi}, \frac{\partial V}{\partial C} = \frac{Ch}{2\pi} \text{ and } \frac{\partial V}{\partial h} = \frac{C^2}{4\pi},

subbing in,

VC=165π,Vh=121π.\frac{\partial V}{\partial C} = \frac{165}{\pi}, \frac{\partial V}{\partial h}=\frac{121}{\pi}.

Finally, we put it all together,

ΔV165πΔC+121πΔh165πΔC+121πΔh165π×0.05+121π×0.05=28620π.\begin{align*} |\Delta V| &\approx |\frac{165}{\pi} \Delta C + \frac{121}{\pi} \Delta h| \\ &\leq \frac{165}{\pi} |\Delta C| + \frac{121}{\pi} |\Delta h| \\ &\leq \frac{165}{\pi} \times 0.05 + \frac{121}{\pi} \times 0.05 \\ &= \frac{286}{20\pi}. \end{align*}

So the upper bound for the absolute error in VV is approximately 28620π\dfrac{286}{20\pi} (or about 4.55cm34.55\text{cm}^3). To get the percentage error, we can do

maxΔVV×100%28620ππ1815×100%=2633%.\begin{align*} \frac{\max{|\Delta V|}}{V} \times 100\% &\approx \frac{286}{20\pi}\cdot\frac{\pi}{1815} \times 100 \% \\ &=\frac{26}{33} \%. \end{align*}

Hence the percentage error is no more than about 0.79%.

Example. The volume of a football in the shape of an ellipsoid of revolution with semi-axes of length aa, bb and bb is given by

V=43πab2.V=\frac{4}{3}\pi ab^2.

The values of aa and bb are measured to be 12.012.0 cm and 7.07.0 cm respectively, each to the nearest millimetre. (a) Calculate the volume of the football, (b) estimate the maximum absolute error in the calculated value of VV, and (c) hence estimate the percentage error.

(a) Substituting the measurements,

V=43π(12)(7)2=784π2463 cm3.\begin{align*} V&=\frac{4}{3}\pi(12)(7)^2 \\ &=784\pi \\ &\approx 2463 \text{ cm}^3. \end{align*}

(b) Measuring to the nearest millimetre again means Δa0.05|\Delta a| \leq 0.05 and Δb0.05|\Delta b| \leq 0.05 (converted to cm). The partial derivatives evaluated at (a,b)=(12,7)(a,b)=(12,7) are

Va=43πb2=196π3,Vb=83πab=224π.\begin{align*} \frac{\partial V}{\partial a}&=\frac{4}{3}\pi b^2=\frac{196\pi}{3}, \\ \frac{\partial V}{\partial b}&=\frac{8}{3}\pi ab=224\pi. \end{align*}

Putting it all together,

ΔVVaΔa+VbΔb196π3×0.05+224π×0.05=0.05π(196+6723)=217π1545.4 cm3.\begin{align*} |\Delta V| &\leq \left|\frac{\partial V}{\partial a}\right||\Delta a|+\left|\frac{\partial V}{\partial b}\right||\Delta b| \\ &\leq \frac{196\pi}{3}\times 0.05 + 224\pi \times 0.05 \\ &= 0.05\pi\left(\frac{196+672}{3}\right) \\ &=\frac{217\pi}{15} \\ &\approx 45.4 \text{ cm}^3. \end{align*}

(c) The percentage error is at most

maxΔVV×100%=217π151784π×100%=15584%1.85%.\begin{align*} \frac{\max{|\Delta V|}}{V}\times100\% &= \frac{217\pi}{15}\cdot\frac{1}{784\pi}\times100\% \\ &=\frac{155}{84}\% \\ &\approx 1.85\%. \end{align*}

Therefore the volume is 784π cm3784\pi\text{ cm}^3 with a percentage error of no more than about 1.85%1.85\%. Notice how the error in bb contributes over three times as much as the error in aa, since bb appears squared in the formula.

Example. The specific gravity SS of a solid is given by

S=AAW,S=\frac{A}{A-W},

where AA and WW are its weights in air and water respectively. If AA and WW are measured to be 15.115.1 g and 5.15.1 g respectively, and each measurement has an error whose absolute value is at most 0.20.2 g, estimate the maximum error in the calculated value of SS.

Differentiating with respect to AA (holding WW constant) using the quotient rule,

SA=(AW)A(AW)2=W(AW)2,\begin{align*} \frac{\partial S}{\partial A}&=\frac{(A-W)-A}{(A-W)^2} \\ &=\frac{-W}{(A-W)^2}, \end{align*}

and treating AA as a constant,

SW=A(AW)2.\frac{\partial S}{\partial W}=\frac{A}{(A-W)^2}.

At (A,W)=(15.1,5.1)(A,W)=(15.1,5.1) we have AW=10A-W=10, so

SA=5.1100=0.051,SW=15.1100=0.151.\begin{align*} \frac{\partial S}{\partial A}&=\frac{-5.1}{100}=-0.051, \\ \frac{\partial S}{\partial W}&=\frac{15.1}{100}=0.151. \end{align*}

Then

ΔSSAΔA+SWΔW=0.051×0.2+0.151×0.2=0.0404.\begin{align*} |\Delta S| &\leq \left|\frac{\partial S}{\partial A}\right||\Delta A|+\left|\frac{\partial S}{\partial W}\right||\Delta W| \\ &= 0.051\times0.2+0.151\times0.2 \\ &=0.0404. \end{align*}

Hence the maximum error in SS is approximately 0.04040.0404. Do not plug ΔA=ΔW=0.2\Delta A = \Delta W = 0.2 straight into the total differential approximation; the negative coefficient would make the errors partially cancel and give 0.020.02, which underestimates the worst case. The worst case happens when the two measurement errors have opposite signs, which is exactly why the absolute values are essential.

Using logarithms to make things easier

Suppose we have V(h,r)=πr2hV(h,r) = \pi r^2h. If we wanted a linear approximation of VV, we would usually find VhV_h, VrV_r, and do ΔV=VhΔh+VrΔr\Delta V = V_h \Delta h + V_r \Delta r;

ΔV=(πr2)Δh+(2πrh)Δr,\Delta V = (\pi r^2) \Delta h + (2\pi r h) \Delta r,

this gets us the absolute error, if we want the fractional error we simply divide by VV to understand the weight of each error:

ΔVV=(πr2)Δhπr2h+(2πrh)Δrπr2hΔVV=Δhh+2Δrr.\begin{align*} \frac{\Delta V}{V} &= \frac{(\pi r^2) \Delta h}{\pi r^2 h} + \frac{(2\pi r h) \Delta r}{\pi r^2 h} \\ \frac{\Delta V}{V} &= \frac{\Delta h}{h} + 2\frac{\Delta r}{r}. \end{align*}

Since Δr\Delta r has a coefficient of 2, it means that an error on rr has more weighting than an error on hh. This makes sense as the original equation for VV has r2r^2 meaning it is more dominant compared to just hh.

But doing all that working out is very tedious, we have to take two derivatives, divide by VV and do lots of algebra. This is where logarithms come in. If we take the natural log (ln\ln) of both sides,

lnV=ln(πr2h)lnV=lnπ+2lnr+lnh\begin{align*} \ln{V}&=\ln{(\pi r^2 h)} \\ \ln{V} &= \ln{\pi} +2\ln{r} + \ln{h} \end{align*}

and then take the differential of every single piece, remembering that the derivative of ln(x)\ln(x) is simply dxx\frac{dx}{x},

ΔVV=0+2Δrr+Δhh.\frac{\Delta V}{V} = 0 + 2\frac{\Delta r}{r} + \frac{\Delta h}{h}.

This immediately gives us the same result as before with minimal lines of working out.

Example. A triangle has two sides of length aa and bb with an included angle measuring π3\dfrac{\pi}{3} radians. Given that aa increases by 5%, bb decreases by 6% and the included angle increases by 2%, estimate the percentage increase of area of the triangle

Since we know that A=12absinCA = \frac{1}{2}ab\sin{C},

lnA=ln(12absinC),lnA=ln12+lna+lnb+lnsinCdAA=daa+dbb+cosCsinC×dCdAA=0.050.06+cosπ3sinπ3×0.02×π3,\begin{align*} \ln{A}&=\ln{(\tfrac{1}{2}ab\sin{C})}, \\ \ln{A} &= \ln{\tfrac{1}{2}} + \ln{a} + \ln{b} + \ln{\sin{C}} \\ \frac{dA}{A} &= \frac{da}{a} + \frac{db}{b} + \frac{\cos{C}}{\sin{C}} \times dC \\ \frac{dA}{A} &= 0.05-0.06+\frac{\cos{\frac{\pi}{3}}}{\sin{\frac{\pi}{3}}} \times 0.02 \times \frac{\pi}{3}, \end{align*}

(the constant ln12\ln{\tfrac{1}{2}} differentiates to zero, so the working is otherwise unchanged)
here, each dxdx represents the relative change to xx, so da=0.05ada=0.05a, meaning if we divide dada by aa, we only get the change in percentage. Therefore, we need to multiply dCdC by π3\frac{\pi}{3} since our angle, CC, was given as π3\frac{\pi}{3}. Calculating, we get our area change to be 0.00209\approx 0.00209 or 0.209%0.209\%.

Example. The specific volume vv of a compressible fluid flowing through a section of area AA with mean velocity VV is given by

v=kAV,v=kAV,

where kk is a constant. If vv decreases by 5% and AA increases by 4%, estimate the percentage change in VV.

The unknown percentage this time is on the right hand side, but the log trick handles it the exact same way. Taking ln\ln of both sides,

lnv=lnk+lnA+lnVΔvv=0+ΔAA+ΔVV.\begin{align*} \ln{v}&=\ln{k}+\ln{A}+\ln{V} \\ \frac{\Delta v}{v}&=0+\frac{\Delta A}{A}+\frac{\Delta V}{V}. \end{align*}

Substituting Δvv=0.05\dfrac{\Delta v}{v}=-0.05 and ΔAA=0.04\dfrac{\Delta A}{A}=0.04,

0.05=0.04+ΔVVΔVV=0.09.\begin{align*} -0.05&=0.04+\frac{\Delta V}{V} \\ \frac{\Delta V}{V}&=-0.09. \end{align*}

Therefore the velocity decreases by approximately 9%. Basically, once everything is written in terms of relative changes, you can rearrange for whichever percentage is missing; the log trick is not just for finding the error in the output.

(1.5) Chain Rules

Recall, the chain rule is simply used by calculating the derivative of f(g(x))f(g(x)) or g(f(x))g(f(x)).
If ff and gg are functions of one variable, then the derivative of fgf \circ g may be calculated using the chain rule for functions of one variable:

ddxf(g(x))=f(g(x)g(x).\begin{align*} \frac{d}{dx}f(g(x)) =f'(g(x)g'(x). \end{align*}

To calculate their partial derivatives, we use a chain rule for functions of more than one variable.

Suppose that FF is a function of xx and yy and that xx and yy are each functions of tt. A small change Δt\Delta t in tt produces a corresponding change Δx\Delta x and Δy\Delta y in xx and yy. These changes in turn produce a corresponding change ΔF\Delta F in FF. By the total differential approximation,

ΔFFxΔx+FyΔy\Delta F \approx \frac{\partial F}{\partial x} \Delta x + \frac{\partial F}{\partial y} \Delta y

with the approximation getting better as Δx\Delta x and Δy\Delta y approach zero. If we divide through by Δt\Delta t then

ΔFΔtFxΔxΔt+FyΔyΔt.\frac{\Delta F}{\Delta t} \approx \frac{\partial F}{\partial x} \frac{\Delta x}{\Delta t} + \frac{\partial F}{\partial y} \frac{\Delta y}{\Delta t}.

As Δt0\Delta t \to 0,

ΔxΔt=x(t+Δt)x(t)Δtdxdt\frac{\Delta x}{\Delta t} = \frac{x(t+\Delta t) - x(t)}{\Delta t} \to \frac{dx}{dt}

and

ΔyΔt=y(t+Δt)y(t)Δtdydt.\frac{\Delta y}{\Delta t} = \frac{y(t+\Delta t) - y(t)}{\Delta t} \to \frac{dy}{dt}.

If we also view FF as a function of tt then, ΔFΔtdFdt\dfrac{\Delta F}{\Delta t} \to \dfrac{d F}{d t}. So then the total differential approximation becomes

dFdt=Fxdxdt+Fydydt.\boxed{\frac{d F}{d t} = \frac{\partial F}{\partial x} \frac{d x}{d t} + \frac{\partial F}{\partial y} \frac{d y}{d t}}.

The above chain rule has many ambiguities. Firstly, the FF on the LHS is a function of one variable tt being differentiated with respect to tt, whilst the function on the RHS is a function of two variables x,yx,y being evaluated at a correct point.

This can be better interpreted with the following example.
Suppose you have a function F(x,y)F(x,y) that depends on longitude (x)(x) and latitude (y)(y);

F(x,y)=x2+2y2,F(x,y) = x^2+2y^2,

with the longitude and latitude defined as

x(t)=3t,y(t)=2t.x(t) = 3t,y(t)=2t.

What is the rate of change for FF at t=1?t =1?
Using the chain rule,

Fx=2x,Fy=4ydxdt=3,dydt=2.\begin{align*} \frac{\partial F}{\partial x} = 2x&, \frac{\partial F}{\partial y} = 4y \\ \frac{d x}{d t}=3&, \frac{d y}{d t}=2. \end{align*}

Putting them together,

dFdt=Fxdxdt+Fydydt=3×2x+2×4y,\begin{align*} \frac{d F}{d t} &= \frac{\partial F}{\partial x} \frac{d x}{d t} + \frac{\partial F}{\partial y} \frac{d y}{d t} \\ &= 3\times2x + 2\times 4y, \\ \end{align*}

since x(1)=3x(1)=3 and y(1)=2y(1)=2,

dFdt=(3×2×3)+(2×4×2)=18+16=34.\begin{align*} \frac{d F}{d t} &= (3 \times 2\times 3) + (2\times4\times2) \\ &= 18 +16 \\ &= 34. \end{align*}

Therefore the rate of change is 3434 km/h.
However, this is wrong as FF is being treated as both as F(x,y)F(x,y) and F(t)F(t);
we can create a brand new function g(t)g(t) instead and plug in x(t)=3tx(t)=3t, y(t)=2ty(t)=2t directly,

g(t)=(3t)2+2(2t)2=9t2+8t2=17t2.\begin{align*} g(t)&=(3t)^2+2(2t)^2 \\ &=9t^2+8t^2 \\ &=17t^2. \end{align*}

Because this is now a 1D function, we can just take the normal derivative,

g(t)=34tg(1)=34(1)=34 km/h.\begin{align*} g'(t)&=34t \\ g'(1)&= 34(1)\\ &=34 \text{ km/h.} \end{align*}

The chain rule is usually much faster for complex problems however, but the point of this is to show that technically the notation for the chain rule is illegal.
We can express this chain rule without these ambiguities.

Note

Theorem
*Suppose FF is a function of two variables and that xx and yy are both functions of one variable. Define the function ϕ\phi by ϕ(t)=F(x(t),y(t))\phi(t) = F(x(t),y(t)) and the point (x0,y0)(x_0,y_0) by (x0,y0)=(x(t0),y(t0))(x_0,y_0)=(x(t_0),y(t_0)). The derivative of ϕ\phi at a point tot_o can be defined as

ϕ(t0)=D1F(x0,y0)x(t0)+D2F(x0,y0)y(t0).\phi'(t_0)=D_1F(x_0,y_0)x'(t_0)+D_2F(x_0,y_0)y'(t_0).

This formula and the one mentioned prior are equivalent, the former is easier to remember whilst the latter is more precise. You can use the chain diagram to memorise the rule.
Chain diagram from F through x and y to t, with derivatives labelled along each path
To construct the diagram, draw an arrow from each function to each of its variables. Then dFdt\dfrac{dF}{dt} is the sum of all paths (left to right) from FF to tt, where the derivatives are multiplied across each path.

Example. The kinetic energy of a object with mass mm (kilograms) and velocity vv (metres per second) is given by

K=12mv2.K = \frac{1}{2} mv^2.

Suppose you drop an orange, where

  • the orange has a mass of m=56m=\dfrac{5}{6} kilograms,
  • the acceleration due to gravity is dvdt=9.8 m/s2\dfrac{dv}{dt}=-9.8\text{ m/s}^2.
    Find dKdt\dfrac{dK}{dt} and hence dKdtv=2\dfrac{dK}{dt}\rvert_{v=2}.

By the chain rule, the kinetic energy with respect to time is:

dKdt=D1F(m0,v0)dmdt+D2F(m0,v0)dvdt=12v02×0+m0v0×9.8=56×9.8v0.\begin{align*} \frac{dK}{dt}&=D_1F(m_0,v_0)\frac{dm}{dt}+D_2F(m_0,v_0)\frac{dv}{dt} \\ &= \frac{1}{2}v_0^2 \times 0 + m_0v_0 \times-9.8 \\ &= \frac{5}{6} \times -9.8v_0. \end{align*}

Here, v0v_0 is 2, hence the answer is 49/3-49/3. Notice how mm is not a function of tt whilst vv is, so the side of the equation using mm just turns into 0.

It is not actually necessary to know an explicit formula for the functions ff and gg, only their derivatives are required.
Example. Suppose you drive a car up a steep mountain road at a constant speed of v=10v=10 km/h. The gradient of the mountain is 30 degrees. If g(t)g(t) represents the altitude (in km) of the car at time tt (in hours) then, what is the rate of change in altitude?
Right triangle representing a mountain road inclined at 30 degrees and its vertical altitude component
Furthermore, let f(h)f(h) represent the temperature at hh kilometers above sea level. The temperature drops at a constant rate of 13/213/2 degrees for every kilometer above sea level. Find f(h)f'(h).
The composite function f(g(t))f(g(t)) represents the temperature at time tt. By the chain rule the temperature changes with time at a rate of ddtf(g(t))=f(g(t))g(t)\dfrac{d}{dt}f(g(t))=f'(g(t))g'(t). Find ddtf(g(t))\dfrac{d}{dt}f(g(t)).

To solve this, we can just use basic trigonometry to find the rate of change for the altitude:

sin(30)=g(t)vg(t)=10×sin(30)=10×12=5 km/h.\begin{align*} \sin(30^\circ) &= \frac{g'(t)}{v} \\ g'(t) &= 10 \times \sin(30^\circ) \\ &= 10 \times \frac{1}{2} = 5 \text{ km/h.} \end{align*}

We are given that the temperature drops at a constant rate of 13/213/2 degrees per kilometer, so f(h)=13/2f'(h) = -13/2.

Finally, calculating the composite rate of change:

ddtf(g(t))=f(g(t))g(t)=132×5=32.5 degrees per hour.\begin{align*} \frac{d}{dt}f(g(t)) &= f'(g(t))g'(t) \\ &= -\frac{13}{2} \times 5 \\ &= -32.5 \text{ degrees per hour.} \end{align*}

It might seem confusing to jump back to standard Calculus 1 formulas (like f(g(t))g(t)f'(g(t))g'(t)) after just learning the multivariable dependency trees. But they are actually the exact same formula.
If we draw the dependency tree for this car ride:

  • Top (Final Output): Temperature (TT)

  • Middle (Middleman): Altitude (hh)

  • Bottom (Foundation): Time (tt)
    Because Temperature only depends on Altitude, and Altitude only depends on Time, our tree doesn't branch. It is just a single, straight stick: ThtT \rightarrow h \rightarrow t.
    Since there are no "split loyalties" (multiple variables at the same level), we don't need the curly partial derivative symbol (\partial). It straightens out into a standard total derivative (dd):

dTdt=dTdhdhdt\frac{dT}{dt} = \frac{dT}{dh} \frac{dh}{dt}

This perfectly matches our calculation above: dTdh\frac{dT}{dh} is f(h)f'(h) and dhdt\frac{dh}{dt} is g(t)g'(t).

The chain rule also gives a very slick way of doing implicit differentiation. Suppose a curve in R2\mathbb{R}^2 is given implicitly by F(x,y)=0F(x,y)=0, and we view yy as a function of xx along the curve. Then F(x,y(x))=0F(x,y(x))=0 for all xx, and differentiating both sides with respect to xx using the chain rule (here the parameter tt is just xx itself, so dxdx=1\frac{dx}{dx}=1),

Fxdxdx+Fydydx=0Fx+Fydydx=0.\begin{align*} \frac{\partial F}{\partial x}\frac{dx}{dx}+\frac{\partial F}{\partial y}\frac{dy}{dx}&=0 \\ F_x+F_y\frac{dy}{dx}&=0. \end{align*}

Rearranging,

dydx=FxFy,\boxed{\frac{dy}{dx}=-\frac{F_x}{F_y}},

provided Fy0F_y \neq 0.

Example. Find the gradient of the curve x3+y3=6xyx^3+y^3=6xy at the point (3,3)(3,3).
First check the point is on the curve: 27+27=54=6×3×327+27=54=6\times3\times3. Now let F(x,y)=x3+y36xyF(x,y)=x^3+y^3-6xy, so the curve is F(x,y)=0F(x,y)=0. Then

Fx(x,y)=3x26y,Fy(x,y)=3y26x,\begin{align*} F_x(x,y)&=3x^2-6y, \\ F_y(x,y)&=3y^2-6x, \end{align*}

and so

dydx=Fx(3,3)Fy(3,3)=27182718=1.\begin{align*} \frac{dy}{dx}&=-\frac{F_x(3,3)}{F_y(3,3)} \\ &=-\frac{27-18}{27-18} \\ &=-1. \end{align*}

Therefore the gradient of the curve at (3,3)(3,3) is 1-1. In MATH1131 you would differentiate the whole equation term by term and painfully collect all the dydx\frac{dy}{dx} terms; the boxed formula does all of that in one line. It is also worth remembering that the formula fails wherever Fy=0F_y=0; those are the points where the curve has a vertical tangent.

We now examine the case when FF is a function of x,yx,y, where each x,yx,y is a function of both ss and tt:

F=F(x,y),x=x(s,t) and y=y(s,t).\begin{align*} &F=F(x,y), &x=x(s,t)& &\text{ and }& &y=y(s,t). \end{align*}

If we treat ss as a constant and differentiate FF with respect to tt, the chain rule gives

Ft=Fxxt+Fyyt.\boxed{\frac{\partial F}{\partial t} = \frac{\partial F}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial F}{\partial y} \frac{\partial y}{\partial t}.}

Similarly, if we treat tt as a constant and differentiate FF with respect to ss, then the chain rule gives

Fs=Fxxs+Fyys.\boxed{\frac{\partial F}{\partial s} = \frac{\partial F}{\partial x} \frac{\partial x}{\partial s} + \frac{\partial F}{\partial y} \frac{\partial y}{\partial s}.}

You can use the chain diagram to remember the chain rules.
Chain diagram from F through x and y to both s and t, with partial derivatives on each path

Example. Suppose that z=F(x,y)z=F(x,y). Express the point (x,y)(x,y) in terms of polar coordinates (r,θ)(r,\theta). Hence express zr\dfrac{\partial z}{\partial r} and zθ\dfrac{\partial z}{\partial \theta} in terms of x,y,Fxx,y,F_x and FyF_y. Finally, show that partial derivatives satisfy the equation

rzr+zθ=(xy)Fx+(x+y)Fy.r\dfrac{\partial z}{\partial r}+\dfrac{\partial z}{\partial \theta} = (x-y)\dfrac{\partial F}{\partial x}+(x+y)\dfrac{\partial F}{\partial y}.

Polar coordinates are simply just x=rcosθx = r \cos{\theta} and y=rsinθy=r \sin{\theta}, meaning r2=x2+y2r^2=x^2+y^2, and we are givne z=F(x,y)z=F(x,y).
The chain rule gives

zr=zxxr+zyyr=Fx(x,y)cosθ+Fy(x,y)sinθ=xrFx(x,y)+yrFy(x,y)=xx2+y2Fx(x,y)+yx2+y2Fy(x,y)\begin{align*} \dfrac{\partial z}{\partial r}&=\dfrac{\partial z}{\partial x}\dfrac{\partial x}{\partial r} + \dfrac{\partial z}{\partial y}\dfrac{\partial y}{\partial r} \\ &= F_x(x,y)\cos{\theta} + F_y(x,y)\sin{\theta} \\ &= \frac{x}{r}F_x(x,y)+\frac{y}{r}F_y(x,y) \\ &= \frac{x}{\sqrt{x^2+y^2}}F_x(x,y)+\frac{y}{\sqrt{x^2+y^2}}F_y(x,y) \end{align*}

and

zθ=zxxθ+zyyθ=Fx(x,y)rsinθ+Fy(x,y)rcosθ=yFx(x,y)+xFy(x,y).\begin{align*} \frac{\partial z}{\partial \theta} &= \frac{\partial z}{\partial x} \frac{\partial x}{\partial \theta} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial \theta} \\ &= -F_x(x,y)r \sin{\theta} + F_y(x,y)r \cos{\theta} \\ &= -yF_x(x,y)+xF_y(x,y). \end{align*}

Finally,

rzr+zθ=r(xx2+y2Fx+yx2+y2Fy)+(yFx+xFy)=xFx+yFyyFx+xFy=(xy)Fx+(x+y)Fy.\begin{aligned}r\frac{\partial z}{\partial r} + \frac{\partial z}{\partial \theta} &= r\left(\frac{x}{\sqrt{x^2 + y^2}}\frac{\partial F}{\partial x} + \frac{y}{\sqrt{x^2 + y^2}}\frac{\partial F}{\partial y}\right) + \left(-y\frac{\partial F}{\partial x} + x\frac{\partial F}{\partial y}\right) \\ &= x\frac{\partial F}{\partial x} + y\frac{\partial F}{\partial y} - y\frac{\partial F}{\partial x} + x\frac{\partial F}{\partial y} \\ &= (x - y)\frac{\partial F}{\partial x} + (x + y)\frac{\partial F}{\partial y}.\end{aligned}

There is one more use case of the chain rule. Suppose FF is a function of uu and uu is a function of xx and yy. This is written as

F=F(u) and u=u(x,y).\begin{align*} &F=F(u) & \text{ and } && u=u(x,y). \end{align*}

The chain rules are then,

Fx=dFduux\boxed{\frac{\partial F}{\partial x}=\frac{d F}{d u}\frac{\partial u}{\partial x}}

and

Fy=dFduuy.\boxed{\frac{\partial F}{\partial y}=\frac{d F}{d u}\frac{\partial u}{\partial y}}.

The chain diagram can be seen as follows:
Chain diagram from F through u to x and y, labelled with dF/du, ∂u/∂x, and ∂u/∂y

Example. Suppose that ff is a differentiable function of a single variable and F(x,y)F(x,y) is defined by F(x,y)=f(x2y)F(x,y)=f(x^2-y).
(a) Show that FF satisfies the partial differential equation

Fx+2xFy=0.\frac{\partial F}{\partial x}+2x\frac{\partial F}{\partial y}=0.

(b) Given that F(0,y)=sinyF(0,y)=\sin{y} for all yy, find a formula for F(x,y)F(x,y).

(a) This is exactly the F=F(u)F=F(u), u=u(x,y)u=u(x,y) setup with u(x,y)=x2yu(x,y)=x^2-y. The chain rules give

Fx=dFduux=2xf(u),Fy=dFduuy=f(u).\begin{align*} \frac{\partial F}{\partial x}&=\frac{dF}{du}\frac{\partial u}{\partial x}=2xf'(u), \\ \frac{\partial F}{\partial y}&=\frac{dF}{du}\frac{\partial u}{\partial y}=-f'(u). \end{align*}

Substituting into the left hand side,

Fx+2xFy=2xf(u)+2x×(f(u))=0,\begin{align*} \frac{\partial F}{\partial x}+2x\frac{\partial F}{\partial y}&=2xf'(u)+2x\times(-f'(u)) \\ &=0, \end{align*}

no matter what ff actually is.
(b) Setting x=0x=0 gives F(0,y)=f(y)=sinyF(0,y)=f(-y)=\sin{y}. Substituting s=ys=-y (so y=sy=-s),

f(s)=sin(s)=sins.\begin{align*} f(s)&=\sin(-s) \\ &=-\sin{s}. \end{align*}

Therefore

F(x,y)=sin(x2y)=sin(yx2).F(x,y)=-\sin(x^2-y)=\sin(y-x^2).

It is worth double checking: F(0,y)=sinyF(0,y)=\sin{y}, and Fx=2xcos(yx2)F_x=-2x\cos(y-x^2) whilst Fy=cos(yx2)F_y=\cos(y-x^2), so Fx+2xFy=0F_x+2xF_y=0 as required. Questions like this look intimidating because ff is never specified, but (just like the mountain road example earlier) only the derivative is ever needed; write everything in terms of f(u)f'(u) and watch it cancel.

(1.6) Functions of more than two variables

It's sort of self-explanatory what this is abt.
Until now we have only discussed functions of two variables. In this section, the ideas met in this chapter are generalised to functions of three variables. We present a summary only.

Suppose that FF is a function of three variables xx, yy and zz. The partial derivatives of FF are defined by

Fx(x,y,z)=limh0F(x+h,y,z)F(x,y,z)hF_x(x, y, z) = \lim_{h \to 0} \frac{F(x + h, y, z) - F(x, y, z)}{h}

Fy(x,y,z)=limh0F(x,y+h,z)F(x,y,z)hF_y(x, y, z) = \lim_{h \to 0} \frac{F(x, y + h, z) - F(x, y, z)}{h}

Fz(x,y,z)=limh0F(x,y,z+h)F(x,y,z)hF_z(x, y, z) = \lim_{h \to 0} \frac{F(x, y, z + h) - F(x, y, z)}{h}

wherever these limits exist. Equivalent notation for each of these partial derivatives is given below:

Fx=Fx=D1F,Fy=Fy=D2F,andFz=Fz=D3F.F_x = \frac{\partial F}{\partial x} = D_1F, \qquad F_y = \frac{\partial F}{\partial y} = D_2F, \qquad \text{and} \qquad F_z = \frac{\partial F}{\partial z} = D_3F.

If (a,b,c)(a, b, c) is a point in R3\mathbb{R}^3 then Fx(a,b,c)F_x(a, b, c) is the rate of change of FF in the xx-direction at (a,b,c)(a, b, c). Similarly, Fz(a,b,c)F_z(a, b, c) is the rate of change of FF in the zz-direction at (a,b,c)(a, b, c).
The partial derivatives of FF are calculated by differentiating FF with respect to one variable and treating the other variables as constants. For example, if

F(x,y,z)=e2xzcosyF(x, y, z) = e^{2x}z \cos y

then

Fx(x,y,z)=2e2xzcosy,Fy(x,y,z)=e2xzsinyandFz(x,y,z)=e2xcosy.F_x(x, y, z) = 2e^{2x}z \cos y, \qquad F_y(x, y, z) = -e^{2x}z \sin y \qquad \text{and} \qquad F_z(x, y, z) = e^{2x}\cos y.

Tangent planes, total differential approximations and chain rule's are all basically how you'd expect them to be;

w=w0+Fx(x0,y0,z0)(xx0)+Fy(x0,y0,z0)(yy0)+Fz(x0,y0,z0)(zz0),w = w_0 + F_x(x_0, y_0, z_0)(x - x_0) + F_y(x_0, y_0, z_0)(y - y_0) + F_z(x_0, y_0, z_0)(z - z_0),

ΔFFxΔx+FyΔy+FzΔz,\Delta F \approx \frac{\partial F}{\partial x}\Delta x + \frac{\partial F}{\partial y}\Delta y + \frac{\partial F}{\partial z}\Delta z,

The chain rule for Fu\dfrac{\partial F}{\partial u} is given by

Fu=Fxxu+Fyyu+Fzzu,\frac{\partial F}{\partial u} = \frac{\partial F}{\partial x}\frac{\partial x}{\partial u} + \frac{\partial F}{\partial y}\frac{\partial y}{\partial u} + \frac{\partial F}{\partial z}\frac{\partial z}{\partial u},

while the chain rule for Fv\dfrac{\partial F}{\partial v} is given by

Fv=Fxxv+Fyyv+Fzzv.\frac{\partial F}{\partial v} = \frac{\partial F}{\partial x}\frac{\partial x}{\partial v} + \frac{\partial F}{\partial y}\frac{\partial y}{\partial v} + \frac{\partial F}{\partial z}\frac{\partial z}{\partial v}.

Chain diagram from F through x, y, and z to both u and v

Example. Use a chain rule to calculate dwdt\dfrac{dw}{dt} (as a function of tt) when

w=x2+y2+z2,x=cost,y=sint and z=t.\begin{align*} &w=x^2+y^2+z^2, &x=\cos{t}&, &y=\sin{t}& &\text{ and }& &z=t. \end{align*}

There are now three intermediate variables, so the chain diagram has three middle nodes and the chain rule picks up three terms:

dwdt=wxdxdt+wydydt+wzdzdt=2x×(sint)+2y×cost+2z×1=2costsint+2sintcost+2t=2t.\begin{align*} \frac{dw}{dt}&=\frac{\partial w}{\partial x}\frac{dx}{dt}+\frac{\partial w}{\partial y}\frac{dy}{dt}+\frac{\partial w}{\partial z}\frac{dz}{dt} \\ &=2x\times(-\sin{t})+2y\times\cos{t}+2z\times1 \\ &=-2\cos{t}\sin{t}+2\sin{t}\cos{t}+2t \\ &=2t. \end{align*}

Therefore dwdt=2t\dfrac{dw}{dt}=2t. We can sanity check by substituting first: w=cos2t+sin2t+t2=1+t2w=\cos^2{t}+\sin^2{t}+t^2=1+t^2, whose derivative is indeed 2t2t. Geometrically, the point (x,y,z)(x,y,z) spirals up a helix; the circular motion in xx and yy never changes the distance from the zz-axis, so the only contribution to ww comes from climbing in zz. This is also a reminder that when x(t)x(t), y(t)y(t) and z(t)z(t) are explicitly known, substituting first is sometimes faster than the chain rule; the chain rule becomes essential when only the rates (and not the formulas) are given.

Example. The sides of a rectangular box are measured with percentage errors of at most 1%, 2% and 3% respectively. Estimate the maximum percentage error in the calculated volume.
The log trick from 1.4 generalises to three variables with zero extra effort. Since V=xyzV=xyz,

lnV=lnx+lny+lnzΔVV=Δxx+Δyy+Δzz.\begin{align*} \ln{V}&=\ln{x}+\ln{y}+\ln{z} \\ \frac{\Delta V}{V}&=\frac{\Delta x}{x}+\frac{\Delta y}{y}+\frac{\Delta z}{z}. \end{align*}

Taking absolute values and using the triangle inequality,

ΔVVΔxx+Δyy+Δzz0.01+0.02+0.03=0.06.\begin{align*} \left|\frac{\Delta V}{V}\right| &\leq \left|\frac{\Delta x}{x}\right|+\left|\frac{\Delta y}{y}\right|+\left|\frac{\Delta z}{z}\right| \\ &\leq 0.01+0.02+0.03 \\ &=0.06. \end{align*}

Therefore the percentage error in the volume is at most about 6%. Since each side appears to the first power, the percentage errors simply add; if the formula were, say, V=x2yzV=x^2yz, the error in xx would count twice.