TITLE: When can you interchange composition of a limit?
QUESTION [25 upvotes]: 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.

REPLY [3 votes]: 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.