Some curves are not graphs of a single function. The circle $x^2 + y^2 = 25$ fails the vertical line test. We can still find the slope of its tangent lines: treat $y$ as an unknown function of $x$ and use the The Chain Rule wherever $y$ appears.
Key idea
To find $\frac{dy}{dx}$ from an equation in $x$ and $y$: differentiate both sides with respect to $x$. Every term containing $y$ gets a factor $\frac{dy}{dx}$ (for example $\frac{d}{dx}y^2 = 2y\frac{dy}{dx}$). Then collect the $\frac{dy}{dx}$ terms and solve.
Why it works
Near most points, a curve like the circle is the graph of some function $y(x)$: the top half, say, is $y = \sqrt{25 - x^2}$. The equation holds for every $x$ on that piece, so the derivatives of both sides are equal. Since $y$ depends on $x$, $y^2$ is a composition (outer: squaring, inner: $y(x)$), and the chain rule gives $2y\cdot y'$. We never need the formula for $y(x)$.
Worked example: A circle
Find $\frac{dy}{dx}$ for $x^2 + y^2 = 25$, and the slope at $(3, 4)$.
- Differentiate: $2x + 2y\frac{dy}{dx} = 0$.
- Solve: $\frac{dy}{dx} = -\frac{x}{y}$.
- At $(3, 4)$: $-\frac{3}{4}$. (The radius to $(3, 4)$ has slope $\frac{4}{3}$, and the tangent is perpendicular to it.)
Answer: $\frac{dy}{dx} = -\frac{x}{y}$; slope $-\frac{3}{4}$.
Worked example: A product term
Find the slope of $x^2 + xy + y^2 = 7$ at $(1, 2)$.
- Differentiate; use the product rule on $xy$: $2x + \left(y + x\frac{dy}{dx}\right) + 2y\frac{dy}{dx} = 0$.
- Collect: $(x + 2y)\frac{dy}{dx} = -(2x + y)$, so $\frac{dy}{dx} = -\frac{2x + y}{x + 2y}$.
- At $(1, 2)$: $-\frac{2 + 2}{1 + 4} = -\frac{4}{5}$.
Answer: $-\frac{4}{5}$
Worked example: The folium
Find the slope of $x^3 + y^3 = 6xy$ at $(3, 3)$.
- $3x^2 + 3y^2\frac{dy}{dx} = 6y + 6x\frac{dy}{dx}$.
- Collect: $(3y^2 - 6x)\frac{dy}{dx} = 6y - 3x^2$, so $\frac{dy}{dx} = \frac{2y - x^2}{y^2 - 2x}$.
- At $(3, 3)$: $\frac{6 - 9}{9 - 6} = -1$.
Answer: $-1$
- Differentiate both sides with respect to $x$.
- Attach $\frac{dy}{dx}$ to every derivative of a $y$-term; use the product rule on terms like $xy$.
- Move all $\frac{dy}{dx}$ terms to one side and everything else to the other.
- Factor out $\frac{dy}{dx}$ and divide.
- To get a number, substitute a point that lies on the curve.
Where the formula's denominator is 0, the tangent is vertical. On the circle, $-\frac{x}{y}$ is undefined at $(5, 0)$ and $(-5, 0)$, the far left and right points, where the tangent lines are $x = \pm 5$.
Common mistake
Differentiating $y^2$ as $2y$ instead of $2y\frac{dy}{dx}$. Then $\frac{dy}{dx}$ never appears and there is nothing to solve for. Check: every term that contains $y$ should produce a $\frac{dy}{dx}$ when differentiated, and terms with only $x$ should not.