## How to partially differential this equation?

I just wonder how can I do (step by step) partially differentiating $g_u(\vec x)$ with $\vec x$ where $\vec x = \vec 0$

Noted:

• The displacement of node u is depicted as in the attached picture.
• $\vec r_e$ denotes the vector in the local coordinate of u that starts from u and ens at the tip of the arc e
• $r_0$ is a constant value.
• E(u) is a set of arc e which is attached to node u

$g_u(\vec x)=\sum_{e\in E(u)}\left | \vec r_e - \vec x - r_0\frac{\vec r_e - \vec x}{\| \vec r_e - \vec x\|}\right |$

Actually, I already have the answer but I want to know step by step in solving this equation. Please help. Thank you in advance.

The answer is $\nabla g_u(\vec 0) = \sum_{e\in E(u)} \left ( 1 - \frac{\vec r_0}{\| \vec r_e \|}\right )\frac{\vec r_0}{\| \vec r_e \|}$