you have to find the x in a right triangle and to find that, you have to use pythagorean theorem.
a² + b² = c² where a and b are the legs and c is the hypotenuse.
18² + b² = 25²
324 + b² = 625
b² = 625 - 324
b² = 301
b = √301 or b = 17.349
hope this helped, God bless!