Implicit Differentiation

Implicit Differentiation
Drawing Curves
In addition to plotting regular functions, Mathematica can also plot curves that are described by a relation. For instance a circle
of radius 4 centered at (2,-3) is given by the equation Hx - 2L2 + Hx + 3L2 = 16. To plot this circle we could use the ContourPlot
command.
ContourPlot@Hx - 2L ^ 2 + Hy + 3L ^ 2 == 16, 8x, - 10, 10<, 8y, - 10, 10<, Axes ® TrueD
10
5
0
-5
-10
-10
-5
0
5
10
The parts of the command are ContourPlot[ equation, {x, xmin, xmax}, {y, ymin, ymax}], where your equation must use the
double equal sign and xmin and xmax are the values of the horizontal axis you would like displayed (similarly for the y values).
The extra command Axes->True just sets the axes to be the standard axes, otherwise no axes are plotted.
Another example is the curve 2 x ^ 3 + x2 y - xy3 =2
2
Implicit.nb
ContourPlot@2 x ^ 3 + x ^ 2 y - x * y ^ 3 Š 2, 8x, - 5, 5<, 8y, - 5, 5<, Axes ® TrueD
4
2
0
-2
-4
-4
-2
0
2
4
Implicit Differentiation
2
In class we talked about the graph of a lemniscate. Here the equation is 2 Ix2 + y2 M = 25 Ix2 - y2 M.
Implicit.nb
3
ContourPlot@2 Hx ^ 2 + y ^ 2L ^ 2 == 25 Hx ^ 2 - y ^ 2L,
8x, - 5, 5<, 8y, - 5, 5<, Axes ® TrueD
4
2
0
-2
-4
-4
-2
0
2
4
Suppose I want to compute the tangent line at the point (3,1). You should first check to see that (3,1) is actually on the curve. It
is since
2 H3 ^ 2 + 1 ^ 2L ^ 2 = 200 = 25 I32 - 12 M
Below is a graph of the lemniscate again with the point (3,1) plotted in red.
4
Implicit.nb
Show@ContourPlot@2 Hx ^ 2 + y ^ 2L ^ 2 == 25 Hx ^ 2 - y ^ 2L,
8x, - 5, 5<, 8y, - 5, 5<, Axes ® TrueD,
ListPlot@883, 1<<, PlotStyle ® Directive@PointSize@LargeD, RedDDD
4
2
0
-2
-4
-4
0
-2
2
4
2
Now to calculate the equation for the tangent line I must first differentiate the equation 2 Ix2 + y2 M = 25 Ix2 - y2 M implicitly.
2
d
B2 Ix2 + y2 M F =
dx
d
Ax2
dx
4 Ix2 + y2 M
d
A25 Ix2
dz
2
dy
dx
2
8 xIx + y M + 8 yIx +
2
2
I8 yIx + y M + 50 yM
dy
dx
2
=
dy
+ y2 E = 25 J2 x - 2 y
4 Ix2 + y2 M J2 x + 2 y
2
- y2 ME
dy
dx
N = 50 x - 50 y
dy
y2 M dx
N
dx
dy
dx
= 50 x - 50 y
2
dy
dx
2
= 50 x - 8 xIx + y M
2
xI50-8 x -8 y M
yI50+8 x2 +8 y2 M
This is an implicit formula for dy/dx and we can then plug in (3,1) into the formula to find a value of the slope at this point.
dy
dx
=
H3 H50 - 8 H9L - 8 H1LLL
H1 H50 + 8 H9L + 8 H1LLL
=
3 H-30L
130
= -9  13
So the slope of the tangent at (3,1) is -9/13
We then can find the equation of the tangent line as (y-1)=-(9/13)(x-3). Or y=-9x/13+40/13. We can then use show to plot the
tangent line on the graph to check we did it correctly.
Implicit.nb
5
Show@ContourPlot@2 Hx ^ 2 + y ^ 2L ^ 2 == 25 Hx ^ 2 - y ^ 2L,
8x, - 5, 5<, 8y, - 5, 5<, Axes ® TrueD,
ListPlot@883, 1<<, PlotStyle ® Directive@PointSize@LargeD, RedDD,
Plot@- 9 x  13 + 40  13, 8x, - 5, 5<, PlotStyle ® 8Red, Dashed<DD
4
2
0
-2
-4
-4
-2
0
2
4
Another way we could do this is to let Mathematica do the differentiation for us. Lets go back to our example of
3 x3 + x2 y - xy3 = 2. You can take the derivative of this by using the D command, but you must replace y with y[x] (basically
you are telling Mathematica to think of y as a function rather then a constant).
D@2 x ^ 3 + x ^ 2 y@xD x - x * y@xD ^ 3 Š 2, xD
6 x2 + 3 x2 y@xD - y@xD3 + x3 y¢ @xD - 3 x y@xD2 y¢ @xD Š 0
Once you have done this you now tell Mathematica to take the expression it calculated and solve for y’[x], Solve [equation you
want to solve, variable you want to solve for].
SolveA6 x2 + 3 x2 y@xD - y@xD3 + x3 y¢ @xD - 3 x y@xD2 y¢ @xD Š 0, y '@xDE
::y¢ @xD ®
- 6 x2 - 3 x2 y@xD + y@xD3
>>
x Ix2 - 3 y@xD2 M
If you want to find the slope at a point you can copy this over so its a little easier to use. The command /.y[x]->y means replace
y[x] with y. I called this new function yprime[x_, y_] since it is an implicit formula that depends on both x and y.
6
Implicit.nb
- 6 x2 - 3 x2 y@xD + y@xD3
yprime@x_, y_D =
. y@xD ® y
x Ix2 - 3 y@xD2 M
- 6 x2 - 3 x2 y + y3
x Ix2 - 3 y2 M
This then evaluates yprime or y’when x=1 and y=0.
yprime@1, 0D
-6
Thus our tangent line must be given by (y-0)=6(x-1) or y=6x-6. If you recall we did this example by hand in class and got the
same result. Below I have plotted the curve along with the tangent line we just computed.
Show@ContourPlot@2 x ^ 3 + x ^ 2 y - x * y ^ 3 Š 2, 8x, - 5, 5<, 8y, - 5, 5<,
Axes ® TrueD, Plot@- 6 x + 6, 8x, - 3, 3<, PlotStyle ® 8Dashed, Red<DD
4
2
0
-2
-4
-4
-2
0
2
4