# Ladder Optimization Problem

A fence 4 feet tall runs parallel to a tall building at a distance of 4 feet from the building.

What is the length of the shortest ladder that will reach from the ground over the fence to the wall of the building?

Here are some hints for finding a solution: Use the angle that the ladder makes with the ground to define the position of the ladder and draw a picture of the ladder leaning against the wall of the building and just touching the top of the fence.

If the ladder makes an angle 1.04 radians with the ground, touches the top of the fence and just reaches the wall, calculate the distance along the ladder from the ground to the top of the fence. Using these hints write a function L (x) which gives the total length of a ladder which touches the ground at an angle x , touches the top of the fence and just reaches the wall.

• How "tall" is the building? – Markus Unterwaditzer Apr 15 '14 at 21:33
• I'm not given how tall the building is – ladipo Apr 15 '14 at 21:37
• I'm unsure how to proceed then. Because it could be smaller than the fence, in which case you're going to have a hard time touching it with a ladder (assuming the ladder doesn't bend) – Markus Unterwaditzer Apr 15 '14 at 21:38
• This is a problem that appears in many textbooks. The height of the wall is unimportant: the ladder only needs to make contact with it on one side of the fence and touch the ground on the other side. So the ladder can also lay across the top of the fence. This means you can set up similar triangles. – colormegone Apr 15 '14 at 21:49
• You are supposed to assume the building is tall enough – Ross Millikan Apr 15 '14 at 21:49

## 3 Answers

Here is a 'trigonometry-free' approach:

Let $(0,0)$ be where the wall meets the ground. The ladder touches the ground at $(x_1,0)$, with $x_1 \ge 4$, and the wall at $(0,x_2)$. The ladder must not pass below the point $(4,4)$. We want to minimize the length (well, length squared to keep formulae simple) $x_1^2+x_2^2$. The locus of the ladder is $t (x_1,0)+(1-t )(0,x_2) = (t x_1, (1-t)x_2)$ for $t \in [0,1]$. The $x$ coordinate of the ladder is 4 when $t x_1 = 4$, that is $t = {4 \over x_1}$. Hence the fence constraint is $(1-{ 4 \over x_1}) x_2 \ge 4$, or $x_1 x_2 -4(x_1+x_2) \ge 0$.

This results in the problem is $\min \{x_1^2+x_2^2 | x_1 x_2 -4(x_1+x_2) \ge 0, x_1 \ge 4 \}$.

Note also that the fence constraint can be written as $x_2 \ge { 4 x_1 \over x_1 -4} = { 4 \over 1 - { 4 \over x_1} } \ge 4$ so the problem is equivalent to the problem $\min \{x_1^2+x_2^2 | x_1 x_2 -4(x_1+x_2) \ge 0, x_1 \ge 4, x_2 \ge 4 \}$

We note that the cost is strictly convex, and both the constraints and cost are symmetric. Furthermore, if $(x_1,x_2)$ satisfies the constraints, so does $({x_1+x_2 \over 2}, {x_1+x_2 \over 2} )$, since $\left( { x_1 + x_2 \over 2 } \right)^2 - x_1 x_2 = {1 \over 4} (x_1-x_2)^2 \ge 0$. Consequently, we may take $x_1 = x_2$ without loss of generality.

Hence the problem reduces to $\min \{ x^2 | x^2-8 x \ge 0, x \ge 4 \}$, which is solved by inspection to get the minimizer $x=8$, and so the minimum ladder length is $8 \sqrt{2}$.

Hint: In the picture below, the rectangle is the building, the vertical line is the fence, $AC$ is the ladder. The $4$'s are taken from the problem description. We want to find $x$ to minimize $AC$. You can find $AB$ as a function of $d$ by the Pythagorean theorem, then find $AC$ as a function of $d$ by similar triangles. Take the derivative, set to zero... Then use an inverse trig function to find $x$. • @RecklessReckoner: I changed the variables to match the question. Thanks – Ross Millikan Apr 15 '14 at 22:11

Here's the diagram for this problem: The "foot" of the ladder is some distance $\ d \$ from the fence and makes an angle $\ x \$ radians above the horizontal. It may touch the top of the fence, so it must be 4 feet off the ground at $\ d \$ feet from the ladder's foot. At $\ d + 4 \$ feet from its foot, the ladder meets the wall $\ h \$ feet above the ground. The length of the ladder acts as the hypotenuse of a right triangle, so that length is given by $\ L^2 \ = \ h^2 \ + \ (d+4)^2 \$ .

You will need to work out $\ h \$ and $\ d \$ as functions of the angle $\ x \$ (trigonometry!) , in order to get $\ L \$ as a function of that angle. [Alternatively, $\ L \$ can be expressed in terms of the other sides of the triangle using trigonometric ratios.] That function then is what you are minimizing.