Given N point-sites in a Euclidean space, suppose we wish to find the point X (which is not necessarily a site) whose sum of squared distances to the N sites is minimal.
a. The squared distance function x^{2}+y^{2}+...+z^{2} obviously is strictly concave-∪ hence the sum of squared distances to the sites – call it G(X) – is strictly concave-∪ (and goes to ∞ when |X|→∞) hence has a unique minimum. This minimum occurs when the partial derivatives of G(X) with respect to each of its coordinates, all are 0.
Hence G(X)'s partial derivative with respect to (say) the y-coordinate of the vector X is
where t_{k} denotes the y-coordinate of s_{k}. Setting this to 0 we find
which is the arithmetic mean of the t_{k}. The discussion is the same for every other coordinate. We conclude X must be the coordinatewise arithmetic mean of the sites.
b. If the weights are positive integers then the same proof goes through after simply making w_{k} copies of site k. If they are positive rationals this is still valid by scaling by common denominator. If they are positive reals it still is valid by continuity and the fact the rationals are everywhere dense within the reals. (Or, you could just redo the approach of the preceding proof but introducing weights into all expressions; that also works.)