# Second derivative of a composite function

Say, we have three Banach spaces $X, Y, Z$ and $g:X \to Y, \ \ f:Y \to Z$ are twice (Fréchet) differenciable. The question is: what is $(f \circ g)''$?

Since $(f \circ g)'':X \to \mathcal{L}^2(X,Z)$, I am interested in the most explicit form: $(f \circ g)''(a)[k, h]$ which would describe the entire action taking place.

Let's pick some $a \in X$ and get started:

\begin{align} \\ (f \circ g)''(a)[k, h] &= D_{k}D_{h}(f \circ g)(a) \\ &= D_{k} \bigg( D_{h}(f \circ g)(a) \bigg) \\ &= D_{k} \bigg( (f \circ g)'(a)[h] \bigg) \\ &= \bigg( D_{k} (f \circ g)'(a)\bigg) [h] \ \ \ \ \ \text{(by linearity)} \\ &= \bigg( D_{k} f'(g(a)) \circ g'(a)\bigg) [h] \ \ \ \ \ \text{(chain rule)} \\ &= \bigg( \frac{d}{dt} f'(g(a+tk)) \circ g'(a+tk)|_{t=0}\bigg) [h] \end{align}

I’m really confused what to do next. It looks like we’d need to apply some sort of the product rule (but there is no product here: only compositions). And whatever I do next, I immediately lose track of how it all fits with $k$ and $h$.

Any explanations (the more detailed the better) are hugely appreciated.

-