Related Rates
In a related-rates problem two or more quantities are linked by an equation and all change with time. Differentiating the equation with respect to time links their rates, so a rate you can measure gives you a rate you cannot. This lesson gives a reliable procedure, works through geometric examples in SymPy and checks them by simulation.
The gentle version is in Related Rates; here we lean on Implicit Differentiation and the chain rule.
Why it works
If and satisfy for every , then the function is identically zero, so its derivative is zero. The chain rule turns that derivative into a linear equation in and :
Given , and one rate at a single instant, solve for the other rate.
The procedure
- Draw a picture; name every quantity that changes with time as a function of .
- Write the given rates and the wanted rate as derivatives (, find ).
- Write an equation linking the quantities that holds at every time. Use geometry (Pythagoras, similar triangles, volume formulas) to eliminate quantities whose rate you don't know.
- Differentiate both sides with respect to (chain rule).
- Only now substitute the values at the instant of interest, and solve.
Tip: The classic mistake is substituting numbers before differentiating. If you set first, becomes a constant and its rate vanishes.
Example: filling a conical tank
A tank shaped like an inverted cone has height 6 m and top radius 2 m. Water flows in at . How fast is the water level rising when the water is 3 m deep?
By similar triangles , so at every time. Then
import sympy as sp
t = sp.symbols('t')
h = sp.Function('h')(t)
V = sp.pi * h**3 / 27
dVdt = sp.diff(V, t)
print("dV/dt =", dVdt)
rate = sp.solve(sp.Eq(dVdt, sp.Rational(1, 2)), sp.diff(h, t))[0]
at3 = rate.subs(h, 3)
print("dh/dt at h = 3:", at3, "≈", round(float(at3), 5), "m/min")dV/dt = pi*h(t)**2*Derivative(h(t), t)/9
dh/dt at h = 3: 1/(2*pi) ≈ 0.15915 m/min
SymPy prints Derivative(h(t), t) for ; h(t) is an unknown function of time, which is exactly how we treat it by hand.
Example: a sliding ladder, checked by simulation
A 5 m ladder leans against a wall. Its foot slides away at . How fast is the top sliding down when the foot is 3 m from the wall?
A simulation does not need calculus at all: move the foot in tiny time steps, recompute the top, and difference.
import math
L, speed = 5.0, 0.4
def top(t):
x = 3.0 + speed * t # foot position, x = 3 at t = 0
return math.sqrt(L**2 - x**2)
for dt in [0.1, 0.01, 0.001]:
central = (top(dt) - top(-dt)) / (2 * dt)
print(f"dt = {dt:<6} dy/dt ≈ {central:.6f}")
print("formula:", round(-3 * speed / 4, 6))dt = 0.1 dy/dt ≈ -0.300023
dt = 0.01 dy/dt ≈ -0.300000
dt = 0.001 dy/dt ≈ -0.300000
formula: -0.3
Notice that blows up as : the model claims the top falls infinitely fast at the end. In reality the top leaves the wall before that, so the equation stops describing the physics. Always check that a model's assumptions still hold at the instant you care about.
Example: angle of elevation
A drone rises vertically at from a point 40 m from an observer. How fast is the angle of elevation changing when the drone is 30 m up?
Angles must be in radians for to hold.
In software
- Cameras in games: a camera tracking a moving target needs the rate at which the bearing angle changes, the same computation as the drone example; it drives smooth turret or camera rotation.
- Robotics: inverse kinematics relates joint-angle rates to end-effector velocity through the Jacobian, a many-variable related-rates equation.
- Physics engines: constraints such as "rope length stays " are enforced by differentiating the constraint in time (), exactly step 4 of the procedure.
- Autodiff frameworks compute these time derivatives mechanically with the chain rule.
Exercises
Exercise 1: Growing circle
A ripple's radius grows at . How fast is the enclosed area growing when the radius is 10 cm?
Answer
Solution
Exercise 2: Shadow
A 1.8 m person walks away from a 6 m street lamp at . How fast does the tip of the shadow move?
Answer
(away from the lamp)
Solution
Let be the person's distance from the lamp and the tip's distance. Similar triangles:
The answer does not depend on where the person is.
Exercise 3: Inflating balloon
Air is pumped into a spherical balloon at . How fast is the radius increasing when the diameter is 20 cm? Check with SymPy.
Answer
Solution
import sympy as sp
t = sp.symbols('t')
r = sp.Function('r')(t)
eq = sp.Eq(sp.diff(sp.Rational(4, 3) * sp.pi * r**3, t), 100)
rp = sp.solve(eq, sp.diff(r, t))[0].subs(r, 10)
print(rp, round(float(rp), 4))1/(4*pi) 0.0796
Exercise 4: Two ships
Ship A sails north at 12 km/h, ship B sails east at 16 km/h, both leaving the same port at noon. How fast is the distance between them changing at 2 pm?
Answer
20 km/h (constant at every time).
Solution
Indeed , so always.
Test yourself
In a related-rates problem, when should you substitute the numerical values of the changing quantities?
- Before writing the equation
- Before differentiating
- After differentiating with respect to time
- Never
with , and . What is ?