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. 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, 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, :\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). 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. ==Characterization of the geometric median==