Given a set of points in space, define
as the algebraic average of all the points. Then this point minimizes the sum of the squared distances from a point to each of the given points. That is
is minimum at
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let's prove that the minimum is at x = v .
Let { e 1 ^ , e 2 ^ , … , e m ^ } be the canonical basis for R m . Then x = j = 1 ∑ m x j e j ^ and v i = j = 1 ∑ m v i , j e j ^ .
We have: f ( x ) = i = 1 ∑ n ( x − v i ) ⋅ ( x − v i ) = n x ⋅ x − 2 x ⋅ v i + v i ⋅ v i = n j = 1 ∑ m x j 2 − 2 i = 1 ∑ n j = 1 ∑ m x j v i , j + i = 1 ∑ n j = 1 ∑ m v i , j 2 Take the partial derivative with respect to x k and set it equal to zero, where 1 ≤ k ≤ m : ∂ x k ∂ f ⟹ x k = 2 n x k − 2 i = 1 ∑ n v i , k = 0 = n 1 i = 1 ∑ n v i , k Finally, the point that will minimize f ( x ) will be: v = j = 1 ∑ m x j e j ^ = j = 1 ∑ m ( n 1 i = 1 ∑ n v i , j ) e j ^ = n 1 i = 1 ∑ n j = 1 ∑ m v i , j e j ^ = n 1 i = 1 ∑ n v i