As instructed, use the angle x the ladder makes with the ground as a variable.
Let also L= length of ladder as a function of x.
Need to find shortest ladder that will do the job.
Ladder cannot be short than 5' which is distance of fence from building.
Distance between fence and building is 5'
Length of ladder in this section is 5'/cos(x)
Height of fence = 2'
length of ladder outside of fence = 2'/sin(x).
Total length of ladder
L(x)= 5/cos(x)+2/sin(x)=5sec(x) + 2csc(x)
to find minimum length of ladder, we equate L'(x)=0.
L'(x)=5sin(x)/cos^2(x) - 2cos(x)/(sin^2(x)
=[5sin^3x-2cos^3(x)]/(cos^2(x)sin^2(x))
equating L'(x)=0 =>
[5sin^3x-2cos^3(x)] =>
tan^3(x)=2/5
tan(x)=(2/5)^(1/3)=0.7368
x=36.383 degrees
L(36.383)=9.582 ft.
Double check this is a minumum, check
L(36)=9.583 > 9.582
L(37)=9.584 > 9.582 so ok.
Alternatively, check that L"(x)>0.