Free preview

189 lessons

Essential Calculus for ML

Free preview

Essential Calculus for ML · 189 lessons

Master the fundamentals

No surprise gaps

Actually remember it

Skip what you know

One subscription. All learning paths included.

Our content is best on a larger screen

Tangent planes and linear approximation

The tangent plane to a surface

Explanation

A curve has one slope at a point, and the tangent line there has the curve's height and that slope. A surface z=f(x,y)z = f(x,y) has a cross-section through a point in each input direction, so matching the surface at that point requires a height and two slopes.

The diagram below builds this plane step by step.

x
y
z

Step 1: The point on the surface

The surface z=x2+2y2 has height f(1,1)=3 above (1,1), so it passes through the point (1,1,3).

Drag the scene to rotate it.

Step 2: The cross-section at y=1

The grey plane y=1 cuts the surface in the curve z=x2+2. The slope of its tangent line at the point is

fx(1,1)=2

Drag the scene to rotate it.

Step 3: The cross-section at x=1

The grey plane x=1 cuts the surface in the curve z=1+2y2. The slope of its tangent line at the point is

fy(1,1)=4

Drag the scene to rotate it.

Step 4: The plane through both tangent lines

The plane containing both tangent lines passes through (1,1,3) with slope 2 in the x-direction and slope 4 in the y-direction. In point-slope form it is

z=3+2(x−1)+4(y−1)

Drag the scene to rotate it.

Tangent plane

Definition

The tangent plane to z=f(x,y)z = f(x,y) at (a,b)(a,b) is the plane containing the tangent lines to the cross-sections x=ax = a and y=by = b through the point (a,b,f(a,b))(a, b, f(a,b)).

Equation of the tangent plane

Theorem

The tangent plane to z=f(x,y)z = f(x,y) at (a,b)(a,b) has equation

z=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b).z = f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b).

This is the point-slope form of a plane: the surface's height at the point, plus one slope term for each input direction.

Example

For f(x,y)=xy2+3yf(x,y) = xy^2 + 3y, write the equation of the tangent plane at (1,2)(1,2).

Solution

We need three numbers at (1,2)(1,2): the height f(1,2)f(1,2), and the two cross-section slopes fx(1,2)f_x(1,2) and fy(1,2)f_y(1,2).

For the height we evaluate ff at the point:

f(1,2)=1(2)2+3(2)=10.\begin{align*} f(1,2) &= 1(2)^2 + 3(2) \\ &= 10. \end{align*}

Holding yy fixed we find fx=y2f_x = y^2, and we substitute the point:

fx(1,2)=22=4.\begin{align*} f_x(1,2) &= 2^2 \\ &= 4. \end{align*}

Holding xx fixed we find fy=2xy+3f_y = 2xy + 3, and we substitute the point again:

fy(1,2)=2(1)(2)+3=7.\begin{align*} f_y(1,2) &= 2(1)(2) + 3 \\ &= 7. \end{align*}

With a=1a = 1 and b=2b = 2, we substitute the three numbers into

z=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b)z = f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b)

to get

z=10+4(x−1)+7(y−2).z = 10 + 4(x-1) + 7(y-2).

Practice questions

4 questions

A function ff of two variables has f(−1,4)=5f(-1,4) = 5, fx(−1,4)=−3f_x(-1,4) = -3 and fy(−1,4)=2f_y(-1,4) = 2. Write the equation of the tangent plane to z=f(x,y)z = f(x,y) at (−1,4)(-1,4).

Select the correct answer:

+ 3 more questions

Linear approximation in two variables

Explanation

Near a point where ff is differentiable, the graph of a function of one variable lies very close to its tangent line. In the same way, near (a,b)(a,b) the surface z=f(x,y)z = f(x,y) lies very close to its tangent plane. A plane's height takes only a few multiplications and additions to evaluate, so near (a,b)(a,b) we can work with the tangent plane in place of ff.

The diagram below zooms in on a point of a surface and its tangent plane.

x
y
z
0
1
1
2
2

The surface z=x2+2y2 and its tangent plane at the point (1,1,3). Drag the slider to zoom in on the point: close to (1,1), the surface flattens onto the plane.

