Derivative of vector consisting of euclidean distances I have $g: \Bbb R^2 \to \Bbb R^4$ given by $g(x) = (\|c_1 - x\|, \dots, \|c_4 - x\|)$, where $c_1, \dots, c_4 \in \Bbb R^2$.
I want to find $\left( \dfrac {\partial g} {\partial x_1}, \dfrac {\partial g} {\partial x_2} \right)$. Any hints?
 A: You are esssentially asking about the partial derivatives of the Euclidean distance function. Given that $\|c - x\| = \sqrt {(c_1 - x_1)^2 + (c_2 - x_2)^2}$, it follows that
$$\begin{eqnarray} \frac {\partial \|c - x\|} {\partial x_1} = \frac {x_1 - c_1} {\sqrt {(c_1 - x_1)^2 + (c_2 - x_2)^2}} \\
\frac {\partial \|c - x\|} {\partial x_2} = \frac {x_2 - c_2} {\sqrt {(c_1 - x_1)^2 + (c_2 - x_2)^2}} \end{eqnarray}$$
therefore
$$\frac {\partial g} {\partial x_1} = \\ \left( \frac {x_1 - c_{1,1}} {\sqrt {(c_{1,1} - x_1)^2 + (c_{1,2} - x_2)^2}}, \frac {x_1 - c_{2,1}} {\sqrt {(c_{2,1} - x_1)^2 + (c_{2,2} - x_2)^2}}, \frac {x_1 - c_{3,1}} {\sqrt {(c_{3,1} - x_1)^2 + (c_{3,2} - x_2)^2}}, \frac {x_1 - c_{4,1}} {\sqrt {(c_{4,1} - x_1)^2 + (c_{4,2} - x_2)^2}} \right)$$
and
$$\frac {\partial g} {\partial x_2} = \\ \left( \frac {x_2 - c_{1,2}} {\sqrt {(c_{1,1} - x_1)^2 + (c_{1,2} - x_2)^2}}, \frac {x_2 - c_{2,2}} {\sqrt {(c_{2,1} - x_1)^2 + (c_{2,2} - x_2)^2}}, \frac {x_2 - c_{3,2}} {\sqrt {(c_{3,1} - x_1)^2 + (c_{3,2} - x_2)^2}}, \frac {x_2 - c_{4,2}} {\sqrt {(c_{4,1} - x_1)^2 + (c_{4,2} - x_2)^2}} \right)$$
where $c_i = (c_{i1}, c_{i2})$.
A: If my understanding is correct, you have
$$
g(x) =  f_1(x) f_12(x) f_13(x) f_14(x) 
$$
with $f_i(x) = || \bf c_i - x ||$
Evaluating $\frac{\partial g}{\partial x_i}$ then is simply a matter of using the nested chain rule.
