Applications of Distance Formula