In the Pythagorean Theorem, a right triangles hypotenuse is found by a^2 +b^2= c^2. The distance formula is basically the same thing. With two points, a right triangle can be formed and the slop would be the hypotenuse. That's where the distance formula comes from