Find the vector r which minimises the sum S = (r - a)^2 + (r - b)^2 + (r - c)^2, where a, b and c are constant vectors.
I'm unsure as to how to go about this. I was thinking it's some sort of constrained optimization, however I'm not well equipped with these tools. enter image description here
let $r = (r_x,r_y)$ and $a=(a_x,a_y),b=(b_x,b_y),c=(c_x,c_y)$.
Write out the expression $||r-a||^2+ ||r-b||^2 + ||r-c||^2$.
You should get a polynomial with the two variables $r_x$ and $r_y$ that doesn't have mixed terms of the form $r_x^ur_y^v$. Since it doesn't have mixed terms like this you just need to minimize the parts with $r_x$ and the parts with $r_y$ which is easy as these are just degree $2$ polynomials in one variable.
We now solve the subproblem of minimizing $(r-a)^2 + (r-b)^2 + (r-c)^2 = 3r^2-2(a+b+c)r + a^2+b^2+c^2$.
Taking derivative we have $6r-(a+b+c) = 0$ and so we take $r=(a+b+c)/3$
So the point we want is the incenter of the points $a,b,c$ which is given by the expression $(\frac{a_x+b_x+c_x}{3},\frac{a_y+b_y+c_y}{3})$