The Composition of Continuous Functions in Metric Spaces Preserves Continuity
Theorem
Let there be three metric spaces $(X,d_{X})$, $(Y,d_{Y})$, $(Z,d_{Z})$. Assume that $E\subset X$ and there are two functions $f:E\to Y$, $g:f(E) \to Z$. Also, let $h : E \to Z$ defined in $E$ be as follows.
$$ h(x) = g(f(x))\quad \forall x \in E $$
If $f$ is continuous at $p\in E$ and $g$ is continuous at $f(p)\in f(E)$, then $h$ is also continuous at $p$. Here, $h$ is called the composition of $f$ and $g$ and is expressed as $h=g\circ f$.
Proof
Let any positive number $\varepsilon>0$ be given. Assuming that $g$ is continuous at $f(p)$, for $\varepsilon$
$$ y\in f(E) \quad \text{and} \quad d_{Y}(y,f(p)) < \delta \implies d_{Z}(g(y),g(f(p))) <\varepsilon $$
there exists a positive number $\delta >0$. Then, assuming that $f$ is continuous at $p$, for such $\delta$
$$ x \in E \quad \text{and} \quad d_{X}(x,p) <\eta \implies d_{Y}(f(x),f(p))<\delta $$
there exists a positive number $\eta>0$. Therefore, for any positive number $\varepsilon$
$$ x\in E \quad \text{and} \quad d_{X}(x,p) <\eta \implies d_{z}(h(x),h(p))=d_{z}(g(f(x)),g(f(p)))< \varepsilon $$
there exists $\eta>0$ such that $h$ is continuous at $p$ by the definition of continuity.
■