Please help me to calculate the derivative of the function $\|x_+\|^2$.
Here,
$x_+ = ((x_1)_+,(x_2)_+,...,(x_n)_+)$ in $\mathbb{R}^n$
where $a_+ = \max\{a,0\}$ for $a\in \mathbb{R}$.
$||\cdot||$: Euclidean norm in $\mathbb{R}^n$.
Please help me to calculate the derivative of the function $\|x_+\|^2$.
Here,
$x_+ = ((x_1)_+,(x_2)_+,...,(x_n)_+)$ in $\mathbb{R}^n$
where $a_+ = \max\{a,0\}$ for $a\in \mathbb{R}$.
$||\cdot||$: Euclidean norm in $\mathbb{R}^n$.
Let us introduce the function $U:x\mapsto\|x_+\|^2=\sum\limits_{i=1}^nu(x_i)$ where $u(t)=(t_+)^2$. The function $u$ is differentiable on $\mathbb R$, with derivative u':t\mapsto2t_+, hence the function $U$ is differentiable on $\mathbb R^n$, with gradient $\nabla U:x\mapsto2x_+$. In particular, at each $x$ in $\mathbb R^n$, $ \frac{\partial U}{\partial x_i}=2(x_i)_+. $ The only nontrivial step in the reasoning above might be the differentiability of $u$ at $0$. But consider that $u(0)=0$, $u(t)=0$ if $t\lt0$ and $u(t)=t^2$ if $t\gt0$, hence $|u(t)|\ll |t|$ when $t\to0$. Thus $u$ is differentiable at $0$ with u'(0)=0.