Deriving The Distance Formula