On this page
When a ladder leans against a building and passes over a fence or a wall, the geometry of the situation restricts how short the ladder can be. If you place the ladder at a steep angle, it clears the wall easily but has to be very long to reach all the way down to the ground. If you place it at a shallow angle, it has to stretch a long way horizontally before it finally meets the building. Somewhere in between lies the perfect balance. Calculus gives us an exact method for finding that optimal angle and the minimum possible length.
Optimization problems are a core part of learning calculus because they connect abstract equations to physical geometry. To solve them, you have to constrain your variables. Because the ladder touches the ground, the wall, and the building in a straight line, the angle it makes with the ground is the only independent variable you need to control.
What is the shortest ladder that reaches over a wall to a building?
Imagine a wall of height a standing at a distance b from a tall building. You need a ladder to reach from the ground, pass exactly over the top of the wall, and lean against the building. The minimum length L of this ladder is exactly (a^(2/3) + b^(2/3))^(3/2).
According to Paul's Online Math Notes, this is an optimization problem that tests your ability to set up a geometric function and differentiate it. By expressing the ladder's length in terms of a single variable, you can use the first derivative test to find the shortest possible length, much like finding the absolute maximum and minimum on a closed interval.
How do you set up the ladder length as a function of its angle?
To use calculus, you first need a formula for the ladder's total length. Let θ be the angle the ladder makes with the ground. The ladder is made of two straight segments:
Ground to the wall: The wall has a vertical height a. In the right-angled triangle formed by the ladder, the wall, and the ground, the length of the ladder up to the wall is a / sin(θ). The horizontal distance from the foot of the ladder to the wall is a cot(θ).
Wall to the building: The horizontal distance from the wall to the building is b. In the right-angled triangle between the wall and the building, the length of this upper part of the ladder is b / cos(θ).
Adding these two pieces together gives the total length L as a function of the angle θ:
L(θ) = a / sin(θ) + b / cos(θ)
If you are stuck on translating a physical scenario into a mathematical function like this, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
How do you find the minimum length using derivatives?
To find the shortest possible ladder, take the derivative of L(θ) with respect to θ and set it to zero. If you are comfortable differentiating one expression with respect to another, you can use the quotient rule or the chain rule on the reciprocal trigonometric functions:
dL/dθ = −a csc(θ) cot(θ) + b sec(θ) tan(θ)
Setting this derivative to zero gives the turning point where the length is minimised:
a csc(θ) cot(θ) = b sec(θ) tan(θ)
Writing this entirely in terms of sine and cosine makes it easier to solve:
a (1 / sin(θ)) (cos(θ) / sin(θ)) = b (1 / cos(θ)) (sin(θ) / cos(θ))
a (cos(θ) / sin²(θ)) = b (sin(θ) / cos²(θ))
By cross-multiplying, we group the sine terms on one side and the cosine terms on the other:
sin³(θ) / cos³(θ) = a / b
tan³(θ) = a / b
So, the optimal angle θ for the shortest ladder is the one where tan(θ) = (a/b)^(1/3).
Where does the (a^(2/3) + b^(2/3))^(3/2) result come from?
Now that we know the best angle, we substitute it back into our original length formula to find the actual minimum length.
From tan(θ) = (a/b)^(1/3), we can draw a reference right-angled triangle where the "opposite" side is a^(1/3) and the "adjacent" side is b^(1/3). By Pythagoras' theorem, the hypotenuse of this reference triangle is √((a^(1/3))² + (b^(1/3))²) = √(a^(2/3) + b^(2/3)).
Reading the sine and cosine from this triangle:
sin(θ) = a^(1/3) / √(a^(2/3) + b^(2/3))
cos(θ) = b^(1/3) / √(a^(2/3) + b^(2/3))
Substitute these back into the original length equation L = a / sin(θ) + b / cos(θ):
L = a / (a^(1/3) / √(a^(2/3) + b^(2/3))) + b / (b^(1/3) / √(a^(2/3) + b^(2/3)))
L = a^(2/3) √(a^(2/3) + b^(2/3)) + b^(2/3) √(a^(2/3) + b^(2/3))
Factor out the common square root:
L = (a^(2/3) + b^(2/3)) √(a^(2/3) + b^(2/3))
Since a number multiplied by its own square root is that number to the power of 3/2, the final minimum length simplifies to the elegant result:
L = (a^(2/3) + b^(2/3))^(3/2)
A worked example with numbers
Let's put this into practice with a numerical example. Suppose a fence of height 27 cm stands at a distance of 64 cm from a building. What is the shortest ladder that can reach over the fence to the building?
Here, a = 27 and b = 64. First, find a^(2/3) and b^(2/3):
27^(1/3) = 3, so 27^(2/3) = 3² = 9.
64^(1/3) = 4, so 64^(2/3) = 4² = 16.
Add them together:
9 + 16 = 25.
Finally, raise the sum to the power of 3/2 (which means taking the square root, then cubing it):
√25 = 5.
5³ = 125.
The shortest ladder is exactly 125 cm long. The angle it makes with the ground is arctan(3/4), which is approximately 36.9°. You can apply the exact same method when differentiating parametric functions in other optimisation problems to find turning points cleanly.



