Let $f,g: \mathbb{R} \to \mathbb{R}$.
I think it is clear that $f \circ g$ has derivatives of all orders since $\dfrac{d^n}{dt^n} (f\circ g)$ only depends of $f, g$ and it's derivatives. But I'm asking for a formal proof because I can't figure it out one.
Can someone helps with a formal proof?
Thanks.
We can prove the following statement by induction on $n$: for all $n\in\mathbb{N}$, if $f,g:\mathbb{R}\to\mathbb{R}$ are $n$ times differentiable, then $f\circ g$ is $n$ times differentiable. The base case $n=0$ is trivial.
Now suppose $n>0$ and the statement is known for $n-1$ and we wish to prove it for $n$. Let $f,g:\mathbb{R}\to\mathbb{R}$ be $n$ times differentiable. By the chain rule, $f\circ g$ is differentiable with $(f\circ g)'=g'\cdot (f'\circ g)$. Now $f'$ and $g$ are both $n-1$ times differentiable, so by the induction hypothesis, $f'\circ g$ is $n-1$ times differentiable. Since $g'$ is also $n-1$ times differentiable, $(f\circ g)'$ is $n-1$ times differentiable since it is a product of two $n-1$ times differentiable functions. Thus $f\circ g$ is $n$ times differentiable.
(Here I assume you already know that a product of two functions which are $n$ times differentiable is $n$ times differentiable. If you don't know that, it can be proved by induction on $n$ in the same way, using the product rule instead of the chain rule.)