Processing math: 100%

Implicit Differentiation

An explicit function is of the form that should be the most familiar, such as:

f(x)=x2+3y=sinx

Whereas an implicit function defines an algebraic relationship between variables. These functions have a form similar to the following:

x2+y2=25y5+xy=3

In these examples and the following exercises, it is assumed that y is implicitly defined and is a differentiable function of x.

Luckily, implicitly defined equations do not need to be solved for y in terms of x (or any other variable) to calculate the derivative of the function. We can employ implicit differentiation to find the derivatives of implicitly defined equations.

Implicit differentiation is performed by differentiating both sides of the equation with respect to x and then solving for the resulting equation for the derivative of y.

As an example, consider the function y3+x3=1. We can apply implicit differentiation to this equation to find its derivative. Begin by differentiating both sides of the equation with respect to x.

ddx(y3+x3)=ddx(1)ddx(y3)+ddx(x3)=0

Remembering that y is implicitly defined as a function of x, we apply the Chain Rule for finding the derivative of y3.

3y2dydx+3x2=0

Then, solving for dydx:

3y2dydx=3x2dydx=3x23y2=x2y2

When dealing with more complex equations that feature more terms, it can be helpful to use Newton notation such as y to help keep the intermediate calculations easier to read.

We can confirm our result by using the SymPy package as before. Import the needed functions and set x and y as variables to be recognized by SymPy.

In [43]:
from sympy import symbols, idiff, sin, cos, tan, sqrt, init_printing, plot_implicit

init_printing()
x = symbols('x')
y = symbols('y')

As we are finding the derivatives of implicitly defined functions, we use the idiff function rather than diff as seen in previous examples.

In [21]:
idiff(y ** 3 + x ** 3 - 1, y, x)
Out[21]:
x2y2

Examples

Example 1: Find the derivative of the implicit function x2+xyy2+4.

We begin by taking the derivative of both sides of the equation after subtracting 4 from both sides.

ddx(x2+xyy2)=ddx(4)

Then taking each derivative in turn:

ddx(x2)+ddx(xy)ddx(y2)=0

Remembering that y is implicitly defined as a function of x, we apply the Product Rule when finding the derivative ddx(xy).

ydxdyx+xdydx=yx+yx

Finding the remaining derivatives of the function:

2x+yx+yx2yy=0

The derivative of x is 1. The derivative ddx is found using the Chain Rule:

ddx(y2)=ddy(y2)dydx=2ydydx=2yy

Finish finding the derivative of the equation:

2x+y+yx2yy=0

Isolate y to one side by subtracting 2x+y from both sides.

yx2yy=2xy

Factor y on the left side:

y(2yx)=2xy

Divide both sides by x2y.

y=dydx=2xyx2y

Check our answer using SymPy:

In [28]:
idiff(x ** 2 + x * y - y ** 2 + 4, y, x)
Out[28]:
2x+yx2y

For those interested, the implicit equations and their derivatives can be plotted easily using SymPy's plot_implicit() function.

In [34]:
plot_implicit(x ** 2 + x * y - y ** 2 + 4, title = 'graph of $x^2 + xy - y^2 + 4$')
plot_implicit(-(2 * x + y) / (x - 2 * y))
Out[34]:
<sympy.plotting.plot.Plot at 0x1109e2b38>

Example 2: Find the derivative of the implicit equation x4(x+y)=y2(3xy)

Focus on the left-hand side of the equation for now. Differentiate both sides of the equation and apply the Product Rule to the left-hand side.

x4ddx(x+y)+(x+y)ddxx4=ddx(y2(3xy))x4ddx(x)+ddx(y)+(x+y)ddxx4=ddx(y2(3xy))

Calculate the derivatives on the left-hand side of the equation:

x4(1+y)+4x3(x+y)=y2ddx(3xy)+(3xy)ddxy2

Shift focus to the right-hand side of the equation:

y2(ddx3xddxy)+(3xy)ddxy2=y2(3y)+2yy(3xy)

Thus, we now have:

x4(1+y)+4x3(x+y)=y2(3y)+2yy(3xy)

Expand and clean up the terms:

x4+x4y+4x4+4x3y=3y2y2y+6xyy2y2y5x4+x4y+4x3y=3y2+6xyy3y2y

We then want to isolate y to one side of the equation.

5x4+x4y+4x3y6xyy+3y2y=3y2x4y6xyy+3y2y=3y25x44x3y

Finish calculating the derivative by factoring y on the left-hand side of the equation and dividing:

y(x46xy+3y2)=3y25x44x3yy=3y25x44x3yx46xy+3y2

Using SymPy as before, we can verify our answer is correct.

In [35]:
idiff(x ** 4 * (x + y) - y ** 2 * (3 * x - y), y, x)
Out[35]:
5x44x3y+3y2x46xy+3y2

Also, for fun, we can plot the implicit function and its derivative as we did previously. Implicit functions, such as the one we just worked with, often make very appealing curves and graphs. For example, the previous implicit equation makes a unique bowtie like shape when plotted.

In [36]:
plot_implicit(x ** 4 * (x + y) - y ** 2 * (3 * x - y))
Out[36]:
<sympy.plotting.plot.Plot at 0x110eaed68>

The derivative of the equation can be plotted similarly.

In [37]:
plot_implicit((-5 * x ** 5 - 4 * x ** 3 * y + 3 * y ** 2) / (x ** 4 - 6 * x * y + 3 * y ** 2))
Out[37]:
<sympy.plotting.plot.Plot at 0x110b62390>

Example 3: Derivative of the equation 4cosx siny=1

Plotting the implicit equation 4cosx siny=1 reveals a rather unique and interesting graph.

In [42]:
plot_implicit(4 * cos(x) * sin(y) - 1, (x, -10, 10), (y, -10, 10))
Out[42]:
<sympy.plotting.plot.Plot at 0x111726550>

The derivative of the implicit equation can be found as in the previous examples. Start by differentiating both sides of the equation:

4(cosxddxsiny+sinyddxcosx)=ddx 1

Then we calculate each derivative in turn, recalling that y is implicitly defined as a function of x and thus need to apply the Chain Rule to find the derivative ddxsiny.

4(cosx ycosysiny sinx)=0

Expanding the terms:

4cosx ycosy4siny sinx=0

Isolate y to one side of the equation.

4ycosx cosy=4sinysinxdydx=4sinysinx4cosx cosy

The derivative can be simplified further knowing that tanx=sinxcosx

dydx=tanxtany

Confirm our derivative is correct by checking against SymPy.

In [47]:
idiff(4 * cos(x) * sin(y) - 1, y, x)
Out[47]:
tan(x)tan(y)

The derivative of the implicit equation also makes for an interesting graph and creates a grid-like appearance.

In [46]:
plot_implicit(tan(x) * tan(y), (x, -10, 10), (y, -10, 10))
Out[46]:
<sympy.plotting.plot.Plot at 0x111d445c0>

References

Related Posts