# Thread: Point that is at the shortest total distance from multiple points

1. ## Point that is at the shortest total distance from multiple points

This question is purely for curiosity's sake:

Suppose I have a collection of points on a 2D plane {P1, P2,..., Pn}

How would I find the point X such that the sum of the magnitude of all vectors (||PnX||) is the smallest possible.

2. Originally Posted by BigC
This question is purely for curiosity's sake:

Suppose I have a collection of points on a 2D plane {P1, P2,..., Pn}

How would I find the point X such that the sum of the magnitude of all vectors (||PnX||) is the smallest possible.
The line of best fit.

3. Originally Posted by dwsmith
The line of best fit.
I thought it would involve a least-squares approximation. Could you be more clear on how to use the line of best fit to find my point X?

The points {P1,...,Pn} could be completely randomly placed.

4. Originally Posted by BigC
I thought it would involve a least-squares approximation. Could you be more clear on how to use the line of best fit to find my point X?

The points {P1,...,Pn} could be completely randomly placed.
The line of best fit uses least-squares. If your points are in a linear fashion, you can come up with a line, y=mx+b, where the magnitude is minimized. The line you achieve will be the line of best fit. Of course, we could do this for circles, quadratics, polynomials, etc.

5. Originally Posted by dwsmith
The line of best fit uses least-squares. If your points are in a linear fashion, you can come up with a line, y=mx+b, where the magnitude is minimized. The line you achieve will be the line of best fit. Of course, we could do this for circles, quadratics, polynomials, etc.
Bah, this is way simpler than I thought it was. Just clicked that all I need is the average of the points.

6. Originally Posted by BigC
How would I find the point X such that the sum of the magnitude of all vectors (||PnX||) is the smallest possible.
By this, do you mean to say: how would I find the point X such that the sum of all magnitudes of points are the smallest from the point X?