Algebraic Formula For Distance