DerivImplicit.mws

Implicit Differentiation

>    restart;
with( plots ):
with( Student[Calculus1] ):

Warning, the name changecoords has been redefined

>   

Lesson Overview

Many interesting curves cannot be given in an explicit form

  y = f(x)  

but can be given in implicit form

  F(x,y) = 0 .

We know the slope of the tangent line to a curve at a point is m = dy/dx  and are now comfortable finding dy/dx = `f '`(x)  for explicit functions. Implicit differentiation is a technique that can be used to find dy/dx  when the function is given implicitly.

As this is really an application of the derivative, this lesson consists primarily of examples. The first example looks at a circle from both an explicit and an implicit formulation. The second example looks at a truly implicit function, the Folium of Descartes. The last example extends the Power Rule to all rational exponents.

The TangentLinePlot  maplet [ Maplet Viewer][ MapleNet] can be used to assist with the visualization of tangent lines to the graph of an implicitly defined function.

>   

Example 1: Tangent Lines for a Circle

The circle centered at the origin with radius 3 can be described as the set of all points that satisfy

>    q1 := x^2 + y^2 = 9:
q1;

x^2+y^2 = 9

 Let x  be a number with -3 < x  < 3. Because both y = sqrt(9-x^2)  and y = -sqrt(9-x^2)  are on the graph of the circle this is not a function.

>    implicitplot( q1, x=-4..4, y=-4..4, title="The circle x^2+y^2=9" );

[Maple Plot]

To find the slope of the tangent line to the circle at a point ( x , y  ) on the circle, requires us to find dy/dx = limit(Delta*y/(Delta*x),Delta*x = 0) . The idea behind implicit differentiation is to think of the equation of the circle implicitly defining y  as a function of x . That means we need to replace all occurrences of y with y( x ):

>    yimpl := y=y(x):
yexpl := y(x)=y:
q2 := eval( q1, yimpl );

q2 := x^2+y(x)^2 = 9

Now, if both sides of the equation are differentiated with respect to x :

>    q3 := diff( q2, x ):
q3;

2*x+2*y(x)*diff(y(x),x) = 0

Note the use of the Chain Rule to compute diff(y(x)^2,x) = 2*y(x)*diff(y(x),x) .

It is now a simple matter to solve for the derivative

>    q4 := isolate( q3, diff(y(x),x) ):
q4;

diff(y(x),x) = -x/y(x)

To put this result back in a form consistent with the original equation, replace all occurrences of y(x)  with y :

>    q5 := dy/dx = eval( rhs(q4), yexpl );

q5 := dy/dx = -x/y

For example, the slope of the tangent line to this circle at the point ( 2, sqrt(5)  ) is

>    eval( q5, [x=2,y=sqrt(5)] );

dy/dx = -2/5*5^(1/2)

while at the point ( 2, -sqrt(5)  ) the slope of the tangent line to the circle is

>    eval( q5, [x=2,y=-sqrt(5)] );

dy/dx = 2/5*5^(1/2)

What other methods could we use to find these slopes?

The top and bottom of the circle are, separately, graphs of functions:

>    eq[top] :=  sqrt( 9 - x^2 ):
eq[bot] := -sqrt( 9 - x^2 ):
y[top] = eq[top];
y[bot] = eq[bot];

y[top] = (9-x^2)^(1/2)

y[bot] = -(9-x^2)^(1/2)

The slope at points on the top or bottom half of the plot can be found by differentiating these expressions. Unfortunately, we do not yet know how to differentiate the square root function. (At present the Power Rule only applies when the exponent is an integer.) But, letting Maple compute these derivatives for us, the slope of the tangent line at a point on the top half of the circle is found to be

>    d1 := diff( eq[top], x ):
dy/dx = d1;

dy/dx = -1/(9-x^2)^(1/2)*x

The correctness of this result can be checked by using the general formula for the slope of the tangent line and the equation for the top of the circle:

>    eval( q5, y=eq[top] );

dy/dx = -1/(9-x^2)^(1/2)*x

