Geometric median

From HandWiki
Short description: Point minimizing sum of distances to given points
Example of geometric median (in yellow) of a series of points. In blue the Center of mass.

In geometry, 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, spatial median,[1] Euclidean minisum point,[1] or Torricelli point.[2]

The geometric median is an important estimator of location in statistics,[3] where it is also known as the L1 estimator[4] (because it is minimizes the L1 norm of the vector of distances).[5] It is also a standard problem in facility location, where it models the problem of locating a facility to minimize the cost of transportation.[6] 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. If the point is generalized into a line or a curve, the best-fitting solution is found via least absolute deviations.

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.[7] Its solution is now known as the Fermat point of the triangle formed by the three sample points.[8] 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.[1] Some sources instead call Weber's problem the Fermat–Weber problem,[9] but others use this name for the unweighted geometric median problem.[10]

(Wesolowsky 1993) provides a survey of the geometric median problem. See (Fekete Mitchell) for generalizations of the problem to non-discrete point sets.


Formally, for a given set of m points [math]\displaystyle{ \mathbb{X}^m = x_1, x_2, \dots, x_m\, }[/math] with each [math]\displaystyle{ x_i \in \mathbb{R}^n }[/math], the geometric median is defined as

[math]\displaystyle{ \underset{y \in \mathbb{R}^n}{\operatorname{arg\,min}} \sum_{i=1}^m \left \| x_i-y \right \|_2 }[/math]

Here, arg min means the value of the argument [math]\displaystyle{ y }[/math] which minimizes the sum. In this case, it is the point [math]\displaystyle{ y }[/math] in n dimensional Euclidean space from where the sum of all Euclidean distances to the [math]\displaystyle{ x_i }[/math]'s is minimum.


  • 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. (More precisely, if the points are p1, ..., pn, in that order, the geometric median is the middle point [math]\displaystyle{ p_{(n+1)/2} }[/math] if n is odd, but is not uniquely determined if n is even, when it can be any point in the line segment between the two middling points [math]\displaystyle{ p_{n/2} }[/math] and [math]\displaystyle{ p_{(n/2)+1} }[/math].) [11][12]
  • The geometric median is unique whenever the points are not collinear.[13]
  • The geometric median is equivariant for Euclidean similarity transformations, including translation and rotation.[4][11] 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 does not 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.[4]
  • The geometric median has a breakdown point of 0.5.[4] 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 at the vertex of 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.[11] 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.[14]


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 it has been shown that no explicit formula, nor an exact algorithm involving only arithmetic operations and kth roots, can exist in general for the geometric median. Therefore, only numerical or symbolic approximations to the solution of this problem are possible under this model of computation.[15]

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,[16] 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 sample points, and creates a new estimate that is the weighted average of the sample according to these weights. That is,

[math]\displaystyle{ \left. y_{k+1}=\left( \sum_{i=1}^m \frac{x_i}{\| x_i - y_k \|} \right) \right/ \left( \sum_{i=1}^m \frac{1}{\| x_i - y_k \|} \right). }[/math]

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.[13]

(Bose Maheshwari) describe more sophisticated geometric optimization procedures for finding approximately optimal solutions to this problem. (Cohen Lee) show how to compute the geometric median to arbitrary precision in nearly linear time. Note also that the problem can be formulated as the second-order cone program

[math]\displaystyle{ \underset{y \in \mathbb{R}^n, \ s \in \mathbb{R}^m}{\min} \ \sum_{i=1}^m s_i \text{ subject to } s_i \geq \left \| x_i-y \right \|_2 \text{ for } i=1, \ldots, m, }[/math]

which can be solved in polynomial time using common optimization solvers.

Characterization of the geometric median

If y is distinct from all the given points, xi, then y is the geometric median if and only if it satisfies:

[math]\displaystyle{ 0 = \sum_{i=1}^m \frac {x_i - y} {\left \| x_i - y \right \|}. }[/math]

This is equivalent to:

[math]\displaystyle{ \left. y = \left( \sum_{i=1}^m \frac{x_i}{\| x_i - y \|} \right) \right/ \left( \sum_{i=1}^m \frac{1}{\| x_i - y \|} \right), }[/math]

which is closely related to Weiszfeld's algorithm.

In general, y is the geometric median if and only if there are vectors ui such that:

[math]\displaystyle{ 0 = \sum_{i=1}^m u_i }[/math]

where for xiy,

[math]\displaystyle{ u_i = \frac {x_i - y} {\left \| x_i - y \right \|} }[/math]

and for xi = y,

[math]\displaystyle{ \| u_i \| \leq 1 . }[/math]

An equivalent formulation of this condition is

[math]\displaystyle{ \sum _{1\le i\le m, x_i\ne y} \frac {x_i - y} {\left \| x_i - y \right \|} \le \left|\{ \,i\mid 1\le i\le m, x_i= y\,\}\right|. }[/math]

It can be seen as a generalization of the median property, in the sense that any partition of the points, in particular as induced by any hyperplane through y, has the same and opposite sum of positive directions from y on each side. In the one dimensional case, the hyperplane is the point y itself, and the sum of directions simplifies to the (directed) counting measure.


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.[17][18] Let [math]\displaystyle{ M }[/math] be a Riemannian manifold with corresponding distance function [math]\displaystyle{ d(\cdot, \cdot) }[/math], let [math]\displaystyle{ w_1, \ldots, w_n }[/math] be [math]\displaystyle{ n }[/math] weights summing to 1, and let [math]\displaystyle{ x_1, \ldots, x_n }[/math] be [math]\displaystyle{ n }[/math] observations from [math]\displaystyle{ M }[/math]. Then we define the weighted geometric median [math]\displaystyle{ m }[/math] (or weighted Fréchet median) of the data points as

[math]\displaystyle{ m = \underset{x \in M}{\operatorname{arg\,min}} \sum_{i=1}^n w_i d(x,x_i) }[/math].

If all the weights are equal, we say simply that [math]\displaystyle{ m }[/math] is the geometric median.

See also


  1. 1.0 1.1 1.2 (Drezner Klamroth)
  2. Cieslik (2006).
  3. Lawera & Thompson (1993).
  4. 4.0 4.1 4.2 4.3 (Lopuhaä Rousseeuw)
  5. Dodge & Rousson (1999).
  6. Eiselt & Marianov (2011).
  7. Krarup & Vajda (1997).
  8. Spain (1996).
  9. Brimberg (1995).
  10. Bose, Maheshwari & Morin (2003).
  11. 11.0 11.1 11.2 (Haldane 1948)
  12. Claim 18.10, Geometric Methods and Optimization Problems, V. Boltyanski, H. Martini, V. Soltan, Springer, 1999.
  13. 13.0 13.1 (Vardi Zhang)
  14. (Cieslik 2006), p. 6; (Plastria 2006). The convex case was originally proven by Giovanni Fagnano.
  15. (Bajaj 1986); (Bajaj 1988). Earlier, (Cockayne Melzak) proved that the Steiner point for 5 points in the plane cannot be constructed with ruler and compass
  16. (Weiszfeld 1937); (Kuhn 1973); (Chandrasekaran Tamir).
  17. Fletcher, P. Thomas; Venkatasubramanian, Suresh; Joshi, Sarang (23 June 2008). "Robust statistics on Riemannian manifolds via the geometric median". IEEE Conference on Computer Vision and Pattern Recognition. Anchorage, AK, USA: IEEE. 
  18. Fletcher, Venkatasubramanian & Joshi (2009).