How do I solve this optimization question? 
A fence 8 feet tall runs parallel to a tall building at a distance of 2 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?

My Work
Let $y$ represent the horizontal distance from the fence to the bottom of the ladder. Let $x$ represent the vertical distance from the building to the top of the fence.
Then, the solution would be the local minimum of the function:
$L = (x+8)^2 + (y+2)^2$
with the constraint:
$$\frac{x+8}{y+2} = \frac{8}{y}$$
Finding the derivative of the function gives:
$L ^\prime = -x^4 - x^3 + 256x + 512$
I am not allowed to use a calculator, so how do I find the shortest length?
Thanks
 A: It is clear that the shortest ladder will lean against the fence. Poor fence!
Let  $t$ be the angle the ladder makes with the ground. Then the distance from the foot of the ladder to the bottom of the fence is $8\cot t$. Thus the distance of the foot of the ladder to the building is $2+8\cot t$. It follows that the ladder has length $L(t)=(2+8\cot t)\sec t$. This can be expressed as 
$$L(t)=\frac{2}{\cos t} +\frac{8}{\sin t}.$$
Differentiation gives
$$L'(t)=\frac{2\sin t}{\cos^2 t} -\frac{8\cos t}{\sin^2 t}.$$
Set $L'(t)$ equal to $0$, solve. We get $\tan t=\sqrt[3]{4}$. Since $L'(t)\lt 0$ for $t\lt \sqrt[3]{4}$, and positive for $t\gt \sqrt[3]{4}$, we do attain a minimum at $t=\sqrt[3]{4}$. 
A: I get the following equations using your approach:
$$L = (x+2)^2+(y+8)^2, \qquad \frac{y+8}{x+2}= \frac8x$$
The similarity constraint quickly gives $y = \dfrac{16}x$.  Using this, we have the square of the ladder length as
$$L = x^2+4x+\frac{256}x + \frac{256}{x^2}+68$$
and we can get $L'$ in a factored form (after identifying the factor $(x+2)$ by inspection,
$$L' = 2 \frac{(x^3-128)(x+2)}{x^3}$$
Now can you see for what value of $x$ we can get a minimum for the ladder length?
