Distance Formula In Geometry And Algebra