Problem statement: We are 3 friends at 3 different locations $A, B, C$ and want to reach a location $D$. Each person will take a separate cab to a common meeting point $E$, and then take a single cab from $E$ to $D$.
How can I find the point $E$ which minimizes the total distance traveled by all four cabs?
If $E$ is the common meeting point, you are trying to solve
$$\min_E \|A-E\| + \|B-E\| + \|C-E\| + \|D-E\|$$
The solution to this optimization problem is the geometric median $E$ of the three friends and the destination point $D$. In general computing the geometric median is not straightforward, but in the special case of four points there is an easy algorithm:
1) If one of the four points lies in the triangle formed by the others, take $E$ to be that point. In this case all friends travel directly to $D$ (if this is the inside point) or two friends first travel to the third and then all friends travel together to $D$.
2) Otherwise, the four points form a quadrilateral. Draw the diagonals and take $E$ to be the intersection point.
It's not so obvious why this algorithm correctly identifies the median; proofs are given here.