CE represents the ladder, x=CD, the distance of the foot of the ladder from the high wall, AC=x-3; fence height=AB=8; y=DE is the height of the end of the ladder against the wall.
y/x=8/(x-3), so y=8x/(x-3).
The length of the ladder, L=√(x²+y²)=√(x²+(8x/(x-3))²).
We can see that x=3 gives us an infinitely long ladder, so this looks like a maximum!
So L=x√(1+64/(x-3)²)=(x/(x-3))√(x²-6x+73), or
L²=(x⁴-6x³+73x²)/(x-3)².
The max or min length of the ladder is found by putting dL/dx=0.
So, differentiating:
2LdL/dx=((x-3)²(4x³-18x²+146x)-2(x⁴-6x³+73x²)(x-3))/(x-3)⁴=0.
We can ignore the denominator and solve for numerator=0.
(x²-6x+9)(4x³-18x²+146x)-(2x-6)(x⁴-6x³+73x²)=0
4x⁵ -18x⁴+146x³
-24x⁴+108x³-876x²
36x³-162x²+1314x
-2x⁵+12x⁴-146x³
6x⁴ -36x³+438x²=0,
2x⁵-24x⁴+108x³-600x²+1314x=0,
x⁴-12x³+54x²-300x+657=0=(x-3)(x³-9x²+27x-219).
However, if x=3, y→∞.
The other root of this is x=8.769 approx making y=8×8.769/5.769=12.16 ft approx. So L=√(8.769²+5.769²)=√224.765=14.99ft. approx.