A fence 8 ft tall runs parallel to a tall building at a distance of 4 ft 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?

I have set up the picture and understand the question -- can someone just please explain how to solve the problem? (what the equation is, and the process for maximizing/minimizing stuff like this)

Thanks!