When can you interchange composition of a limit?

I've seen some limit problems where you can do this: $$\lim_{x \to \infty} \exp\left({g(x)}\right) = \exp \left( \lim_{x \to \infty }g(x)\right) .$$ So, I've tried to generalize the result as: $$\lim_{x \to \infty} f(g(x)) = f \left( \lim_{x \to \infty }g(x) \right)$$ and I was just wondering if the result above is actually true, and on what conditions? Perhaps someone can point me to a theorem.

• If $f(x)$ is continuous at $x=\lim_{t\to \infty}g(t)$, then the generalization is correct. Sep 1, 2015 at 2:14

Continuity turns out to be the right condition. As long as $f$ is continuous and the limit of $g$ exists at the point in question, then the limit will commute with composition. That is, for a given $x$ in the domain of $g$, $$\lim_{x\to t} f(g(x)) = f (\lim_{x\to t} g(x))$$ When dealing with values at infinity, technically you want the functions to be continuous on the extended real line ( either two point or one point compactifications). In practice, that amounts to proving $$\lim_{x\to \infty} g(x)$$ exists.
• $g$ needs to be continuous? Sep 1, 2015 at 2:29
• Weird things could happen. If $f$ is constant and the limit of $g$ doesn't exist, then the left might exist and the right won't. Sep 1, 2015 at 2:31
• What if we guarantee that all limits exist, then. Does $g$ still need to be continuous? Sep 1, 2015 at 2:32
• Uh, $x\mapsto\begin{cases}1,&x=0\\0,&x\ne0\end{cases}$ has the limit existing at $0$ but isn't continuous. Sep 1, 2015 at 2:35
For direct substitution like that to be correct, the function you are substituting into has to be continuous at that value. For example, $\lim \limits_{x \to a} f(x) = f(\lim \limits_{x \to a} x) = f(a)$ only if $f(x)$ is continuous at $x = \lim \limits_{x \to a} x=a$.
So your generalization would be correct if the outer function $f(x)$ is continuous at the value of the inner limit $x=\lim \limits_{t \to a} g(x)$. This could be for any value of $a$, as long as continuity is ensured.