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

#### 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.

Last edited:

#### dwsmith

MHF Hall of Honor
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.

#### BigC

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.

#### dwsmith

MHF Hall of Honor
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.

#### BigC

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.

#### dwsmith

MHF Hall of Honor
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?