The Pythagorean theorem states that in any right triangle, the sum of the squares of the two shorter sides equals the square of the longest side. It is used for right triangles, which have one 90 degree angle. The distance formula calculates the distance between two points by taking the difference of the x-coordinates squared and the difference of the y-coordinates squared, adding those values, and taking the square root of the sum. An example is worked out step-by-step to demonstrate using the distance formula.