Let h be the height of the wall in feet and x the length of the ladder, also in feet.
First we have: x = h + 2.
When the top of the ladder is placed against the top of the wall a right triangle forms, with x the hypotenuse and h the vertical leg.
Now the distance from the base of the ladder to the wall is equal to the height of the wall. This means the other leg , the horizontal one, measures the same as h.
Pythagoras' Theorem tells us that x2 = h2 + h2 = 2h2.
But, since x = h + 2 we have:
(h+2)2 = 2h2
or
(h2 + 4h + 4) = 2h2
or
h2 - 4h - 4 = 0
This quadratic equation has solutions:
2 - 2√2 which is negative and
2 + 2√2 which is positive and the right answer: approximately 4.83
Hope this helps!