Differential of second order Consider $f:\mathbb R^n→\mathbb R^m$  and $g:\mathbb R^m→\mathbb R^k$ . Then $(g∘f):\mathbb R^n→\mathbb R^k$ and, if both of them are differentiable,
$ D(g∘f)p=Dg(f(p))∘Df(p)=(Dg)(f(p))*(Df)(p).$
How I can prove that
$(D^2(g∘f))p=(D^2g)f(p)*((Df)(p))^2+(Dg)f(p)*(D2f)p$.
Thanks
 A: Let $L(X,Y)$ denote the space of linear maps between finite dimensional normed space $X$ and $Y$.
Let $B(p) = Dg(f(p))\in L(\mathbb R^m, \mathbb R^k)$. That is, $B(p)$ is a linear map from $\mathbb R^m$ into $\mathbb R^k$, or a $k\times m$ matrix. Let $A(p) = Df(p) \in L(\mathbb R^n, \mathbb R^m)$.
So we have $D(g\circ f)(p) = B(p)\circ A(p) \in L(\mathbb R^n, \mathbb R^k)$.
Now consider
$$ D^2(g\circ f)(p) = D(B(p) \circ A(p)), $$
which is a linear map from $\mathbb R^n$ into $L(\mathbb R^n, \mathbb R^k)$.
Notice that composition of linear maps (the same as multiplication of matrices) is a bilinear map.
Thus, we have
$$ D(B(p)\circ A(p))[h] = DB(p)[h]\circ A(p) + B(p) \circ (DA(p)[h]) $$
with
$$ DB(p)[h] = D^2 g(f(p))[Df(p)[h]] $$
and
$$ DA(p)[h] = D^2 f(p)[h]. $$
In particular, we have
$$ D^2(g\circ f)(p)[h] = (D^2 g(f(p))[Df(p)[h]]) \circ Df(p) + Dg(f(p))\circ(D^2 f(p)[h]). $$
Now, one can show that higher derivatives (in sense of totally differentiable) are symmetric. Thus, people usually identify the second derivative with a symmetric bilinear map. Thus, we can also write
$$ D^2(g\circ f)(p)[h, \tilde h] = D^2 g(f(p)[Df(p)[h], Df(p)[\tilde h]] + Dg(f(p))[D^2 f(p)[h, \tilde h]]. $$
