Let's call the base of the smaller triangle as x and the height of the building as h.
In a right triangle, the tangent of an angle is the length of the opposite side divided by the length of the adjacent side. From this statement, for the smaller triangle we have the following relation
Rewritting this equation as a function for x, we have
For the bigger triangle, we can use the same trigonometric relation.
If we substitute the expression for x on this equation, we're going to have a new equation only for the height of the building
Solving for h, we have