Point which minimizes the squared sum distances to edges of a triangle I need to find coordinates of a point at which the sum of the squared distances to each of the three lines that form a triangle is minimized.
It seemed to me that the point is the triangle's incenter, but that doesn't seem to be the case. Any thoughts?
Thanks!
 A: Let $(x_i,y_i)$ denote the coordinates of the $i$-th vertex and $d_i(x,y)$ the function given by the signed distance to the side (as an infinite line) opposite the $i$-th vertex:
$$d_1(x,y)=\frac{(x_2-x_3)y-(y_2-y_3)x-y_3x_2+y_2x_3}{\sqrt{(x_2-x_3)^2+(y_2-y_3)^2}}$$
and similar for $d_2$ and $d_3$ by circular permutation of indices (i.e., the sign of the distance is only arbitrary the first time, and then it is fixed for the two other lines). The quantity in the denominator can be abbreviated to $L_1$ ($L_2$, $L_3$) as it is the length of the side opposite the $i$-th vertex.
Then the partial derivatives that Henning refers to are
$$\frac{\partial}{\partial x}(d_1^2+d_2^2+d_3^2)
=2d_1\frac{y_3-y_2}{L_1}+2d_2\frac{y_1-y_3}{L_2}+2d_3\frac{y_2-y_1}{L_3}$$
and similar for the $y$-derivative. So one way of expressing the problem as as a linear system in two variables is
$$\eqalign{
d_1\sin\alpha_1+d_2\sin\alpha_2+d_3\sin\alpha_3&=&0\\
d_1\cos\alpha_1+d_2\cos\alpha_2+d_3\cos\alpha_3&=&0
}$$
where $\alpha_i$ is the anticlockwise oriented angle between the positive $X$ axis and the edge opposite the $i$-th vertex, the orientation of the latter edge being determined by circular permutation of vertices.
