Using Pythagorean Theorem to find distance