Local and global minimum. Symbolic calculus
Given a set of points $(x_i,y_i)$ with $i = 1,2,\ldots,n$ find the central point $(m_x,m_y)$ so that the sum of the quadratic distances
$$D = \sum\limits_{i=1}^n\left[(x_i-m_x)^2+(y_i-m_y)^2\right]$$to this point is minimal. The set of points will be
$$ \begin{array}{|c|rrrrr|} \hline x & 1 & 3 & 4 & 5\\ \hline y & 2 & -1 & 3 & 1\\ \hline \end{array} $$The objective function is
$$ \begin{array}{lll} D(m_x,m_y)& = & d_1^2 +d_2^2 +d_3^2 +d_4^2 \\ D(m_x,m_y)& = &[(1-m_x)^2+(2-m_y)^2]+[(3-m_x)^2+(-1-m_y)^2]+\\ & &[(4-m_x)^2+(3-m_y)^2]+[(5-m_x)^2+(1-m_y)^2] \end{array} $$The necessary condition of optimum is that the partial derivatives are zero
$$ \begin{array}{lll}\\ \dfrac{\partial D}{\partial m_x}=0 \\ \dfrac{\partial D}{\partial m_y}=0 \end{array} $$Differentiating $$ \begin{array}{rcl}\\ -2(1-m_x)-2(3-m_x)-2(4-m_x)-2(5-m_x)& = & 0\\ -2(2-m_y)-2(-1-m_y)-2(3-m_y)-2(1-m_y)& = & 0 \end{array} $$ We remove the factor $-2$ $$ \begin{array}{rcl}\\ (1-m_x)+(3-m_x)+(4-m_x)+(5-m_x)& = & 0\\ (2-m_y)+(-1-m_y)+(3-m_y)+(1-m_y)& = & 0 \end{array} $$
We rearrange the equations $$ \begin{array}{lll}\\ (1+3+4+5)& = & 4 m_x\\ (2-1+3+1)& = & 4 m_y \end{array} $$ The solution is $$ \begin{array}{lll}\\ m_x = \dfrac{1+3+4+5}{4}=3.25\\ m_y = \dfrac{2-1+3+1}{4}=1.25 \end{array} $$
The sufficient condition is that the Hessian matrix at the point $\left(3.25,1.25\right)$ is positive definite. The Hessian matrix for the function $D$ at any point $\left(m_{x},m_{y}\right)$ is
And the Hessian matrix is constant and the same for all points in the plane. In particular, it is also the value for the point $(3.25,1.25).$
A condition for a matrix to be positive definite is that all its leading principal minors are positive. That is
$$ \left|\begin{array}{cc} 8 & 0 \\ 0 & 8 \end{array}\right|=64\gt0\quad\mathrm{y} \qquad \left|8\right|=8\gt0. $$And the sufficient condition of minimum is met.
In the following graph we see the values that the $ D $ function takes for different points and that, indeed, the point $(3.25,1.25)$ (in red) is the point where the sum of the distances to the other four points is minimum.