Likewise, the slope of the tangent line at a point on the bottom half of the circle is

>    d2 := diff( eq[bot], x ):
dy/dx = d2;

dy/dx = 1/(9-x^2)^(1/2)*x

which agrees with the result from implicit differentiation:

>    eval( q5, y=eq[bot] );

dy/dx = 1/(9-x^2)^(1/2)*x

>   

The formula for dy/dx  obtained above is defined only if y <> 0 . This makes sense because y = 0  when x = 3  or x = -3  and at these points the tangent lines are vertical. These features, together with the two tangent lines to the circle at points with x = 2 , are evident in the following plot.

>    p1 := Tangent( eq[top], x=2, -4..4, output=plot,
               functionoptions=[color=red, legend=["Top of circle"]],
               tangentoptions=[color=gold,legend="Tangent to top of circle at x=2"] ):
p2 := Tangent( eq[bot], x=2, -4..4, output=plot,
               functionoptions=[color=blue, legend=["Bottom of circle"]],
               tangentoptions=[color=green,legend="Tangent to bottom of circle at x=2"] ):
display( [p1,p2], view=[-4..4,-4..4], title="The two tangent lines\n at x=2 for the circle\n x^2+y^2=9" );

[Maple Plot]

>   

Example 2: Folium of Descartes

The general form for the Foliumm of Descartes is the implicit equation

>    r1 := x^3 + y^3 = 3*a*x*y;

r1 := x^3+y^3 = 3*a*x*y

where a  is a parameter.

Visualizing the Folium of Descartes

Before analyzing these curves it will help to have an idea what these curves look like. The following animation shows plots of the Folium of Descartes for integer values of a  from -3 to 3.

>    Pfd := [seq( implicitplot( r1, x=-6..6, y=-6..6, numpoints=2000,
                           title=sprintf("Folium of Descartes: a=%a",a) ),
             a=-3..3 )]:

>    display( Pfd, insequence=true );

[Maple Plot]

For a = 0  the Folium degenerates to the line y = -x . For all a <> 0  the curves are more interesting. In particular, there are regions where there are three points on the curve for a single value of x . (This is to be expected because every cubic equation with real-valued coefficients has three real or complex roots --- and complex roots appear in conjugate pairs.)

Finding Slope by Implicit Differentiation

Implicit differentiation will be used to find the slope of the tangent line at each point on the Folium of Descartes.

>    r2 := eval( r1, yimpl ):
r2;

x^3+y(x)^3 = 3*a*x*y(x)

>    r3 := diff( r2, x ):
r3;

3*x^2+3*y(x)^2*diff(y(x),x) = 3*a*y(x)+3*a*x*diff(y(x),x)

>    r4 := simplify(isolate( r3, diff(y(x),x) )):
r4;

diff(y(x),x) = (x^2-a*y(x))/(-y(x)^2+a*x)

>    r5 := dy/dx = eval(rhs(r4),yexpl):
r5;

dy/dx = (x^2-a*y)/(-y^2+a*x)

Points on Curve with Horizontal Tangents

This information can be used to identify some special points on these curves. For example, the tangent line to the curve is horizontal at points on the curve where the slope is zero, i.e., points ( x , y  ) that satisfy both

>    r1;
r6 := numer( rhs(r5) ) = 0:
r6;

x^3+y^3 = 3*a*x*y

x^2-a*y = 0

Maple reports the solutions to this pair of equations as

>    r7 := [solve( {r1,r6}, {x,y} )];

r7 := [{y = 0, x = 0}, {y = RootOf(_Z^3-2,label = _L1)^2*a, x = RootOf(_Z^3-2,label = _L1)*a}]

The RootOf  notation is Maple's way of concisely listing all real and complex roots of a polynomial. We can force the expansion to full solutions with the allvalues  command:

>    r8 := map(allvalues,r7);

