Solution (source code)

= Solution

To say that $f$ is twice <differentiable> at $a$ means that $f'$ is defined in a neighbourhood of $a$ and is <differentiable> at $a$; its <derivative> is $f''(a)$.

By the <chain rule>, near $a$,
$$
(g\circ f)'=(g'\circ f)f'.
$$
Since $f$ is <differentiable> and $g'$ is <differentiable> at $f(a)$, another use of the chain rule shows that $g'\circ f$ is <differentiable> at $a$. The <product rule> then proves that the displayed product is <differentiable>. Hence $g\circ f$ is twice <differentiable>, with the <second derivative chain rule>
$$
\boxed{(g\circ f)''(a)
=g''(f(a))[f'(a)]^2+g'(f(a))f''(a)}.
$$