Bradford T. answered 01/10/23
Retired Engineer / Upper level math instructor
Let L be the length of the ladder. Let y be the length of the ladder from the building to the top of the fence.
Let z be the length of the ladder from the top of the fence to the ground. Let θ be the angle of the ladder
from the ground to the ladder. This is the same angle for the similar triangle for the ladder from the top of the fence leaning against the building.
L = y + z
cosθ = 2/y --> y = 2/cosθ
sinθ = 10/z --> z = 10/sinθ
1) L(θ) = 2/cosθ + 10/sinθ
2) L'(θ) = 2secθtanθ - 10cscθcotθ = 2sinθ/cos2θ - 10cosθ/sin2θ
3) 2sinθ/cos2θ - 10cosθ/sin2θ = 0
(2sin3θ-10cos3θ)/(sin2θcos2θ)
2sin3θ = 10cos3θ
tan3θ=5
θ = tan-1(51/3) ≈ 60°
L(60) = 2/cos(60) + 10/sin(60) ≈ 4+11.5 = 15.5 feet