r8 := [{y = 0, x = 0}, {y = 2^(2/3)*a, x = 2^(1/3)*a}, {x = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))*a, y = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))^2*a}, {y = (-1/2*2^(1/3)-1/2*I*3^(1/2)*2^(1/3))^2*a, x = (-1...
r8 := [{y = 0, x = 0}, {y = 2^(2/3)*a, x = 2^(1/3)*a}, {x = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))*a, y = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))^2*a}, {y = (-1/2*2^(1/3)-1/2*I*3^(1/2)*2^(1/3))^2*a, x = (-1...
r8 := [{y = 0, x = 0}, {y = 2^(2/3)*a, x = 2^(1/3)*a}, {x = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))*a, y = (-1/2*2^(1/3)+1/2*I*3^(1/2)*2^(1/3))^2*a}, {y = (-1/2*2^(1/3)-1/2*I*3^(1/2)*2^(1/3))^2*a, x = (-1...

Only the real-valued solutions are of interest to us so we remove  all solutions that have an imaginary part:

>    r9 := remove( has, evalc(r8), I );

r9 := [{y = 0, x = 0}, {y = 2^(2/3)*a, x = 2^(1/3)*a}]

This leaves, for each value of a <> 0 , two points with horizontal tangents:

>    seq( eval( [x,y], S ), S=r9 );

[0, 0], [2^(1/3)*a, 2^(2/3)*a]

Points on Curve with Vertical Tangents

By the same reasoning, the slope of the tangent line to the curve is undefined at points that satisfy the two conditions

>    r1;
r10 := denom(rhs(r5)) = 0:
r10;

x^3+y^3 = 3*a*x*y

-y^2+a*x = 0

The real-valued solutions to this system are found to be:

>    r11 := [solve( {r1,r10}, {x,y} )]:

>    r12 := map(allvalues,r11):

>    r13 := remove( has, evalc(r12), I ):

>    seq( eval( [x,y], S ), S=r13 );

[0, 0], [2^(2/3)*a, 2^(1/3)*a]

Note that the origin has both a horizontal and a vertical tangent line and that the other points are symmetric about the line y = x . (A closer look at the original equation and the formula for the slope explains why this - and other symmetries - are to be expected.).

Points on Curve with dy/dx = 1  

Points where the slope of the tangent line is 1 are solutions to

>    r1;
r14 := rhs(r5) = 1:
r14;

x^3+y^3 = 3*a*x*y

(x^2-a*y)/(-y^2+a*x) = 1

The real-valued solutions to this system are found to be:

>    r15 := [solve( {r1,r14}, {x,y} )]:

>    r16 := map(allvalues,r15):

>    r17 := remove( has, evalc(r16), I ):

>    seq( eval( [x,y], S ), S=r17 );

[(1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))*a*((1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))^2+1-1/2*3^(1/2)-1/2*(-3+2*3^(1/2))^(1/2))/(3^(1/2)+(-3+2*3^(1/2))^(1/2)-1+(1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))^2), (1...
[(1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))*a*((1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))^2+1-1/2*3^(1/2)-1/2*(-3+2*3^(1/2))^(1/2))/(3^(1/2)+(-3+2*3^(1/2))^(1/2)-1+(1/2*3^(1/2)+1/2*(-3+2*3^(1/2))^(1/2))^2), (1...

or, with floating-point approximations to the square roots

>    seq( eval( [x,y], evalf(S) ), S=r17 );

[.5254003850*a, 1.206650424*a], [1.206650423*a, .5254003844*a]

Again, note the symmetry in these solutions. Note also that these solutions are not correct for a = 0 . That there are no points on the graph with slope 1 when a = 0  can be seen from the frame in the animation with a = 0  as well as from Maple's response to the following command.

>    [solve( eval( {r1,r14}, a=0 ), {x,y} )];

[]

Concluding Comment: Explicit form for Folium of Descartes

At the beginning of this example it was implied that it is not possible to find an explicit representation for the Folium of Descartes. While it is true that each Folium is not the graph of a function, it is possible to find an explicit formula for each segment of the curve.

>    r18 := [solve( r1, {y} )]:
for S in r18 do
  print( "***********************************************************************" );
  op(S)
end do;

y = 1/2*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)+2*a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)

