It was just applying the pythagorean theorem (that the sum of the squares of the lengths of the two shorter sides of a right triangle equals the square of the length of the longest side).
If I'm not mistaken, it was actually the converse of the Pythagorean Theorem (which is also true): if the sum of the squares of two sides equals the sum of the square of the other side, then it's a right triangle.