In any right triangle, a² + b² = c², where a and b are the legs and c is the hypotenuse (the side opposite the right angle).
If you know two sides, you can find the third. Given legs 3 and 4, the hypotenuse is √(3² + 4²) = √(9 + 16) = 5. Given hypotenuse 13 and leg 5, the other leg is √(13² - 5²) = √(169 - 25) = 12.
This theorem powers the distance formula, collision detection, and any problem involving diagonal movement.