Largest gap between the surface and the plane in view: 3.002.742.502.282.081.891.731.571.441.311.191.090.9930.9060.8260.7540.6870.6270.5720.5210.4750.4340.3950.3610.3290.3000.2740.2500.2280.2080.1890.1730.1570.1440.1310.1190.1090.09930.09060.08260.07540.06870.06270.05720.05210.04750.04340.03950.03610.03290.03000.02740.02500.02280.02080.01890.01730.01570.01440.01310.01190.01090.009930.009060.008260.007540.006870.006270.005720.005210.004750.004340.003950.003610.003290.003000.002740.002500.002280.002080.001890.001730.001570.001440.001310.001190.001090.0009930.0009060.0008260.0007540.0006870.0006270.0005720.0005210.0004750.0004340.0003950.0003610.0003290.0003003.002.742.502.282.081.891.731.571.441.311.191.090.9930.9060.8260.7540.6870.6270.5720.5210.4750.4340.3950.3610.3290.3000.2740.2500.2280.2080.1890.1730.1570.1440.1310.1190.1090.09930.09060.08260.07540.06870.06270.05720.05210.04750.04340.03950.03610.03290.03000.02740.02500.02280.02080.01890.01730.01570.01440.01310.01190.01090.009930.009060.008260.007540.006870.006270.005720.005210.004750.004340.003950.003610.003290.003000.002740.002500.002280.002080.001890.001730.001570.001440.001310.001190.001090.0009930.0009060.0008260.0007540.0006870.0006270.0005720.0005210.0004750.0004340.0003950.0003610.0003290.000300

Drag the scene to rotate it.

The tangent plane's equation gives its height at every point (x,y)(x,y). Read as a function of (x,y)(x,y), it is the linearisation.

The linearisation of ff at (a,b)(a,b)

Definition

The linearisation of ff at (a,b)(a,b) is the function giving the tangent plane's height,

L(x,y)=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b).L(x,y) = f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b).

For (x,y)(x,y) near (a,b)(a,b), f(x,y)≈L(x,y)f(x,y) \approx L(x,y).

We estimate a value of ff in three steps, as with one input.

Estimating f(x,y)f(x,y) by linear approximation

Procedure

  1. Take a point (a,b)(a,b) near (x,y)(x,y) where f(a,b)f(a,b), fx(a,b)f_x(a,b) and fy(a,b)f_y(a,b) are known exactly.
  2. Build the linearisation L(x,y)=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b)L(x,y) = f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b).
  3. Evaluate LL at (x,y)(x,y), which gives the estimate f(x,y)≈L(x,y)f(x,y) \approx L(x,y).

The estimate is exact at (a,b)(a,b), since L(a,b)=f(a,b)L(a,b) = f(a,b), and near (a,b)(a,b) it usually gets worse as (x,y)(x,y) moves further away.

Example

For f(x,y)=x3+xy2f(x,y) = x^3 + xy^2, estimate f(2.02,0.97)f(2.02, 0.97) using the linearisation at (2,1)(2,1), then compare the estimate with the true value.

Solution

We start with the height at the base point:

f(2,1)=23+2(1)2=10.\begin{align*} f(2,1) &= 2^3 + 2(1)^2 \\ &= 10. \end{align*}

Holding yy fixed we find fx=3x2+y2f_x = 3x^2 + y^2, and holding xx fixed we find fy=2xyf_y = 2xy. At the base point:

fx(2,1)=3(2)2+12=13,fy(2,1)=2(2)(1)=4.\begin{align*} f_x(2,1) &= 3(2)^2 + 1^2 = 13, \\ f_y(2,1) &= 2(2)(1) = 4. \end{align*}

With a=2a = 2 and b=1b = 1, we assemble those three numbers into the linearisation:

L(x,y)=10+13(x−2)+4(y−1).L(x,y) = 10 + 13(x-2) + 4(y-1).

Substituting (2.02,0.97)(2.02, 0.97) into LL:

L(2.02,0.97)=10+13(2.02−2)+4(0.97−1)=10+13(0.02)+4(−0.03)=10+0.26−0.12=10.14.\begin{align*} L(2.02, 0.97) &= 10 + 13(2.02 - 2) + 4(0.97 - 1) \\ &= 10 + 13(0.02) + 4(-0.03) \\ &= 10 + 0.26 - 0.12 \\ &= 10.14. \end{align*}

So f(2.02,0.97)≈10.14f(2.02, 0.97) \approx 10.14.

To compare, a calculator gives f(2.02,0.97)=10.14303f(2.02, 0.97) = 10.14303 to five decimal places. Our estimate differs from the true value by about 0.0030.003, at a point only 0.020.02 and 0.030.03 away from (2,1)(2,1) in the two inputs.

Practice questions

4 questions

For f(x,y)=x2yf(x,y) = x^2y, estimate f(1.98,3.01)f(1.98, 3.01) working from the point (2,3)(2,3).

Select the correct answer:

+ 3 more questions