# Geometric median

Template:Distinguish
The **geometric median** of a discrete set of sample points in a Euclidean space is the point minimizing the sum of distances to the sample points. This generalizes the median, which has the property of minimizing the sum of distances for one-dimensional data, and provides a central tendency in higher dimensions. It is also known as the **1-median**,^{[1]} **spatial median**,^{[2]} **Euclidean minisum point**,^{[2]} or **Torricelli point**.Template:Sfnp

The geometric median is an important estimator of location in statistics,Template:Sfnp where it is also known as the ** L_{1} estimator**.

^{[3]}It is also a standard problem in facility location, where it models the problem of locating a facility to minimize the cost of transportation.Template:Sfnp

The special case of the problem for three points in the plane (that is, *m* = 3 and *n* = 2 in the definition below) is sometimes also known as Fermat's problem; it arises in the construction of minimal Steiner trees, and was originally posed as a problem by Pierre de Fermat and solved by Evangelista Torricelli.Template:Sfnp Its solution is now known as the Fermat point of the triangle formed by the three sample points.Template:Sfnp The geometric median may in turn be generalized to the problem of minimizing the sum of *weighted* distances, known as the Weber problem after Alfred Weber's discussion of the problem in his 1909 book on facility location.^{[2]} Some sources instead call Weber's problem the Fermat–Weber problem,Template:Sfnp but others use this name for the unweighted geometric median problem.Template:Sfnp

Template:Harvtxt provides a survey of the geometric median problem. See Template:Harvtxt for generalizations of the problem to non-discrete point sets.

## Definition

Formally, for a given set of *m* points with each , the geometric median is defined as

Note that *argmin* means the value of the argument which minimizes the sum. In this case, it is the point from where the sum of all Euclidean distances to the 's is minimum.

## Properties

- For the 1-dimensional case, the geometric median coincides with the median. This is because the univariate median also minimizes the sum of distances from the points.
^{[4]} - The geometric median is
**unique**whenever the points are not collinear.^{[5]} - The geometric median is equivariant for Euclidean similarity transformations, including translation and rotation.
^{[4]}^{[3]}This means that one would get the same result either by transforming the geometric median, or by applying the same transformation to the sample data and finding the geometric median of the transformed data. This property follows from the fact that the geometric median is defined only from pairwise distances, and doesn't depend on the system of orthogonal Cartesian coordinates by which the sample data is represented. In contrast, the component-wise median for a multivariate data set is not in general rotation invariant, nor is it independent of the choice of coordinates.^{[3]} - The geometric median has a breakdown point of 0.5.
^{[3]}That is, up to half of the sample data may be arbitrarily corrupted, and the median of the samples will still provide a robust estimator for the location of the uncorrupted data.

## Special cases

**For 3 (non-collinear) points,**if any angle of the triangle formed by those points is 120° or more, then the geometric median is the point making that angle. If all the angles are less than 120°, the geometric median is the point inside the triangle which subtends an angle of 120° to each three pairs of triangle vertices.^{[4]}This is also known as the Fermat point of the triangle formed by the three vertices. (If the three points are collinear then the geometric median is the point between the two other points, as is the case with a one-dimensional median.)**For 4 coplanar points,**if one of the four points is inside the triangle formed by the other three points, then the geometric median is that point. Otherwise, the four points form a convex quadrilateral and the geometric median is the crossing point of the diagonals of the quadrilateral. The geometric median of four coplanar points is the same as the unique Radon point of the four points.^{[6]}

## Computation

Despite the geometric median's being an easy-to-understand concept, computing it poses a challenge. The centroid or center of mass, defined similarly to the geometric median as minimizing the sum of the *squares* of the distances to each point, can be found by a simple formula — its coordinates are the averages of the coordinates of the points — but no such formula is known for the geometric median, and it has been shown that no explicit formula, nor an exact algorithm involving only arithmetic operations and *k*th roots can exist in general. Therefore only numerical or symbolic approximations to the solution of this problem are possible under this model of computation.^{[7]}

However, it is straightforward to calculate an approximation to the geometric median using an iterative procedure in which each step produces a more accurate approximation. Procedures of this type can be derived from the fact that the sum of distances to the sample points is a convex function, since the distance to each sample point is convex and the sum of convex functions remains convex. Therefore, procedures that decrease the sum of distances at each step cannot get trapped in a local optimum.

One common approach of this type, called **Weiszfeld's algorithm** after the work of Endre Weiszfeld,^{[8]} is a form of iteratively re-weighted least squares. This algorithm defines a set of weights that are inversely proportional to the distances from the current estimate to the samples, and creates a new estimate that is the weighted average of the samples according to these weights. That is,

This method converges for almost all initial positions, but may fail to converge when one of its estimates falls on one of the given points. It can be modified to handle these cases so that it converges for all initial points.^{[5]}

Template:Harvtxt describe more sophisticated geometric optimization procedures for finding approximately optimal solutions to this problem. As Template:Harvtxt show, the problem can also be represented as a semidefinite program.

## Characterization of the geometric median

If *y* is distinct from all the given points, *x*_{j}, then *y* is the geometric median if and only if it satisfies:

This is equivalent to:

which is closely related to Weiszfeld's algorithm.

In general, *y* is the geometric median if and only if there are vectors *u*_{j} such that:

where for *x*_{j} ≠ *y*,

and for *x*_{j} = *y*,

An equivalent formulation of this condition is

## Generalizations

The geometric median can be generalized from Euclidean spaces to general Riemannian manifolds (and even metric spaces) using the same idea which is used to define the Fréchet mean on a Riemannian manifold.Template:Sfnp Let be a Riemannian manifold with corresponding distance function , let be weights summing to 1, and let be observations from . Then we define the weighted geometric median (or weighted Fréchet median) of the data points as

If all the weights are equal, we say simply that is the geometric median.

## Notes

- ↑ The more general
*k*-median problem asks for the location of*k*cluster centers minimizing the sum of distances from each sample point to its nearest center. - ↑
^{2.0}^{2.1}^{2.2}Template:Harvtxt - ↑
^{3.0}^{3.1}^{3.2}^{3.3}Template:Harvtxt - ↑
^{4.0}^{4.1}^{4.2}Template:Harvtxt - ↑
^{5.0}^{5.1}Template:Harvtxt - ↑ Template:Harvtxt, p. 6; Template:Harvtxt. The convex case was originally proven by Giovanni Fagnano.
- ↑ Template:Harvtxt; Template:Harvtxt. Earlier, Template:Harvtxt proved that the Steiner point for 5 points in the plane cannot be constructed with ruler and compass
- ↑ Template:Harvtxt; Template:Harvtxt; Template:Harvtxt.

## References

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=book }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=conference }}

- {{#invoke:citation/CS1|citation

|CitationClass=book }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=conference }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=book }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}.

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:citation/CS1|citation

|CitationClass=book }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }}

- {{#invoke:Citation/CS1|citation

|CitationClass=journal }} Template:Refend