Tangent Planes Illustrated

Purpose:  This notebook provides a simple example of how to illustrate tangent planes to surfaces of the form z = f(x,y).
Developer:  Lt Col Steve Hadfield, US Air Force Academy, CO
File Name:  Tangent_Plane.nb
This notebook is stored without output to save on storage and download time, so use Kernel|Evaluation|Evaluate Notebook to reproduce the output.

Define the function and the tangent plane

The cell below is used to define the function for the surface (z=f(x,y)) and then the tangent plane to the surface at the point (xp, yp).

Clear[f, x, y,  fx, fy, xp, yp];
xp = 1;
yp = 2;
f[x_, y_] =  x^2 +  y^2;
fx[x_, y_] = D[f[x, y], x];
fy[x_, y_] = D[f[x, y], y];
T[x_, y_] := 
      f[xp, yp] + fx[xp, yp] (x - xp) + 
        fy[xp, yp] (y - yp)
T[x, y]

The next cell plots the surface function and the tangent plane and then shows them on the same plot.

Clear[a, b];
a = Plot3D[f[x, y], {x, 0, 2}, {y, 0, 4}]
b = Plot3D[T[x, y], {x, 0, 2}, {y, 0, 4}]
Show[a, b, ViewPoint -> {3.130,  0.970,  0.845}, 
      AspectRatio -> 1, 
      AxesLabel -> {"x", "y", "f(x,y)"}]