25. Implicit differentiation
x^2 + y^2 = 25 is a circle. It is not a function — the vertical line test fails everywhere except the two poles — so nothing so far tells you its slope.
But the circle plainly has a tangent line at every point. Implicit differentiation gets it, without ever solving for y.
The idea
Treat y as an unspecified function of x, differentiate the whole equation, and solve for \frac{dy}{dx}.
The only new mechanical point: whenever you differentiate something containing y, the chain rule contributes a factor of \frac{dy}{dx}, because y is a function of x rather than a constant.
\frac{d}{dx}y^2 = 2y\frac{dy}{dx}, \qquad \frac{d}{dx}y^3 = 3y^2\frac{dy}{dx}, \qquad \frac{d}{dx}\sin y = \cos y\frac{dy}{dx}
That's it. Everything else is algebra you already have.
The circle
x^2 + y^2 = 25
Differentiate both sides with respect to x:
2x + 2y\frac{dy}{dx} = 0
Solve:
\frac{dy}{dx} = -\frac{x}{y}
At (3,4): slope -\frac34. At (3,-4): slope +\frac34. One formula, both branches — which is exactly what solving explicitly would have cost you, since y = \pm\sqrt{25-x^2} needs two cases handled separately.
Check it against geometry: the radius to (3,4) has slope \frac43, and the tangent to a circle is perpendicular to the radius, so its slope should be the negative reciprocal, -\frac34 ✓.
Note also what happens at y = 0, the points (\pm5, 0): the formula divides by zero, correctly reporting a vertical tangent.
Why it's legitimate
The manoeuvre assumes y is some differentiable function of x near the point of interest, which isn't automatic — the circle has no such function near (5,0).
The implicit function theorem is what licenses it: if F(x,y) = 0 and \frac{\partial F}{\partial y} \neq 0 at a point, then near that point the equation does define y as a differentiable function of x, and
\frac{dy}{dx} = -\frac{\partial F/\partial x}{\partial F/\partial y}
That's §10.4 material and it's proved in §15.7. For now, notice that the condition \frac{\partial F}{\partial y} \neq 0 is precisely "the denominator in your answer isn't zero" — so the method warns you itself when it doesn't apply.
The recipe
- Differentiate every term with respect to x.
- Any term with y in it produces a \frac{dy}{dx} factor.
- Collect all \frac{dy}{dx} terms on one side.
- Factor and divide.
The answer normally involves both x and y. That's expected and usually unavoidable, and it's fine — you evaluate it at a point where you know both coordinates.
A harder one
x^3 + y^3 = 6xy
the folium of Descartes, a curve with a loop that no explicit formula describes conveniently.
Differentiate, using the product rule on the right:
3x^2 + 3y^2\frac{dy}{dx} = 6y + 6x\frac{dy}{dx}
Collect:
3y^2\frac{dy}{dx} - 6x\frac{dy}{dx} = 6y - 3x^2
\frac{dy}{dx}\left(3y^2 - 6x\right) = 6y - 3x^2
\frac{dy}{dx} = \frac{6y - 3x^2}{3y^2 - 6x} = \frac{2y - x^2}{y^2 - 2x}
At (3,3): \frac{6-9}{9-6} = -1. The tangent there has slope -1, which the curve's symmetry in x \leftrightarrow y predicts — the point (3,3) is on the line y=x, about which the folium is symmetric, so the tangent must be perpendicular to that line.
Where it earns its keep
Products and quotients as equations. Sometimes an implicit form is simply less work than the explicit one.
Related rates (§3.0) are implicit differentiation with respect to time instead of x. Every term gets a \frac{d}{dt}, and the chain rule supplies \frac{dx}{dt}, \frac{dy}{dt} factors. It's the same technique.
Inverse functions — §2.6 differentiated e^{\ln x} = x and §2.7 differentiated \sin y = x. Both were implicit differentiation.
The power rule for rational exponents, completing another piece of §2.2's promise. Let y = x^{p/q}, so y^q = x^p. Differentiate:
qy^{q-1}\frac{dy}{dx} = px^{p-1} \implies \frac{dy}{dx} = \frac{p}{q}\cdot\frac{x^{p-1}}{y^{q-1}}
Substituting y = x^{p/q} and simplifying the exponents:
= \frac{p}{q}\cdot\frac{x^{p-1}}{x^{p - p/q}} = \frac{p}{q}x^{p/q - 1}
which is nx^{n-1} with n = \frac pq ✓.
Second derivatives implicitly
Differentiate the first derivative again, then substitute the known \frac{dy}{dx} to eliminate it. For the circle, starting from \frac{dy}{dx} = -\frac xy and using the quotient rule:
\frac{d^2y}{dx^2} = -\frac{y - x\frac{dy}{dx}}{y^2} = -\frac{y - x\left(-\frac xy\right)}{y^2} = -\frac{y + \frac{x^2}{y}}{y^2} = -\frac{y^2+x^2}{y^3}
And since x^2+y^2 = 25 on the curve, this simplifies to -\frac{25}{y^3}.
Using the original equation to simplify at the end is the characteristic final step. It's what turns an ugly expression into a usable one, and it's easy to forget.
Doing it in Python
Implicit slopes, and the explicit check where one exists:
from math import sqrt
def numerical(f, x, h=1e-6):
return (f(x + h) - f(x - h)) / (2 * h)
# upper half of x^2 + y^2 = 25
upper = lambda x: sqrt(25 - x*x)
print(f"{'x':>6} {'y':>10} {'implicit -x/y':>16} {'numerical':>14}")
for x in (0.0, 3.0, 4.0, 4.9):
y = upper(x)
print(f"{x:>6} {y:>10.6f} {-x/y:>16.8f} {numerical(upper, x):>14.8f}")
print("\nsame formula works on the lower branch, where the explicit function differs")
for x in (3.0, 4.0):
y = -upper(x)
print(f" at ({x}, {y:.3f}): slope = {-x/y:+.6f}")
SymPy does implicit differentiation directly:
import sympy as sp
x, y = sp.symbols('x y')
curves = [
("circle x^2+y^2=25", x**2 + y**2 - 25),
("folium x^3+y^3=6xy", x**3 + y**3 - 6*x*y),
("ellipse x^2/4+y^2/9=1", x**2/4 + y**2/9 - 1),
("implicit sin(x*y)=x", sp.sin(x*y) - x),
]
for name, F in curves:
dydx = sp.simplify(-sp.diff(F, x) / sp.diff(F, y))
print(f"{name:<26} dy/dx = {dydx}")
The folium, whose loop no explicit formula handles well:
import sympy as sp
x, y = sp.symbols('x y')
F = x**3 + y**3 - 6*x*y
dydx = sp.simplify(-sp.diff(F, x) / sp.diff(F, y))
print(f"dy/dx = {dydx}\n")
for pt in [(3, 3), (0, 0), (sp.Rational(4, 3), sp.Rational(8, 3))]:
val = dydx.subs({x: pt[0], y: pt[1]})
on_curve = sp.simplify(F.subs({x: pt[0], y: pt[1]})) == 0
print(f"at {pt}: on the curve? {on_curve} slope = {val}")
print("\nthe origin gives 0/0 -- the folium crosses itself there, so there are")
print("two tangents and no single slope. the formula reports the ambiguity.")
Second derivative, and the final simplification:
import sympy as sp
x = sp.Symbol('x')
y = sp.Function('y')
eq = x**2 + y(x)**2 - 25
first = sp.solve(sp.diff(eq, x), sp.diff(y(x), x))[0]
print(f"dy/dx = {first}")
second = sp.simplify(sp.diff(first, x).subs(sp.diff(y(x), x), first))
print(f"d2y/dx2 = {second}")
print(f"using x^2+y^2=25: {sp.simplify(second.subs(x**2, 25 - y(x)**2))}")
Worked example
Find the tangent line to x^2 + xy + y^2 = 7 at the point (1, 2).
First confirm the point is on the curve: 1 + 2 + 4 = 7 ✓. (Always check — an off-curve point makes everything after it meaningless.)
Differentiate term by term. The middle term xy needs the product rule:
2x + \left(1\cdot y + x\frac{dy}{dx}\right) + 2y\frac{dy}{dx} = 0
Collect the \frac{dy}{dx} terms:
\frac{dy}{dx}\left(x + 2y\right) = -2x - y
\frac{dy}{dx} = -\frac{2x+y}{x+2y}
At (1,2):
\frac{dy}{dx} = -\frac{2+2}{1+4} = -\frac45
Tangent line:
y - 2 = -\frac45(x-1) \implies y = -\frac45x + \frac{14}{5}
Two checks. The formula's symmetry — swapping x \leftrightarrow y inverts the slope — reflects the curve's symmetry about y=x ✓. And the tangent at (2,1), the mirror point, should be -\frac54, which the formula gives ✓.
The recurring mistake in this problem is differentiating xy as just y or just x\frac{dy}{dx}. It's a product of two functions of x, so both terms appear. If your answer looks asymmetric where the curve is symmetric, that's usually why.
Your turn
1. Find \frac{dy}{dx} for x^2 - y^2 = 16.
2. Find \frac{dy}{dx} for \sin y = x, and reconcile it with §2.7's \arcsin derivative.
3. Find the tangent to x^{2/3} + y^{2/3} = 4 at (1, 3\sqrt3).
4. Find \frac{dy}{dx} for e^{xy} = x + y.
Solutions
1. Differentiate:
2x - 2y\frac{dy}{dx} = 0 \implies \boxed{\frac{dy}{dx} = \frac{x}{y}}
Note the sign difference from the circle's -\frac xy — that one minus sign is the whole difference between a circle and a hyperbola, and it matches §2.8's \cosh^2 - \sinh^2 = 1 parameterising exactly this curve.
2. Differentiate:
\cos y\frac{dy}{dx} = 1 \implies \frac{dy}{dx} = \frac{1}{\cos y}
Since \sin y = x and \cos y = \sqrt{1-\sin^2y} = \sqrt{1-x^2} (positive on \arcsin's range):
\boxed{\frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}}}
which is exactly \frac{d}{dx}\arcsin x ✓. §2.7's derivation was implicit differentiation; we just hadn't named it yet.
3. Differentiate, treating each term with the power rule:
\tfrac23 x^{-1/3} + \tfrac23 y^{-1/3}\frac{dy}{dx} = 0 \implies \frac{dy}{dx} = -\frac{y^{1/3}}{x^{1/3}} = -\sqrt[3]{\frac yx}
At (1, 3\sqrt3): note 3\sqrt3 = 3^{3/2}, so y^{1/3} = 3^{1/2} = \sqrt3, and x^{1/3} = 1:
\frac{dy}{dx} = -\sqrt3
\boxed{y - 3\sqrt3 = -\sqrt3(x-1)}
(This curve is an astroid, the shape traced by a point on a circle rolling inside a larger one — and note the derivative blows up at x=0 and vanishes at y=0, the four cusps §2.1 warned about.)
4. The left side needs the chain rule and the product rule inside it:
e^{xy}\cdot\left(y + x\frac{dy}{dx}\right) = 1 + \frac{dy}{dx}
Expand and collect:
ye^{xy} + xe^{xy}\frac{dy}{dx} = 1 + \frac{dy}{dx}
\frac{dy}{dx}\left(xe^{xy} - 1\right) = 1 - ye^{xy}
\boxed{\frac{dy}{dx} = \frac{1 - ye^{xy}}{xe^{xy} - 1}}
Check at (0,1), which is on the curve (e^0 = 1 = 0+1 ✓): the slope is \frac{1-1}{0-1} = 0. A horizontal tangent at (0,1).
Check yourself in code
Compute implicit derivatives with SymPy and evaluate them at points on each curve.
For the circle x^2+y^2=25 at (3,4), the folium x^3+y^3=6xy at (3,3), and the ellipse \frac{x^2}{4}+\frac{y^2}{9}=1 at \left(1, \frac{3\sqrt3}{2}\right), use \frac{dy}{dx} = -\frac{\partial F/\partial x}{\partial F/\partial y} and print the exact slope.
Print exactly this:
circle x^2+y^2=25 at (3, 4) dy/dx = -3/4
folium x^3+y^3=6xy at (3, 3) dy/dx = -1
ellipse x^2/4+y^2/9=1 at (1, 3*sqrt(3)/2) dy/dx = -sqrt(3)/2
import sympy as sp
x, y = sp.symbols('x y')
curves = [
("circle x^2+y^2=25", x**2 + y**2 - 25, (3, 4)),
("folium x^3+y^3=6xy", x**3 + y**3 - 6*x*y, (3, 3)),
("ellipse x^2/4+y^2/9=1", x**2/4 + y**2/9 - 1, (1, sp.sqrt(27)/2)),
]
for name, F, pt in curves:
# dy/dx = -(dF/dx) / (dF/dy), then substitute the point
print(f"{name:<24} at {pt} dy/dx = ...")
import sympy as sp
x, y = sp.symbols('x y')
curves = [
("circle x^2+y^2=25", x**2 + y**2 - 25, (3, 4)),
("folium x^3+y^3=6xy", x**3 + y**3 - 6*x*y, (3, 3)),
("ellipse x^2/4+y^2/9=1", x**2/4 + y**2/9 - 1, (1, sp.sqrt(27)/2)),
]
for name, F, pt in curves:
dydx = sp.simplify(-sp.diff(F, x) / sp.diff(F, y))
slope = sp.simplify(dydx.subs({x: pt[0], y: pt[1]}))
print(f"{name:<24} at {pt} dy/dx = {slope}")
Treat y as a function of x, differentiate the whole equation, and every term containing y contributes a \frac{dy}{dx} by the chain rule; then collect and solve. The answer usually involves both variables, which is fine because you evaluate it at a known point. It handles curves that aren't functions, it's what §3.0's related rates are, and it's what §2.6 and §2.7 were doing all along. When the denominator vanishes, the method is correctly telling you the tangent is vertical or the curve crosses itself.
Next: what you get by differentiating more than once.