---
title: Implicit Differentiation and Related Rates
module: Derivatives
moduleNumber: 2
lessonNumber: 3
order: 203
summary: >
  Not every curve is the graph of y = f(x). Implicit differentiation finds a
  slope from an equation in x and y directly, treating y as an unknown function
  and differentiating both sides. The same chain-rule idea drives related
  rates, where one measured rate of change forces another through a geometric
  constraint, and interprets the derivative as a rate across the sciences.
topics: [Derivatives]
sources:
  - book: Stewart
    ref: "Ch. 2 — Derivatives; §2.6 Implicit Differentiation, §2.7 Rates of Change in the Natural and Social Sciences, §2.8 Related Rates"
draft: false
---

Every function differentiated so far was given **explicitly**, one variable
written in terms of another as $y = f(x)$. But many curves are defined
**implicitly** by an equation relating $x$ and $y$, such as $x^2 + y^2 = 25$ or
$x^3 + y^3 = 6xy$, that cannot be solved cleanly for $y$. Implicit
differentiation finds the slope anyway. The same technique, differentiating a
relation with the [chain rule](/calculus/derivatives/differentiation-rules-and-the-chain-rule)
while treating one variable as a function of another, also solves related-rates
problems, where quantities changing in time are linked by a geometric
equation.

## Implicit functions

The circle $x^2 + y^2 = 25$ is not a function: a vertical line can meet it
twice. Solving for $y$ splits it into two functions,
$f(x) = \sqrt{25 - x^2}$ and $g(x) = -\sqrt{25 - x^2}$, the upper and lower
semicircles. The folium of Descartes $x^3 + y^3 = 6xy$ is worse — solving for
$y$ produces three unwieldy branches. When we say $y$ is defined implicitly by
such an equation, we mean the equation holds for all $x$ in the domain of some
differentiable function $y = f(x)$.

The point of implicit differentiation is that finding $y'$ never requires
solving for $y$.

> **Method (Implicit differentiation).** To find $y'$ from an equation in $x$
> and $y$: differentiate **both sides** with respect to $x$, treating $y$ as a
> function of $x$ (so every $y$ term needs the chain rule), then solve the
> resulting equation algebraically for $y'$.

Because $y$ is a function of $x$, differentiating a power of $y$ picks up a
factor of $y'$ from the chain rule:

$$
\frac{\d}{\d x}\bigl(y^2\bigr) = 2y\,\frac{\d y}{\d x},
\qquad
\frac{\d}{\d x}\bigl(y^n\bigr) = n y^{n-1}\,\frac{\d y}{\d x}.
$$

## Worked examples

**Example (circle).** Differentiate $x^2 + y^2 = 25$ term by term:

$$
2x + 2y\,\frac{\d y}{\d x} = 0
\;\Longrightarrow\;
\frac{\d y}{\d x} = -\frac{x}{y}.
$$

The slope is expressed in terms of both coordinates; it gives the
correct value at any point of either branch. At $(3,4)$ the slope is
$-\tfrac{3}{4}$, so the tangent is $y - 4 = -\tfrac{3}{4}(x - 3)$, i.e.
$3x + 4y = 25$. Solving for $y$ first and differentiating gives the same answer
with more effort.

$$
% caption: Implicit differentiation gives the tangent to x^2 + y^2 = 25 at
% (3, 4) without solving for y; the slope -x/y = -3/4 is perpendicular to the radius.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=0.48]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-6,0) -- (6.4,0) node[right]{$x$};
\draw[black,->] (0,-6) -- (0,6.4) node[above]{$y$};
\draw[black, thick] (0,0) circle (5);
\draw[acc, very thick, domain=0:7.2, variable=\x] plot (\x, {4 - 0.75*(\x-3)});
\draw[black, dashed] (0,0) -- (3,4);
\fill[black] (3,4) circle (5pt) node[anchor=south west] {$(3,\,4)$};
\end{tikzpicture}
$$

