Section 14.4 (6th edition)

Example 1. Find the tangent plane to the surface f(x,y) = 2*x^2 + y^2 at (1,1)

f(x,y) := 2*x^2 + y^2;

f_x: diff(f(x,y), x);

a: f_x, x=1, y=1;

f_y: diff(f(x,y), y);

b: f_y, x=1, y=1;

z: a*(x-1) + b*(y-1) + f(1,1);

ratsimp(z);

draw3d(xlabel="X", ylabel="Y",
    color=blue, explicit(f(x,y),x,-2,4,y,-2,4),
    color=yellow, explicit(z,x,-2,4,y,-2,4),
    color=red, line_width=2, parametric(1+t,1,f(1,1)+a*t,t,-3,3),
    color=red, line_width=2, parametric(1,1+t,f(1,1)+b*t,t,-3,3),
    point_type=7, points([1],[1],[f(1,1)]),
    surface_hide = true);

Demonstration: What happens if the partial derivatives are not continuous?

f(x,y) := x*y/(x^2+y^2);

f_x: diff(f(x,y),x);

f_x, x=0, y=0;

f_y: diff(f(x,y),y);

f_y, x=0, y=0;

a: limit((f(h,0)-0)/h,h,0);

b: limit((f(0,h)-0)/h,h,0);

draw3d(xlabel="X", ylabel="Y",
    color=blue, explicit(f(x,y),x,-1,1,y,-1,1),
    color=red, line_width=2, parametric(t,0,0,t,-1,1),
    color=red, line_width=2, parametric(0,t,0,t,-1,1),
    point_type=7, points([0],[0],[0]),
    surface_hide = true);

What happens to the linear approximation around (0,0)?

z: a*x + b*y;

draw3d(xlabel="X", ylabel="Y",
    color=blue, explicit(f(x,y),x,-1,1,y,-1,1),
    color=yellow, explicit(z,x,-1,1,y,-1,1),
    color=red, line_width=2, parametric(t,0,0,t,-1,1),
    color=red, line_width=2, parametric(0,t,0,t,-1,1),
    point_type=7, points([0],[0],[0]),
    surface_hide = true);

Example 2. Find the tangent plane to the surface f(x,y) = x*exp(x*y) at (1,0)

f(x,y) := x*exp(x*y);

f_x: diff(f(x,y), x);

a: f_x, x=1, y=0;

f_y: diff(f(x,y), y);

b: f_y, x=1, y=0;

z: a*(x-1) + b*(y-0) + f(1,0);

draw3d(xlabel="X", ylabel="Y",
    color=blue, explicit(f(x,y),x,0,1.5,y,-1,1),
    color=yellow, explicit(z,x,0,1.5,y,-1,1),
    color=red, line_width=2, parametric(1+t,0,f(1,0)+a*t,t,-1,0.5),
    color=red, line_width=2, parametric(1,t,f(1,0)+b*t,t,-1,1),
    point_type=7, points([1],[0],[f(1,0)]),
    surface_hide = true);

Example 4. Find the total differential for z = x^2 + 3*x*y - y^2

f(x,y) := x^2 + 3*x*y - y^2;

diff(f(x,y),x);

diff(f(x,y),y);

diff(f(x,y));

*Exercise 2: Find the tangent plane to the surface
f(x,y) = 3*(x-1)^2 + 2*(y+3)^2 + 7 at x=2 and y=-2.

f(x,y):=3*(x-1)^2 + 2*(y+3)^2 + 7;

df: [diff(f(x,y),x), diff(f(x,y),y)];

[a,b]: df, x=2, y=-2;

solve(z - f(2,-2) = a*(x-2) + b*(y+2), z)[1];

*Exercise 14: Find the linearization of f(x,y) = sqrt(x+exp(4*y))
at x=3 and y=0

f(x,y) := sqrt(x+exp(4*y));

df: [diff(f(x,y),x), diff(f(x,y),y)];

[a,b]: df, x=3, y=0;

solve(z - f(3,0) = a*(x-3) + b*y, z)[1];

*Exercise 26: Find the differential of z = y*cos(x*y)

diff(y*cos(x*y));