THEOREM 9(THE CHAIN RULE)
If $g$ is differentiable at $a$, and $f$ is differentiable at $g(a)$, then $f\circ g$ is differentiable at $a$, and $$(f\circ g)^{'}(a)=f^{'}(g(a))\cdot g^{'}(a).$$
My proof of this theorem is here:
(1) First consider the case in which for any positive real number $\epsilon$, there exists $h$ such that $0<|h|<\epsilon$ and $g(a+h)-g(a)=0$.
In this case, $\lim_{h\to 0} \frac{g(a+h)-g(a)}{h}=0$ since $g'(a)$ exists and there exists $h$ such that $0<|h|<\epsilon$ and $g(a+h)-g(a)=0$ for any positive real number $\epsilon$.
Let $\phi(h):= \frac{f(g(a+h))-f(g(a))}{g(a+h)-g(a)}$ if $g(a+h)-g(a)\neq 0$.
Let $\phi(h):=f'(g(a))$ if $g(a+h)-g(a) = 0$.
Then $\phi$ is continuous at $h=0$ since $f$ is differentiable at $g(a)$.
$\frac{f(g(a+h))-f(g(a))}{h} = \phi(h) \cdot \frac{g(a+h)-g(a)}{h}\to f'(g(a))\cdot 0 = f'(g(a))\cdot g'(a) \,\,(h\to 0)$.
(2) Second consider the case in which there exists a positive real number $\epsilon$ such that $0<|h|<\epsilon\implies g(a+h)-g(a)\neq 0.$
In this case $\frac{f(g(a+h))-f(g(a))}{h} = \frac{f(g(a+h))-f(g(a))}{g(a+h)-g(a)} \cdot \frac{g(a+h)-g(a)}{h}\to f'(g(a))\cdot g'(a) \,\,(h\to 0)$.
I don't like the function $\phi$ because it is artificial.
Can we prove the chain rule without using an artificial trick?
If $f,g$ are continuously differentiable, then it is possible to prove directly.
Here is an argument:
Using mean value theorem: $g(a+h) = g(a) + g'(x) h$ with $x \in [a,a+h]$, $$ \lim_{h \rightarrow 0} \frac{f(g(a+h))-f(g(a))}{h} = \lim_{h \rightarrow 0} \frac{f(g(a)+g'(x)h)-f(g(a))}{h} $$ Again using mean value theorem, now in $f$: $f(g(a)+h) = f(g(a)) + f'(y) h$ with $y \in [g(a),g(a)+h]$, $$ = \lim_{h \rightarrow 0} \frac{f(g(a)) + f'(y) g'(x) h - f(g(a))}{h} = \lim_{h \rightarrow 0} \frac{f'(y)g'(x)h}{h} = f'(g(a)) g'(a)$$
The last step: $\lim_{h \rightarrow 0} f'(y)g'(x) = f'(g(a)) g'(a)$ uses the fact that derivatives are continuous.