An explicit function is of the form that should be the most familiar, such as:
f(x)=x2+3y=sinxWhereas an implicit function defines an algebraic relationship between variables. These functions have a form similar to the following:
x2+y2=25y5+xy=3In 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)=0Remembering that y is implicitly defined as a function of x, we apply the Chain Rule for finding the derivative of y3.
3y2dydx+3x2=0Then, solving for dydx:
3y2dydx=−3x2dydx=−3x23y2=−x2y2When 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.
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.
idiff(y ** 3 + x ** 3 - 1, y, x)
Examples¶
Example 1: Find the derivative of the implicit function x2+xy−y2+4.¶
We begin by taking the derivative of both sides of the equation after subtracting 4 from both sides.
Then taking each derivative in turn:
ddx(x2)+ddx(xy)−ddx(y2)=0Remembering that y is implicitly defined as a function of x, we apply the Product Rule when finding the derivative ddx(xy).
ydxdyx+xdydx=yx′+y′xFinding the remaining derivatives of the function:
2x+yx′+y′x−2yy′=0The 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+y′x−2yy′=0Isolate y′ to one side by subtracting 2x+y from both sides.
y′x−2yy′=−2x−yFactor y′ on the left side:
y′(2y−x)=−2x−yDivide both sides by x−2y.
y′=dydx=−2x−yx−2yCheck our answer using SymPy:
idiff(x ** 2 + x * y - y ** 2 + 4, y, x)
For those interested, the implicit equations and their derivatives can be plotted easily using SymPy's plot_implicit()
function.
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))
Example 2: Find the derivative of the implicit equation x4(x+y)=y2(3x−y)¶
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(3x−y))x4ddx(x)+ddx(y)+(x+y)ddxx4=ddx(y2(3x−y))Calculate the derivatives on the left-hand side of the equation:
x4(1+y′)+4x3(x+y)=y2ddx(3x−y)+(3x−y)ddxy2Shift focus to the right-hand side of the equation:
y2(ddx3x−ddxy)+(3x−y)ddxy2=y2(3−y′)+2yy′(3x−y)Thus, we now have:
x4(1+y′)+4x3(x+y)=y2(3−y′)+2yy′(3x−y)Expand and clean up the terms:
x4+x4y′+4x4+4x3y=3y2−y2y′+6xyy′−2y2y′5x4+x4y′+4x3y=3y2+6xyy′−3y2y′We then want to isolate y′ to one side of the equation.
5x4+x4y′+4x3y−6xyy′+3y2y′=3y2x4y′−6xyy′+3y2y′=3y2−5x4−4x3yFinish calculating the derivative by factoring y′ on the left-hand side of the equation and dividing:
y′(x4−6xy+3y2)=3y2−5x4−4x3yy′=3y2−5x4−4x3yx4−6xy+3y2Using SymPy as before, we can verify our answer is correct.
idiff(x ** 4 * (x + y) - y ** 2 * (3 * x - y), y, x)
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.
plot_implicit(x ** 4 * (x + y) - y ** 2 * (3 * x - y))
The derivative of the equation can be plotted similarly.
plot_implicit((-5 * x ** 5 - 4 * x ** 3 * y + 3 * y ** 2) / (x ** 4 - 6 * x * y + 3 * y ** 2))
Example 3: Derivative of the equation 4cosx siny=1¶
Plotting the implicit equation 4cosx siny=1 reveals a rather unique and interesting graph.
plot_implicit(4 * cos(x) * sin(y) - 1, (x, -10, 10), (y, -10, 10))
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 1Then 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 y′cosy−siny sinx)=0Expanding the terms:
4cosx y′cosy−4siny sinx=0Isolate y′ to one side of the equation.
The derivative can be simplified further knowing that tanx=sinxcosx
Confirm our derivative is correct by checking against SymPy.
idiff(4 * cos(x) * sin(y) - 1, y, x)
The derivative of the implicit equation also makes for an interesting graph and creates a grid-like appearance.
plot_implicit(tan(x) * tan(y), (x, -10, 10), (y, -10, 10))
References¶
Strang, G. (2010). Calculus. Wellesley, MA: Wellesley-Cambridge.
Weisstein, Eric W. "Implicit Function." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/ImplicitFunction.html