$x_1,x_2,...,x_m\in R^n$ are given. How to find $u\in R^n$ such that $\sum^{m}_{i=1} (d(u,x_i))^2$ is minimal.
I tried this way:
If
$J(u)=\sum ^{m}_{i=1} (d(u,x_i))^2$
$x_i=(x^{1}_{i},x^{2}_{i},...,x^{n}_{i}), i=1,2,...,m$
$u=(u_1,u_2,...,u_n)$
$(d(u,x_i))^2=\sum^{n}_{k=1} (u_k-x^{k}_{i})^2, i=1,..., m$
I tried to find partial derivatives of $J$ and I got that
$\dfrac{\partial J}{\partial u_i}=2(mu_i-(x^{i}_{1}+...+x^{i}_{m})), i=1,...,n$
If this is ok, I should determine when these partial derivatives are equal to $0$ and such values for $x_i$ would be the coordinates of vector $J'(u)$.
Then I should calculate matrix $J''(u)$ and check if it is positive definite.
Is this a good way to solution?
Are partial derivatives correct?