Let $P_{i} = (x_i,y_i,z_i)$ n points in $\mathbb{R}^3$. Show that the point $P=(x,y,z)$ that minimize the sum of the squares of the distances to the points $P_i$ is the gravity center $( x = \frac{1}{n} \sum x_{i}, y = \frac{1}{n} \sum y_{i}, z = \frac{1}{n} \sum z_{i})$
Here's my "attempt":
I need to find the point that minimize the following:
$ \sum\limits _{i=1}^{n} d²(P,P_{i}) = d²(P,P_1) + ... + d²(P,P_n) $
Every term above is positive, but I can't simply choose every one as zero, since then I'll get that every point is the same. I can't also use propery of norms, since I have the square here... Graphically I'm convinced that the "spatial mid point" of all of them will be the minimizator, but how can I mathematicaly prove it?
I also tried to differentiate the function using multivalued analysis, but I failed calculating the derivative. Should I use chain rule?
Can someone please give me a hint? Thanks.