Lesson 9 of 18

Tangent Plane

The Tangent Plane

Just as a tangent line approximates a 1D curve near a point, a tangent plane approximates a 2D surface near a point (x0,y0)(x_0, y_0):

L(x,y)=f(x0,y0)+fx(x0,y0)(xx0)+fy(x0,y0)(yy0)L(x, y) = f(x_0, y_0) + f_x(x_0, y_0)(x - x_0) + f_y(x_0, y_0)(y - y_0)

This is called the linear approximation or linearization of ff at (x0,y0)(x_0, y_0).

Why It Works

Near (x0,y0)(x_0, y_0), ff changes approximately linearly:

  • Moving Δx\Delta x in the xx-direction changes ff by fxΔx\approx f_x \cdot \Delta x
  • Moving Δy\Delta y in the yy-direction changes ff by fyΔy\approx f_y \cdot \Delta y

The tangent plane captures both effects simultaneously.

Error of Approximation

The error f(x,y)L(x,y)|f(x,y) - L(x,y)| is small near (x0,y0)(x_0, y_0) — it's O((x,y)(x0,y0)2)O(\|(x,y)-(x_0,y_0)\|^2) for smooth functions.

Examples

For f(x,y)=x2+y2f(x,y) = x^2 + y^2 at (1,2)(1, 2):

  • fx=2f_x = 2, fy=4f_y = 4, f(1,2)=5f(1,2) = 5
  • L(x,y)=5+2(x1)+4(y2)L(x,y) = 5 + 2(x-1) + 4(y-2)
  • L(1.1,  2.1)5+0.2+0.4=5.6L(1.1,\; 2.1) \approx 5 + 0.2 + 0.4 = 5.6 (exact: 1.21+4.41=5.621.21+4.41=5.62)

Your Task

Implement double tangent_plane(double (*f)(double, double), double x0, double y0, double x, double y, double h) that evaluates the linear approximation L(x,y)L(x, y) at the given (x,y)(x, y) point, using partial derivatives computed with step size hh.

TCC compiler loading...
Loading...
Click "Run" to execute your code.