**Example (folium).** For $x^3 + y^3 = 6xy$, differentiate, using the chain rule
on $y^3$ and the product rule on $6xy$:

$$
3x^2 + 3y^2 y' = 6x y' + 6y.
$$

Collecting the $y'$ terms,

$$
(y^2 - 2x)\,y' = 2y - x^2
\;\Longrightarrow\;
y' = \frac{2y - x^2}{y^2 - 2x}.
$$

At $(3,3)$ the slope is $\dfrac{6 - 9}{9 - 6} = -1$, so the tangent there is
$x + y = 6$. The tangent is horizontal where $y' = 0$, that is $2y = x^2$;
substituting into the curve locates that point at
$(2^{4/3}, 2^{5/3}) \approx (2.52, 3.17)$.

**Example (mixed trigonometric).** For $\sin(x + y) = y^2 \cos x$, differentiate
both sides:

$$
\cos(x + y)\,(1 + y') = -y^2 \sin x + 2y\,y'\cos x.
$$

Gathering $y'$,

$$
y' = \frac{y^2 \sin x + \cos(x + y)}{2y\cos x - \cos(x + y)}.
$$

### Second derivatives and inverse functions

Implicit differentiation also delivers $y''$: differentiate the expression for
$y'$ again, substituting the known $y'$ where it appears.

**Example.** For $x^4 + y^4 = 16$, differentiating gives $y' = -x^3/y^3$.
Differentiating again with the quotient rule and substituting $y'$ and the
original equation simplifies to

$$
y'' = -\frac{3x^2\bigl(x^4 + y^4\bigr)}{y^7} = -\frac{48 x^2}{y^7}.
$$

The technique is also the key to differentiating **inverse** functions. If
$y = f^{-1}(x)$ satisfies $f(y) = x$, differentiating implicitly gives
$f'(y)\,y' = 1$, so $y' = 1/f'(y)$. The
[inverse trigonometric and logarithmic derivatives](/calculus/exponential-logarithmic-and-inverse-functions/growth-decay-inverse-trig-and-hyperbolic-functions)
are all found this way.

## The derivative as a rate of change

Whenever $y = f(x)$ carries a meaning in the sciences, the derivative $\d y/\d x$
carries the matching rate of change, with units of $y$ per unit of $x$. This one
interpretation recurs across disciplines.

| Field | Quantity $y = f(x)$ | Derivative $\d y/\d x$ |
| --- | --- | --- |
| Physics | position $s(t)$ | velocity; its derivative is acceleration |
| Chemistry | concentration $[C](t)$ | rate of reaction |
| Biology | population $n(t)$ | growth rate |
| Economics | cost $C(x)$ of $x$ units | marginal cost |
| Thermodynamics | volume $V(P)$ | (with a sign) compressibility |

The economic case sharpens the meaning of "instantaneous" for a discrete
quantity. If $C(x)$ is the cost of producing $x$ units, the **marginal cost** is
$C'(x)$, and because the difference quotient over one unit is a good estimate,

$$
C'(n) \approx \frac{C(n+1) - C(n)}{1} = C(n+1) - C(n),
$$

so the marginal cost at $n$ units is approximately the cost of the
$(n+1)\text{st}$ unit.

> **Worked example.** A firm's cost of producing $x$ items is
> $C(x) = 10000 + 5x + 0.01x^2$ dollars. The marginal cost is
> $$
> C'(x) = 5 + 0.02x, \qquad C'(500) = 5 + 0.02(500) = 15 \text{ dollars/item}.
> $$
> At the production level $x = 500$, cost rises at \$15 per additional item.
> The actual cost of the $501$st item confirms the estimate:
> $$
> C(501) - C(500)
>  = \bigl[10000 + 5(501) + 0.01(501)^2\bigr]
>   - \bigl[10000 + 5(500) + 0.01(500)^2\bigr]
>  = 15.01,
> $$
> so $C'(500) \approx C(501) - C(500)$, differing only by the second-order term.

The population case is only approximate for the opposite
reason: a true head count is a step function, but for a large population the
smooth model $n = f(t)$ and its derivative are accurate enough to be useful.

## Related rates

In a related-rates problem, two or more quantities vary with time and are linked
by an equation. One rate of change is known (often because it is easy to
measure) and another is wanted. Differentiating the linking equation with
respect to time, via the chain rule, converts the known rate into the unknown
one.

> **Strategy (Related rates).** Work through these steps in order.
>
> - **Diagram.** Read the problem and draw the situation, labelling quantities
>   that change with time by variables, not by their current values.
> - **Translate.** Write the given rate and the required rate as derivatives with
>   respect to $t$.
> - **Relate.** Find an equation connecting the variables; use geometry to
>   eliminate any variable that is not needed.
> - **Differentiate** both sides with respect to $t$.
> - **Substitute** the known instantaneous values **last**, and solve for the
>   unknown rate.

The order matters. Substituting numerical values for the changing quantities
**before** differentiating replaces a variable by a constant, whose derivative is
zero, and produces a wrong answer. Hold the quantities general until after the
differentiation.

**Example (inflating balloon).** Air is pumped into a spherical balloon at
$\d V/\d t = 100$ cm³/s. How fast is the radius growing when $r = 25$ cm? The volume
relates the variables:

$$
V = \tfrac{4}{3}\pi r^3
\;\Longrightarrow\;
\frac{\d V}{\d t} = 4\pi r^2\,\frac{\d r}{\d t}
\;\Longrightarrow\;
\frac{\d r}{\d t} = \frac{1}{4\pi r^2}\,\frac{\d V}{\d t}.
$$

At $r = 25$, $\dfrac{\d r}{\d t} = \dfrac{100}{4\pi(25)^2} = \dfrac{1}{25\pi}
\approx 0.0127$ cm/s. Although $\d V/\d t$ is constant, $\d r/\d t$ is not: the radius
grows more slowly as the balloon enlarges.

$$
% caption: The inflating balloon. Pumping air in at dV/dt drives the radius
% outward at dr/dt through V = (4/3) pi r^3, so dr/dt = dV/dt over 4 pi r squared.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\fill[acc!10] (0,0) circle (1.55);
\draw[acc, thick] (0,0) circle (1.55);
\draw[black, dashed] (0,0) circle (2.0);
\draw[->, black!70] (0,0) -- (1.55,0);
\node[black!70, anchor=south] at (0.8,0.02) {$r$};
\fill[black] (0,0) circle (1.4pt);
\foreach \a in {45,135,225,315} \draw[->, black] (\a:1.62) -- (\a:1.98);
\draw[->, black, thick] (-3.1,-1.5) -- (-1.15,-1.05) node[midway, above, black] {$\dfrac{dV}{dt}$};
\node[black!70, anchor=west] at (2.05,-0.03) {$\dfrac{dr}{dt}$};
\end{tikzpicture}
$$

**Example (sliding ladder).** A $10$ ft ladder leans on a wall; its base slides
out at $\d x/\d t = 1$ ft/s. How fast does the top slide down when the base is $6$ ft
out? The Pythagorean constraint $x^2 + y^2 = 100$ differentiates to

$$
2x\,\frac{\d x}{\d t} + 2y\,\frac{\d y}{\d t} = 0
\;\Longrightarrow\;
\frac{\d y}{\d t} = -\frac{x}{y}\,\frac{\d x}{\d t}.
$$

When $x = 6$, the constraint gives $y = 8$, so
$\dfrac{\d y}{\d t} = -\dfrac{6}{8}(1) = -\dfrac{3}{4}$ ft/s. The negative sign says
the top is descending, at $\tfrac{3}{4}$ ft/s.

$$
% caption: The sliding ladder. With x^2 + y^2 = 100 fixed, the outward speed
% dx/dt of the base forces the downward speed dy/dt of the top.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (0,0) -- (0,4.5);
\draw[black, thick] (0,0) -- (4.7,0);
\draw[acc, very thick] (0,4) -- (3,0);
\node[acc, anchor=south west] at (1.35,1.95) {ladder $=10$};
\draw (0,0.32) -- (0.32,0.32) -- (0.32,0);
\node[black!70, anchor=north] at (1.5,-0.02) {$x$};
\node[black!70, anchor=east] at (-0.05,2.0) {$y$};
\draw[->, black, thick] (3,0) -- (4.0,0) node[right] {$\dfrac{dx}{dt}$};
\draw[->, black, thick] (0,4) -- (0,3.0) node[anchor=south east] {$\dfrac{dy}{dt}$};
\fill[black] (3,0) circle (1.6pt);
\fill[black] (0,4) circle (1.6pt);
\end{tikzpicture}
$$

**Example (draining vs. filling cone).** A tank is an inverted cone of base
radius $2$ m and height $4$ m; water enters at $\d V/\d t = 2$ m³/min. How fast is the
level rising when the depth is $h = 3$ m? The water forms a smaller cone; similar
triangles give $r/h = 2/4$, so $r = h/2$ and

$$
V = \tfrac{1}{3}\pi r^2 h = \tfrac{1}{3}\pi\Bigl(\tfrac{h}{2}\Bigr)^2 h
  = \frac{\pi}{12}\,h^3.
$$

Eliminating $r$ before differentiating is what keeps the problem in one unknown
rate. Differentiating,

$$
\frac{\d V}{\d t} = \frac{\pi}{4}\,h^2\,\frac{\d h}{\d t}
\;\Longrightarrow\;
\frac{\d h}{\d t} = \frac{4}{\pi h^2}\,\frac{\d V}{\d t}.
$$

At $h = 3$, $\dfrac{\d h}{\d t} = \dfrac{4(2)}{9\pi} = \dfrac{8}{9\pi}
\approx 0.28$ m/min.

$$
% caption: The filling cone. Similar triangles force r = h/2, so V = (pi/12) h^3,
% and a steady inflow dV/dt sets the rising rate dh/dt of the water level.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (-2,4) -- (0,0) -- (2,4);
\draw[black, thick] (-2,4) .. controls (-1,4.4) and (1,4.4) .. (2,4);
\draw[black, thick, dashed] (-2,4) .. controls (-1,3.6) and (1,3.6) .. (2,4);
\fill[acc!12] (-1.5,3) -- (0,0) -- (1.5,3) -- cycle;
\draw[acc, thick] (-1.5,3) .. controls (-0.75,3.3) and (0.75,3.3) .. (1.5,3);
\draw[acc, thick, dashed] (-1.5,3) .. controls (-0.75,2.7) and (0.75,2.7) .. (1.5,3);
\draw[<->, black] (-0.12,0) -- (-0.12,3);
\node[black!70, anchor=east] at (-0.18,1.5) {$h$};
\draw[<->, black] (0,3.02) -- (1.5,3.02);
\node[black!70, anchor=south] at (0.75,3.06) {$r$};
\node[black, anchor=south] at (-1.55,4.34) {$2$ m};
\draw[<->, black] (2.5,0) -- (2.5,4);
\node[black, anchor=west] at (2.55,2.0) {$4$ m};
\end{tikzpicture}
$$

**Example (approaching cars).** Car A drives west at $50$ mi/h and car B drives
north at $60$ mi/h toward the same intersection $C$. With $x$, $y$ the distances
to $C$ and $z$ the distance between the cars, $z^2 = x^2 + y^2$. The given rates
are $\d x/\d t = -50$ and $\d y/\d t = -60$ (both distances shrink). Differentiating,

$$
\frac{\d z}{\d t} = \frac{1}{z}\Bigl(x\,\frac{\d x}{\d t} + y\,\frac{\d y}{\d t}\Bigr).
$$

When $x = 0.3$, $y = 0.4$, then $z = 0.5$, and
$\dfrac{\d z}{\d t} = \dfrac{1}{0.5}\bigl[0.3(-50) + 0.4(-60)\bigr] = -78$ mi/h. The
cars close on each other at $78$ mi/h.

Some constraints come from similar triangles rather than the Pythagorean
theorem. A moving shadow is the standard case.

> **Worked example (moving shadow).** A street light sits atop a $15$ ft pole. A
> man $6$ ft tall walks away from the pole at $5$ ft/s. How fast does the tip of
> his shadow move when he is $40$ ft from the pole? Let $x$ be the man's distance
> from the pole and $s$ the length of his shadow. The lamp, the man's head, and
> the shadow tip are collinear, so the large and small triangles are similar:
> $$
> \frac{15}{x + s} = \frac{6}{s}
> \;\Longrightarrow\; 15s = 6x + 6s
> \;\Longrightarrow\; s = \tfrac{2}{3}x.
> $$
> The tip sits at distance $x + s = \tfrac{5}{3}x$ from the pole, so
> $$
> \frac{\d}{\d t}(x + s) = \frac{5}{3}\,\frac{\d x}{\d t}
>  = \frac{5}{3}(5) = \frac{25}{3} \approx 8.33 \text{ ft/s}.
> $$
> The rate carries no $x$: the shadow tip advances at $\tfrac{25}{3}$ ft/s
> whether the man is $40$ ft out or anywhere else on the path.

$$
% caption: The moving shadow. Similar triangles from the 15 ft lamp and the 6 ft
% man force the shadow length s = (2/3) x, so the tip moves at (5/3) dx/dt.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (-0.4,0) -- (4.5,0);
\draw[black!70, very thick] (0,0) -- (0,3);
\draw[acc, very thick] (2.2,0) -- (2.2,1.2);
\draw[black] (0,3) -- (3.667,0);
\fill[black] (0,3) circle (2.0pt);
\node[black!70, anchor=east] at (-0.05,1.5) {$15$};
\node[acc, anchor=east] at (2.12,0.62) {$6$};
\draw[<->, black] (0,-0.35) -- (2.2,-0.35) node[midway,below]{$x$};
\draw[<->, black] (2.2,-0.35) -- (3.667,-0.35) node[midway,below]{$s$};
\draw[->, black, thick] (2.25,0.16) -- (3.05,0.16);
\node[black, anchor=south, font=\scriptsize] at (2.78,0.42) {$\dfrac{dx}{dt}$};
\draw[->, black, thick] (3.72,0.16) -- (4.35,0.16);
\node[black, anchor=south, font=\scriptsize] at (4.05,0.34) {tip};
\fill[black] (2.2,0) circle (1.4pt);
\fill[black] (3.667,0) circle (1.4pt);
\end{tikzpicture}
$$

When the linking equation is trigonometric, the same steps produce an angular
rate.

> **Worked example (rotating searchlight).** A searchlight on the ground sits
> $20$ ft from a straight path and stays focused on a man walking along it at
> $4$ ft/s. How fast is the beam rotating when the man is $15$ ft from the point
> on the path nearest the light? Let $x$ be the man's distance from that nearest
> point and $\theta$ the angle between the beam and the perpendicular to the
> path, so $x = 20\tan\theta$. Differentiating with respect to $t$,
> $$
> \frac{\d x}{\d t} = 20\sec^2\theta\,\frac{\d\theta}{\d t}
> \;\Longrightarrow\;
> \frac{\d\theta}{\d t} = \frac{1}{20}\cos^2\theta\,\frac{\d x}{\d t}.
> $$
> When $x = 15$ the beam has length $\sqrt{15^2 + 20^2} = 25$, so
> $\cos\theta = \tfrac{20}{25} = \tfrac{4}{5}$, and
> $$
> \frac{\d\theta}{\d t} = \frac{1}{20}\Bigl(\tfrac{4}{5}\Bigr)^2 (4)
>  = \frac{16}{125} = 0.128 \text{ rad/s}.
> $$

