Composite Function, when the external limit does not exist

In practice, most functions in applications are continuous, and we often use the fact that you can switch the order of a limit and a continuous function.

However, here’s two ways where $f$ might not be continuous, even though $f(g(x))$ is continuous at a point.

  1. $g$ is a maximum or minimum. As an example, let $f(x)$ be $-1$ for $x<0$ and $1$ for $x\geq 0$,

\begin{cases} -1 & x<0 \\ 1 & 0\leq x. \end{cases}

Then $f(x^2)$ is $1$ as $x$ approaches $0$, since the inside is always nonnegative.

  1. Both $f$ and $g$ are discontinuous. For example, let $f(x)=g(x)=1/x$ except at $0$, where $f(0)=g(0)=0$:

\begin{cases} 0 & x=0 \\ 1/x & x\not=0. \end{cases}

Then $f(g(x))=x$ is continuous at $0$ even though neither of them are, since the discontinuities effectively cancel each other out.