Applying the Pythagorean theorem