# Point such that sum of squares of distance to other points are minimized

I need to find $P(x,y)$ such that sum of squares of distance to points $A(3,4), B(20,8), C(4,24)$ is minimized. So I had a general expression of distance,

$D_\alpha = \sqrt{(x_\alpha - x_P)^2 + (y_\alpha - y_P)^2}$

Then the sum is:

$S = D^2_A + D^2_B + D^2_C$ $= (x_A - x_P)^2 + (y_A - y_P)^2 + (x_B - x_P)^2 + (y_B - y_P)^2 + (x_C - x_P)^2 + (y_C - y_P)^2$

Now it becomes a 8 variable function? Is it correct?

If so to find the critical points I need $$S_{x_A}, S_{y_A}, S_{x_B}, S_{y_B}, S_{x_C}, S_{y_C}, S_{x_P}, S_{y_P}$$

Or is there an easier way?

-

So you have to find $P(x,y)$ such that :$\displaystyle \sum_{i=1}^3 d^2_i$ is a minimal , where :

$d^2_1=(x_P-x_A)^2+(y_P-y_A)^2=(x_P-3)^2+(y_P-4)^2$

$d^2_2=(x_P-20)^2+(y_P-8)^2$

$d^2_3=(x_P-4)^2+(y_P-24)^2$

Hence :

$\displaystyle \sum_{i=1}^3 d^2_i=3x^2_P+3y^2_P-54x_P-72y_p+1081$

In order to find minimum of this function you have to find critical points and after that to apply following theorem .

-
It is a 2 variable problem, the values of $x_A,y_A,x_B,y_B,x_C,y_C$ are all provided ($A,B,C$ above), the only unknowns are $x_P,y_P$. To find the solution, you need to compute $\frac{\partial S}{\partial x_P}$ and $\frac{\partial S}{\partial y_P}$.
This is an optimization problem with two unknown variables, $x_P$ and $y_P$. The other point variables are considered to be constants. The goal is to minimize the quantity $S$, sometimes called the objective function. Since this is a homework problem, a good approach is to start by asking yourself the following: