Implicit Differentiation
Many curves are described by an equation in and , such as , rather than by a formula . Implicit differentiation finds anyway, by differentiating both sides and treating as an unknown function of . It also gives the derivatives of the inverse trigonometric functions.
For a gentler first look, see Implicit Differentiation. The technique is the chain rule from The Chain Rule, applied every time appears.
The method
- Differentiate both sides of the equation with respect to .
- Every term with gets a factor (written ) by the chain rule: , , and products such as need the product rule: .
- Collect the terms on one side and solve.
Example: a circle. From :
At the slope is , and at it is . One formula covers both halves of the circle, which the explicit route has to treat separately. The slope is perpendicular to the radius, slope , as geometry demands.
Example: a curve with no explicit form. For :
At the point (check: ) the slope is .
SymPy's idiff and a picture
SymPy has idiff(equation, y, x) for exactly this. The plot draws the curve as a contour of at level 0, with the tangent at .
python · try it yourselfimport numpy as np
import sympy as sp
import matplotlib.pyplot as plt
x, y = sp.symbols('x y')
F = x**3 + y**3 - 6*x*y
slope = sp.idiff(F, y, x)
print("dy/dx =", sp.simplify(slope))
print("slope at (3, 3):", slope.subs({x: 3, y: 3}))
X, Y = np.meshgrid(np.linspace(-4, 5, 400), np.linspace(-4, 5, 400))
plt.figure(figsize=(5, 5))
plt.contour(X, Y, X**3 + Y**3 - 6*X*Y, levels=[0])
t = np.linspace(1.5, 4.5, 2)
plt.plot(t, 3 - (t - 3), "r--", label="tangent at (3, 3)")
plt.plot([3], [3], "ro")
plt.gca().set_aspect("equal")
plt.legend()
dy/dx = (x**2 - 2*y)/(2*x - y**2)
slope at (3, 3): -1
SymPy's form is ours with numerator and denominator both multiplied by .
Second derivatives implicitly
Differentiate again, substituting back in. For the circle, :
using the original equation in the last step. On the upper half () the curve is concave down, on the lower half concave up.
Why it works, and when
Implicit differentiation assumes the equation defines as a differentiable function of near the point. That is not always true: at on the circle the tangent is vertical and has a zero denominator. The Implicit Function Theorem (met again with Partial Derivatives) says: if and at a point, then near that point the equation does define a differentiable , with
which is exactly what the step-by-step method computes.
Derivatives of inverse trigonometric functions
Let , meaning with . Differentiate implicitly:
On , , so . Hence for .
For , with :
| Function |
Derivative |
Valid for |
|
|
|
|
|
|
|
|
all |
|
|
|
, which explains its minus sign.
python · try it yourselfimport sympy as sp
x = sp.symbols('x')
for f in [sp.asin(x), sp.acos(x), sp.atan(x)]:
print(f"d/dx {str(f):8} = {sp.diff(f, x)}")
print("d/dx arctan(x²) =", sp.diff(sp.atan(x**2), x))
d/dx asin(x) = 1/sqrt(1 - x**2)
d/dx acos(x) = -1/sqrt(1 - x**2)
d/dx atan(x) = 1/(x**2 + 1)
d/dx arctan(x²) = 2*x/(x**4 + 1)
Tip: has a derivative that is a plain rational function. That is why turns up in Partial Fractions.
In software
- Signed distance fields and implicit surfaces: graphics and games often store shapes as . The surface normal is the gradient ; the slope formula is its 2D shadow (Shaders).
atan2: the angle of a vector in games uses , and steering code that turns smoothly relies on its bounded derivative.
- Implicit layers in ML: "deep equilibrium" models define an output by an equation and get gradients by the Implicit Function Theorem instead of unrolling a loop.
- Root tracking: solvers that follow a curve as a parameter changes (continuation methods) step along .
Exercises
Exercise 1: An ellipse
Find for and the slope at .
Answer
; slope 0 at .
Solution
Exercise 2: A product term
Find for and evaluate it at .
Answer
; at it is .
Solution
Exercise 3: Trig inside
Find for .
Answer
Solution
Exercise 4: Arctan with a chain
Differentiate and evaluate . Then check with SymPy.
Answer
,
Solution
python · try it yourselfimport sympy as sp
x = sp.symbols('x')
d = sp.diff(sp.atan(3*x), x)
print(d, d.subs(x, 1))
3/(9*x**2 + 1) 3/10
Exercise 5: Horizontal tangents
Find the points on where the tangent is horizontal.
Answer
and
Solution
Test yourself
What is when is a function of ?
What is ?
For , which condition guarantees is locally a differentiable function of ?
- is a polynomial