I have 3 points X,Y,Z, lets call them buildings.

I need to find the shortest amount of path that connects the 3 buildings, these buildings can be in any sort of shape and any distance from each other, lets call the distance between each building xy, xz, yz.

I know that the paths need to converge at a point, but I am unsure how to get there given the information I have.

If they formed an equilateral triangle it would look like (or at least I think):

   / \
  Y   Z

But they can be in any shape and that's only one of them, I need help finding the equation(s) that will give the shortest path connecting all 3 of the buildings.

I was thinking of using the Pythagorean Theorem but am not 100% sure, I was also thinking about using Lagrange Multipliers but with the information given am not sure how to implement them.

I'm just looking for a push in the right direction, I don't need the full solution (it would help but not needed.) If you need any more information about the problem I can try my best but this is about all I have.

  • 5
    $\begingroup$ See if this helps. $\endgroup$
    – David
    May 30, 2014 at 0:15
  • $\begingroup$ Thanks, this really does help a lot! $\endgroup$
    – Molten
    May 30, 2014 at 3:15

1 Answer 1


I believe that Napoleon (himself!) was interested in this problem.

Distinguish between two cases.

  1. If the given triangle has an angle that exceeds ${2\pi}\over 3$, then that particular vertex itself is the point you seek. In this case, the sought-after minimum total distance is comprised of the two shortest sides.

  2. OTHERWISE, the point can be constructed as follows: On each of the three sides, construct an outward-pointing equilateral triangle. Connect each outward point with the opposing vertex of the original triangle. The three connecting lines are concurrent, and their common point (the Fermat point, or the first isogonal center of the triangle) is the point you seek. Lines drawn from this point to the three original vertices are the paths whose total length constitutes the sought-after minimum total distance.

  • $\begingroup$ This was very helpful, especially along if David's link to get visualization of what you said. My one other question now that I have these lengths (I call them PX, PY, PZ, where P is the Fermat Point) How do I get the lengths of PX, PY, and PZ? I've been trying to manipulate the new triangles that formed and haven't had any luck. $\endgroup$
    – Molten
    May 30, 2014 at 3:25
  • $\begingroup$ @Molten The lengths of the three segments can be obtained by subtractions of corresponding coördinates followed by application of the Pythagorean theorem. Senex $\endgroup$ May 30, 2014 at 3:39
  • $\begingroup$ What exactly do you mean by corresponding coordinates? I also just realized I don't have a way of getting the actual location of P. $\endgroup$
    – Molten
    May 30, 2014 at 5:12
  • $\begingroup$ I can see the triangles I'm trying to use the Pythagorean theorem on but am having a hard time getting the lengths in order to do so. For example, X the triangle I am seeing is: sqrt(PC(Where C is the new point created opposite of Z) ^2 - XC ^2). But this still leaves me with the unknown PC (which is ZC - PZ which are both unknowns) $\endgroup$
    – Molten
    May 30, 2014 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .