# Find the tangent plane to the surface in Mathematica

1. Oct 18, 2005

### Logistics

Hey guys I have just started learning mathematica and I was wandering if someone could confirm if I did the following correct:

Question:

Find the tangent plane to the surface z = 2x^2 -y^2 at the point (2,1). Plot the tangent plane and the surface on the same graph. Change th eviewpoint to show the tangent plane clearly.

Solution:

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

Clear[G1, G2];
G1 = Plot3D[f[x, y], {x, -2, 10}, {y, -4, 4}]
G2 = Plot3D[T[x, y], {x, -2, 10}, {y, -4, 4}]
Show[G1, G2, ViewPoint -> {0, -2, 0.3}, AspectRatio -> 1, AxesLabel -> {"x", "y", "f(x,y)"}]

2. Oct 19, 2005

### Logistics

anyone able to confirm if it's correct?

3. Oct 19, 2005

### vanesch

Staff Emeritus
I tried it and it looks ok ; the code also looks ok...