Projection of space onto unit sphere - differentiating it!

Let us do the computations in $\mathbb{R}^n$ and let $(e_1,\ldots,e_n)$ be the standard basis of $\mathbb{R}^n$. I also assume $\|\cdot\|$ is the euclidean norm on $\mathbb{R}^n$.

Let $i\in\{1,\ldots,n\}$, for all $x:=(x_1,\ldots,x_n)\in\mathbb{R}^n\setminus\{0\}$, one has: $$\partial_if(x)=\frac{\|x\|e_i-x\partial_i\|\cdot\|(x)}{\|x\|^2}=\frac{\displaystyle\|x\|e_i-\frac{x_i}{\|x\|}x}{\|x\|^2}=\frac{1}{\|x\|}e_i-\frac{x_i}{\|x\|^3}x.$$ Therefore, for all $x:=(x_1,\ldots,x_n)\in\mathbb{R}^n\setminus\{0\}$ and for all $h:=(h_1,\ldots,h_n)\in\mathbb{R}^n$, one gets:

$$\mathrm{d}f(x)(h)=\sum_{i=1}^n\partial_if(x)h_i=\frac{1}{\|x\|}\sum_{i=1}^nh_ie_i-\frac{1}{\|x\|^3}\left(\sum_{i=1}^nx_ih_i\right)x=\frac{h}{\|x\|}-\frac{\langle x,h\rangle}{\|x\|^3}x.$$

$\Box$

WARNING. I assume $f$ is differentiable on $\mathbb{R}^n\setminus\{0\}$ when writing: $$\mathrm{d}f(x)(h)=\sum_{i=1}^n\partial_if(x)h_i.$$ The existence of the partial derivatives of $f$ does not suffice to prove that $f$ is differentiable. Some functions admits partial derivatives without being differentiable nor being continuous.

Howeover, it is not hard to show qualitatively that $f$ is differentiable on $\mathbb{R}^n\setminus\{0\}$ (as a quotient). Indeed, $x\mapsto\|x\|$ is differentiable on $\mathbb{R}^n\setminus\{0\}$ as the composition of $t\mapsto\sqrt{t}$ (differentiable on $\mathbb{R}_+^*$) and $x\in\mathbb{R}^n\setminus\{0\}\mapsto\|x\|^2\in\mathbb{R}_+^*$ (polynomial in the coordinates).


Remark (computation of the partial derivatives of $\|.\|$). For all $x\in\mathbb{R}^n$, one has: $$\|x\|=\sqrt{\sum_{i=1}^nx_i^2}.$$ Therefore, for all $i\in\{1,\ldots,n\}$, one has: $$\partial_i\|\cdot\|(x)=\frac{2x_i}{\displaystyle2\sqrt{\sum_{i=1}^nx_i^2}}=\frac{x_i}{\|x\|}.$$