## Limits of Compositions

Many of the limit laws we employ help us deal with combinations of functions. Often these combinations are arithmetic in nature. That is to say, we are looking at a limit of a sum, difference, product, or quotient of other (simpler) functions.

Other times, we are interested in a composition of functions, such as $f(g(x))$.

We have already seen some of the limit laws governing compositions of functions. Let's remind ourselves of one of these rules and look at an example of its application...

### Limits of Continuous Compositions

This rule tells us that if $\displaystyle{\lim_{x \rightarrow c} g(x) = b}$ and $\displaystyle{\lim_{x \rightarrow b} f(x) = f(b)}$, then $\displaystyle{\lim_{x \rightarrow c} f(g(x)) = f(\lim_{x \rightarrow c} g(x))}$.

As an example of its application, consider the following limit:

$$\lim_{x \rightarrow 1} \left[\sin \left(\frac{\pi}{x+1}\right)\right]$$

To evaluate this limit, we first consider the limit of just the inner-most expression of the composition (here, the fraction in the parentheses), as $x \rightarrow 1$. This of course, is a limit of a quotient with a limiting value of the denominator equal to $2$ (notably not zero) and a limiting value of the numerator equal to $\pi$ (the limit of a constant).

Consequently, the limiting value of this inner-most expression -- which, in terms of our "limit of continuous composition" rule is playing the role of $g(x)$ -- is $\displaystyle{\frac{\pi}{2}}$.

We know that for every $b$, $\displaystyle{\lim_{x \rightarrow b} \sin x = \sin b}$ by one of the limit laws. In particular, this is true when $b = \pi/2$. Given this, the sine function will play the role of $f$ in our "limit of continuous composition" rule above.

Applying this rule, we then conclude

$$\lim_{x \rightarrow 1} \left[\sin \left(\frac{\pi}{x+1}\right)\right] = \sin \left( \lim_{x \rightarrow 1} \frac{\pi}{x+1} \right) = \sin \frac{\pi}{2} = 1$$

The take-away here is to notice that under the right circumstances, we can take the limit of the "inside" of our composition and then apply the outer function to that limiting value.

This is not the only way of dealing with a limit of a composition, however. There is another technique we can employ, as the next section details...

### Limits of General Compositions

Rather than focusing on "pulling out" some continuous outer function from a limit of a composition, the limit of a general composition rule lets us rewrite a limit of a composition as a limit where the value approached changes:

If $g$ is a function where $\displaystyle{\lim_{x \rightarrow c} g(x) = b}$, but $g$ is not constantly $b$ near $c$, then $\displaystyle{\lim_{x \rightarrow c} f(g(x)) = \lim_{u \rightarrow b} f(u)}$, if the limit exists.

Notice how we re-express the limit involving $x \rightarrow c$ in terms of a limit where $u \rightarrow b$.

Let's look at a specific example. Consider the following limit:

$$\lim_{x \rightarrow \sqrt{\pi/3}} \cos^3 x^2$$

Here, the innermost function -- again, the one that plays the role of $g(x)$ -- is $x^2$. Notably, $x^2$ is not constant near $\sqrt{\pi/3}$ (or any other value for that matter).

We know that $\displaystyle{\lim_{x \rightarrow \sqrt{\pi/3}} x^2 = \pi/3}$ by the limit law involving the limit of a polynomial.

As such, we can rewrite this limit in the following way:

$$\lim_{u \rightarrow \pi/3} \cos^3 u$$

From there, we're a hop, skip, and jump away from evaluating the limit, via our other limit laws...

$$\lim_{u \rightarrow \pi/3} \cos^3 u = \left( \lim_{u \rightarrow \pi/3} \cos u \right)^3 = \left( \cos \left(\frac{\pi}{3} \right) \right)^3 = \left( \frac{1}{2} \right)^3 = \frac{1}{8}$$

Evaluating limits of compositions by looking at the limits of the innermost functions first, and then outer functions as they exist is particularly helpful when some of these limiting values are infinite. However, as infinity is not a value, we can't simply apply the aforementioned rules. We'll need to have a special theorem to deal with compositions where the innermost function is "flying off to infinity"...

### Limits of Infinite Compositions

Let $g$ be a function such that $\displaystyle{\lim_{x \rightarrow c} g(x) = \pm \infty}$. Then $\displaystyle{\lim_{x \rightarrow c} f(g(x)) = \lim_{u \rightarrow \pm \infty} f(u)}$, if the limit exists.

As an example, consider the following limit:

$$\lim_{x \rightarrow 0} e^{1/x^2}$$

Here, the innermost function -- the one that plays the role of $g(x)$ -- is $1/x^2$. As $x \rightarrow 0$, notice the denominator of $1/x$ stays positive due to the square, but gets very small -- while the numerator stays the same. This forces the limiting value of $1/x^2$ as $x \rightarrow 0$ to be positive infinity. In other words, $$\lim_{x \rightarrow 0} \frac{1}{x^2} = +\infty$$ However, this means that upon applying the rule stated above, we can now rewrite the limit we seek as $$\lim_{u \rightarrow +\infty} e^u$$ Of course, as the exponent $u$ on $e$ grows without bound, $e^u$ becomes arbitrarily large. As such, we conclude $$\lim_{x \rightarrow 0} e^{1/x^2} = \lim_{u \rightarrow +\infty} e^u = +\infty$$