Derivative of $\|x\|$ $f:\mathbb{R}^n\rightarrow\mathbb{R}$ is a map $f(x)=\langle x,x\rangle$, $g:\mathbb{R}\rightarrow\mathbb{R}$ is a map $g(x)=\sqrt{x}$, so the composition $h:=g\circ f:\mathbb{R}^n\rightarrow\mathbb{R}$ is a map $x\mapsto \|x\|$, I want the derivative of $h$ at $a$, according to chain rule it should be $D(g(f(a)))\circ D f(a)$,could any one tell me now next steps?
 A: If $x_1,\ldots,x_n$ are coordinates on $\mathbb{R}^n$ then $f(\vec{x}) = x_1^2+\cdots+x_n^2$. It follows that 
$$h(\vec{x}) = \sqrt{x_1^2+\cdots+x_n^2} \equiv \left(x_1^2+\cdots+x_n^2\right)^{1/2} \, . $$
The differential of $h$ is given by the partial derivatives $\partial h/\partial x_k$. Provided that $\vec{x}$ is not the zero vector, i.e. at least one of the $x_k$ is non-zero, we can apply the chain rule:
$$\frac{\partial h}{\partial x_k} = \frac{1}{2}\times\left(x_1^2+\cdots+x_n^2\right)^{-1/2} \times 2x_k \equiv \frac{x_k}{\sqrt{x_1^2+\cdots+x_n^2}} \, . $$
If the differentiation confuses you then try it on a single variable: $\sqrt{x^2}$. Putting everything together:
$$(Dh)(\vec{x}) =  \left(\frac{\partial h}{\partial x_1},\ldots,\frac{\partial h}{\partial x_n}\right) = \frac{(x_1,\ldots,x_n)}{\sqrt{x_1^2+\cdots+x_n^2}}$$
Equivalently: $(Dh)(\vec{x})=\vec{x}/||\vec{x}||.$
A: Here is an  approach which works on any inner product space.
First the derivative of $f$ is
$$
Df_x(k)=(x,k)+(k,x)=2(x,k)
$$
and the derivative of $g$ is
$$
Dg_t(s)=g'(t)s=\frac{s}{2\sqrt{t}}
$$
for all $t\neq 0$.
Now the derivative of $h=g\circ f$ is, by he chain rule
$$
Dh_x(k)=Dg_{f(x)}\circ Df_x(k)=g'(f(x))2(x,h)=\frac{(x,k)}{\|x\|}
$$
for all $x\neq 0$.
A: You can also think about it geometrically: perturbing $a$ by a $\delta a$ perpendicular to $a$ does not change the length of $a$ to first order. Perturbing it in the direction of $a$ increases the length by $\delta a$. Therefore the derivative is $\hat{a}=a/\|a\|$.
A: Here is a coordinate free  argument:
According to the chain rule
$$dh(a)=dg\bigl(f(a)\bigr)\circ df(a)\ .\tag{1}$$
Now
$$f(a+X)-f(a)=(a+X)\cdot(a+X)-a\cdot a=2a\cdot X+|X|^2\tag{2}$$
and therefore
$$df(a).X=2 a\cdot X\ .$$
Furthermore the formula $$g'(y)={1\over 2\sqrt{y}}\qquad(y>0)$$
can be written in the form
$$dg(y).Y={1\over 2g(y)}Y\ .\tag{3}$$
Letting $y:=f(a)$ and plugging $(2)$ and $(3)$ into $(1)$ we obtain
$$dh(a).X=dg\bigl(f(a)\bigr)\bigl(df(a).X\bigr)={1\over 2g\bigl(f(a)\bigr)}\bigl(2a \cdot X)\bigr)={a\cdot X\over|a|}\ .$$
It follows that $dh(a)$ can be represented by the gradient $$\nabla h(a)={a\over|a|}\qquad(a\ne0)$$ in the form
$$dh(a).X=\nabla h(a)\cdot X\qquad(X\in{\mathbb R}^n)\ .$$
