Hi Samatha,
In this case you have a right triangle.
One side is the ladder and we will use x for it's length
another side is the wall of the building and it's lenght is x-3
and the third side is the ground and that is 15 ft
so
using the pythagorean theorem
x2 = (x-3)2 + 152
x2 = x2 -6x + 9 + 225
6x = 234
x = 39
so the ladder is 39 ft long
the wall of the building is 36 ft long
and the ground is 15ft
Hope this helps