A ladder is to be carried down a hallway

Above you can see a crude picture of the situation. The red bar represents
the ladder to be carried. Click on **Play** to see the animation. You can
change the values of *p* and *q* as well as the length of the ladder.

Now let's solve the problem. First instead of trying to find the maximal length
let's see how to determine if a ladder of a given length *l* can be carried
safely around the corner.

On the picture above we can see the critical moment. The ladder is represented
by a red line segment *AB* of length *l*. It is easy to find the coordinates
of *B* in terms of *a*:
.
So the equation
of a line passing through *AB* is

The most important point on the picture is

Otherwise we have

So if

then we can carry the ladder without getting stuck if and only if

If we find the minimum of on (0,

The second derivative tells us that is concave up, so its critical value is a minimum. Let's solve

for

If we have the values of

If
,
then our ladder has the biggest possible length.
So in order to find the length of the longest ladder plug *a*_{0} expressed in
terms of *p*, *q*, *l* into

and solve it for

This page and the Java applet were written by Marek Szapiel.