y = -1/4*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)+1/2*I*3^(1/2)*(1/2*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-2*a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3))
y = -1/4*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)+1/2*I*3^(1/2)*(1/2*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-2*a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3))

y = -1/4*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-1/2*I*3^(1/2)*(1/2*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-2*a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3))
y = -1/4*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-1/2*I*3^(1/2)*(1/2*(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3)-2*a*x/(-4*x^3+4*(-4*x^3*a^3+x^6)^(1/2))^(1/3))

The first of the three solutions is always real-valued. The other two solutions are either real-valued or complex conjugates; when they are real-valued the Folium has three points for a single value of x . and when they are complex conjugates there is only one point on the curve for each value of x ; and at the transition between these states -- the unique value of x  with two point on the curve -- these two solutions reduce to a single repeated solution.

Even if we could decide which of these three formulae to use, the derivatives would be prohibitively complicated. By comparison, these computation by implicit differentiation was almost effortless.

>   

Example 3: The Power Rule for Rational Exponents

In Example 1 we were unable to find the slope of the tangent line to a point on the top or bottom of a circle because we did not know how to differentiate the square root function. While we could have derived this result for the square root function using the definition of the derivative, it is much more efficient and useful to handle all rational exponents simultaneously. In this example implicit differentiation will be used to show the Power Rule applies for all rational exponents. That is, if n = p/q  with p  and q  integers and q <> 0 , then

  diff(x^n,x) = n*x^(n-1)  .

The key is to convert the explicit form

>    s1 := y = x^n:
s1;

y = x^n

to the implicit representation with integer exponents

>    s2 := y^q = x^p:
s2;

y^q = x^p

To prepare for implicit differentiation, remind ourselves (and Maple) that y = y(x) :

>    s3 := eval( s2, yimpl ):
s3;

y(x)^q = x^p

Differentiation of both sides of the equation with respect to x  yields

>    s4 := diff( s3, x ):
s4;

y(x)^q*q*diff(y(x),x)/y(x) = x^p*p/x

Thus,

>    s5 := isolate( s4, diff( y(x), x ) ):
s6 := dy/dx = simplify( eval(rhs(s5),yexpl) ) assuming p::integer, q::integer;

s6 := dy/dx = x^(p-1)*p*y^(-q+1)/q

We would like to express this derivative explicitly in terms of x . The explicit relationship y = x^n  with n = p/q  (so p = n*q ) allow the derivative to be rewritten as

>    qs := simplify( eval( s6, [s1,p=n*q] ) ) assuming q::integer:
qs;

dy/dx = x^(-1+n)*n

This concludes the proof that the Power Rule applies for all rational exponents.

>   

Lesson Summary

Given an implicitly defined function, F(x,y) = 0 , implicit differentiation is a technique for finding the slope of the tangent line to the curve, m = dy/dx . The key to successfully using implicit differentiation is to remember that one variable is implicitly defined in terms of the other, usually y = y(x) , and that differentiation of any term involving y = y(x)  with respect to x  will automatically involve the Chain Rule.

An expression for dy/dx  obtained by implicit differentiation will typically involve both x  and y . Examples 1 and 2 demonstrate how this form for the derivative can be used effectively. The final example extends the Power Rule from integer to rational exponents. Implicit differentiation will be used in the Related Rates lesson.

>   

What's Next?

The online homework assignment includes a collection of practice problems that have been formulated to further your ability to successfully apply implicit differentiation. After you are comfortable with implicit differentiation, complete the textbook homework assignment related to this lesson.

After you finish all homework, and  review the lessons in this unit, take Quiz 2 for Unit 2.

This concludes Unit 2. You now know all of the techniques needed to differentiate a large class of functions. You should also understand the connection between the derivative, (instantaneous) rates of change, and the slope of a tangent line to a curve. In Unit 3 the ideas introduced in this unit will be applied to a number of different applications.

>   

>   

>