This formula uses trigonometry, finding the "A" and "B" variables by finding the difference of the x and y values of both points, then uses the Pythagorean theorem, A*A + B*B = C*C.