Mathematica Labs | Denis Shubleka

Subject: Calculus

Topic: Partial Derivatives, Tangent Planes

Goal: Use Mathematica to differentiate functions in several variables and find the equation of a tangent plane.

Task 1

In Mathematica we define a real-valued function in two variables:

f[x_,y_]:=Cos[x^2]+Sin[x*y];

Or more conveniently:

Clear[f,x,y];
f=Cos[x^2]+Sin[x*y];

To differentiate f(x,y) with respect to x, we can use the (∂/(∂□)) from the Basic Math Assistant palette, or type and execute:

D[f,x]

As always, if the answer needs simplification, use the Simplify command:

Simplify[%]

If you need to differentiate the first partial derivative with respect y (or x again), simply refer to the previous answer:

D[%, y]

For higher order partial derivatives, we can also use the following command, which takes the third derivative in the direction of x:

D[f, {x,3}]

To evaluate a certain derivative at a particular point, use the replacement rule as shown below:

% /.{x->0, y->1}

Task 2

The equation of the tangent plane to a surface z= f(x, y) at a point (a, b) is given by L(x,y)=f(a,b)+(Subscript[f, x])(a,b)(x-a)+(Subscript[f, y])(a,b)(y-b).

Use Mathematica to find the equation of the plane tangent f(x,y)= (x^2)+ (y^2) at (1, 1, 2). Plot the original surface and the plane in the same window to verify your work. After defining f(x,y) as a function, we compute the partial derivatives slopex and slopey at the given point, and then plot the tangent plane and the surface in the same viewing box:

Clear[x,y,f]
f[x_,y_]:=x^2+y^2;

slopex=D[f,x]/.{x->1,y->1}

slopey= D[f,y]/.{x->1,y->1}

Plot3D[{f[x,y],f[1,1]+slopex*(x-1)+slopey(y-1)},{x,-5,5},{y,-5,5}]

Related Exercises/Notes:

1. Find an equation of the tangent plane to the given surface at the given point. Verify your work with Mathematica.

f(x,y)=(2^(sin(y)))-(x^2)        (3, π, -8)

ap-calc.github.io