The Pythagorean theorem uses two legs and a hypotenuse in a right triangle to relate the lengths of the sides. It is used to solve for the unknown side of a right triangle. The distance formula calculates the distance between any two points by using their x and y coordinates in the formula and solving for the distance. An example shows using the distance formula to solve for the distance between points (3,0) and (7,4).