I'm having a little difficulty understanding my professor's proof of the chain rule. The theorem is given as:
Assume $f:(a,b) \rightarrow (c,d)$ and f is differentiable at a point $x_0 \in (a,b)$ and that $g(c,d) \rightarrow \mathbb{R}$ is differentiable at $f(x_0)$. Then $g \circ f$ is differenatible at $x_0$ and $(g \circ f)'(x_0) = g'(f(x_0)) \cdot f'(x_0)$.
The proof is as follows:
$\frac{ g \circ f(x) - g \circ f(x_0)}{x-x_0} = \frac{g(f(x)) - g(f(x_0)}{f(x) - f(x_0)} \cdot \frac{f(x)-f(x_0)}{x-x_0}$
Define $\phi = \begin{cases} \frac{g(y) - g(f(x_0))}{y-f(x_0)}, \text{ if } y \neq f(x_0) \\ g'(f(x_0)) \text{ if } y = f(x_0)\\ \end{cases} $
Then $\phi$ is continuous at $f(x_0)$ by differentiation of g and $\phi \circ f$ is continuous at $x_0$ by continuity of $\phi$ at $f(x_0)$ and of f at $x_0$ (because f is differentiable). Furthermore:
$\frac{ g \circ f(x) - g \circ f(x_0)}{x-x_0} = \phi \circ f(x) \cdot \frac{f(x) - f(x_0)}{x-x_0}$
And so we can conclude that
$\lim \frac{ g \circ f(x) - g \circ f(x_0)}{x-x_0} = \lim \phi \circ f(x) \cdot \frac{f(x) - f(x_0)}{x-x_0} $ $= \phi \circ f(x) \cdot f'(x_0)$ $= g'(f(x_0)) f'(x_0)$
I'm really confused as to why we specifically chose that function for $\phi$. Also, why does continuity matter? Is it because by continuity, we know that limits are unique, which allows us to equalize the limits?