The altitude of the larger triangle bisects (cuts in half) the right angle, meaning we have two 45° angles.
There is a special kind of right triangle, that is, a right isosceles triangle, or 45°-45°-90° triangle. We form two of these triangles when we split the larger one in half as shown.
When this is the case, as a direct consequence of the Pythagorean Theorem, the sides are in a ratio of 1:1:√2.
The 18 is actually irrelevant to us... All we need to realize is that the side labeled 12 is congruent to the side labeled a + 5, which means that
[tex]12=a+5\\a=7[/tex].