deriving the distance formula in three-dimensional space deriving the distance formula in three-dimensional space