Answer:
16.65 ft
Explanation:
You want the shortest ladder that will reach over a 4 ft fence to the wall of a house that is 8 ft from the fence.
Triangles
The attached diagram shows the geometry of the problem can be modeled by similar triangles ∆FBG and ∆HDF. These are right triangles, so the length of the hypotenuse can be found using the Pythagorean theorem:
FG² = FB² +BG²
FG² = 4² +x² . . . . . . . . where BG = x
FG = √(16 +x²)
Ladder length expression
Similar triangle HDF has a scale factor with respect to ∆FBG that is ...
scale factor = DF/BG = 8/x
Then the length HF is ...
HF = (8/x)FG
And the total length of the ladder is ...
HG = FG +HF
HG = √(16 +x²) + (8/x)√(16 +x²) = (1 +8/x)√(16 +x²)
Minimum length
The length will be minimized when the derivative of the ladder length expression with respect to x is zero.
HG' = 0 = (x²(x+8) -8(x² +16))/(x²√(16+x²))
0 = x³ -128
x = ∛128 ≈ 5.03968
Using this value of x in the ladder length expression, we find the minimum length ladder to be ...
HG = (1 +8/5.03968)√(16 +5.03968²) ≈ 16.6478
The shortest ladder that can extend over the fence to the house is 16.65 feet long.
__
Additional comment
It extends about 10.35 feet up the side of the house, and 5.04 feet beyond the fence. There is more than enough extra space available.
The problem statement requires the ladder not touch the fence. Since we have rounded up the length, it need not touch the fence if there is no sag (the ladder is a straight line). With the given rounded values, it will clear the fence by about 0.003 inches.