Formal basis for variable substitution in limits

So we do a lot of variable substitution in limits at school. Stuff like $\lim\limits_{x\to5}\ (x+1)^2\ =\ \lim\limits_{y\to6}\ y^2$, where we define the substitution $y = x + 1$.

But I've never been clear on what exactly the theoretical basis for this is. What is the formula that you're actually applying when you do variable substitution? What are the formal conditions under which it is possible?

My conjecture would be the following:

For all continuous $f$, and all real $a$:
$\lim\limits_{x\to a}\ (f\circ g)(x)\ =\lim\limits_{x\to g(a)}\ f(x)$, where $g$ is a continuous function

So to take my first example, $f$ would be $x^2$, $g$ would be $x + 1$, and $a$ would be $5$.

Am I in the right area? If this is correct, can it be proven using $\epsilon$-$\delta$? I had a half-hearted shot at it the other night and didn't get anywhere.

The complete story is as follows:

If the functions $g:\ A\to B$ and $f:\ B\to C$ have limits $$\lim_{x\to\xi}g(x)=:\eta\ ,\qquad \lim_{y\to\eta}f(y)=:\zeta\ ,$$ and if $f$ is continuous at $\eta$ in case $\eta$ occurs as value of $g$, then $$\lim_{x\to\xi}f\bigl(g(x)\bigr)=\lim_{y\to\eta} f(y)\ .$$

This holds also if any one of $\xi$, $\eta$, $\zeta$ is $\ =\infty$.

The extra condition "and if $f$ is continuous $\ldots$" is usually fulfilled, but one cannot do without it: Consider the example $g(x):\equiv 1$ and $f(y):=2$ $\ (y=1)$, $\ f(y):=3$ $\ (y\ne1)$. Then $\lim_{x\to1}f\bigl(g(x)\bigr)=2$, but $\lim_{x\to1}g(x)=1$, $\ \lim_{y\to1}f(y)=3$.

• So essentially, in this version, by using the limit of f rather than its exact value at a particular point, we can include cases at infinity in the theorem? – Jack M Jul 7 '12 at 19:00
• @Jack M: Yes. By the way, I have changed the rôles of $f$ and $g$, as suggested by Arturo Magidin. – Christian Blatter Jul 7 '12 at 19:40
• I found this answer those most clear and complete. Arturo did include a proof, but this answer covers limits at infinity (to be fair though, my wording could be interpreted as only covering real limits). Also I was able to work out why a variable substitution I tried the other day failed - $f$ wasn't continuous at the limit of $g$. – Jack M Jul 7 '12 at 21:58
• 1) There is no requirement the value of $g(\xi)$ right? It can be any real number? 2) If $g(x)$ does not equal $\eta$ except possibly at $\xi$, then continuity of $f$ at $\eta$ is not required, correct? Thanks. – TSJ Mar 22 '15 at 3:16
• One more comment. The second condition states we need to know the original limit, $\lim_{y\to\eta}f(y)$, actually exists. So there are cases where after the change of variable we find $\lim_{x\to\xi}f\bigl(g(x)\bigr)$ exists, but the original $\lim_{y\to\eta}f(y)$ does not, in fact, exist? It would really useful in practice if we can say, under some condition, $\lim_{x\to\xi}f\bigl(g(x)\bigr)$ exists iff $\lim_{y\to\eta}f(y)$ exists. – TSJ Mar 22 '15 at 3:34

Yes, that's essentially the idea.

But this follows from the definition of continuity: we just need to show that if $f$ is continuous at $g(a)$ and $g$ is continuous at $a$, then $f\circ g$ is continuous at $a$. Because then both sides evaluate to $f(g(a))$, by definition of continuity (which requires that the limit exist and be equal to evaluating the function at the point.

To prove that if $g$ is continuous at $a$ and $f$ is continuous at $g(a)$, then $f\circ g$ is continuous at $a$, note first that $f\circ g$ is defined at $a$. Now, let $\epsilon\gt0$. then we know that there exists $\delta_1\gt 0$ such that if $|y-g(a)|\lt\delta_1$, then $|f(y)-f(g(a))|\lt\epsilon$; this holds, because $f$ is continuous at $g(a)$.

Now, since $g$ is continuous at $a$, and $\delta_1\gt 0$, this means that there exists $\delta\gt 0$ such that if $|x-a|\lt\delta$, then $|g(x)-g(a)|\lt\delta_1$.

Thus, if $|x-a|\lt\delta$, then $|g(x)-g(a)|\lt\delta_1$, and therefore $|f(g(x))-f(g(a))|=|f\circ g(x) - f\circ g(a)|\lt\epsilon$.

Thus, for all $\epsilon\gt 0$ there exists $\delta\gt 0$ such that if $|x-a|\lt\delta$, then $|f\circ g(x) - f\circ g(a)|\lt\epsilon$. Therefore, $f\circ g$ is continuous at $a$.

Therefore, we have that $\lim\limits_{y\to g(a)} f(y) = f(g(a))$, since $f$ is continuous at $g(a)$; and $\lim\limits_{x\to a}f\circ g(x) = f\circ g(a) = f(g(a))$, since $f\circ g$ is continuous at $a$.

You don't quite need $g$ to be continuous: if $\lim\limits_{x\to a}g(x)=L$ and $f$ is continuous at $L$, then we have $$\lim_{x\to a}f\circ g(x) = \lim_{y\to L}f(y) = f(L).$$ To verify this, let $\epsilon\gt 0$. Then there exists $\delta_1\gt 0$ such that for all $x$, $|y-L|\lt\delta_1$ implies $|f(y)-f(L)|\lt\epsilon$. Since $\lim\limits_{x\to a}g(x)=L$, there exists $\delta\gt 0$ such that if $0\lt |x-a|\lt \delta$ then $|g(x)-L|\lt\delta_1$. So, suppose that $0\lt |x-a|\lt\delta$. Then $|g(x)-L|\lt\delta_1$, and therefore $|f(g(x))-f(L)|\lt\epsilon$. Therefore, for every $\epsilon\gt 0$ there exists $\delta\gt 0$ such that if $0\lt |x-a|\lt\delta$, then $|f(x)-f(L)|\lt\epsilon$. This proves that if $\lim\limits_{x\to a}g(x) = L$ and $f$ is continuous at $L$, then $$\lim\limits_{x\to a}f\circ g(x) = \lim\limits_{y\to L}f(y) = f(L).$$ In particular, if $g$ is continuous at $a$, then we replace $L$ with $g(a)$.

We cannot omit the continuity of $f$ at $L$, though: take $g(x) = 0$ for all $x$, and let $$f(x) = \left\{\begin{array}{ll} 1 &\text{if }x\neq 0\\ 0 &\text{if }x=0. \end{array}\right.$$ Then $\lim\limits_{x\to a}f(g(x)) = 0$, because $f(g(x))=f(0)=0$. But $$\lim\limits_{y\to 0}f(y) = 1,$$ because we never take the value $y=0$ in evaluating the limit.

One can replace continuity of $f$ with other conditions; for example, we may ask that $g$ have a limit $L$ at $a$, and moreover, that for every $\delta\gt0$ there exist an $eta\gt 0$ such that $g$ takes all values on $(L-\eta,L+\eta)$, except perhaps $L$ itself, on $(a-\delta,a+\delta)-\{a\}$.

Added. The situation with limits as $x\to\infty$ is essentially the same if $\lim\limits_{x\to\infty}g(x)$ exists and is real. It is more complicated when the limit of $g$ is $\pm\infty$. See this answer for some discussion on that.

• We just need $g$ to have the limit, say $a$, at $x_0$ and $f$ has the limit, say $A$, at $a$. Of course we know that $g(x)\neq 0$ in some deleted nbh of $x_0$. Do we really need $g$ to be continuous at $x_0$? – mrs Jul 7 '12 at 18:01
• @Babak: No, that's not enough. Say $g$ is constant $0$, and $f$ is $0$ at $0$, and $1$ elsewhere. Then $g$ has a limit of $a=0$ at $x_0=0$, and $f$ has a limit $A=1$ at $a=0$. But $\lim\limits_{x\to 0}f\circ g(x) = 0$, and $\lim\limits_{y\to g(0)}f(y) = 1$. Replace the $0$ and $1$ with over values if you want $g(x)\neq 0$ in a punctured neighborhood of $x_0$. – Arturo Magidin Jul 7 '12 at 18:04
• Thanks, I see it, although I took $g$ not to be zero near $x_0$. – mrs Jul 7 '12 at 18:23
• Cool, nice proof. But what about limits at infinity? – Jack M Jul 7 '12 at 18:27
• @BabakSorouh: $g$ not being $0$ near $x_0$ is completely and utterly irrelevant. $0$ is a red herring. We are not taking quotients, we are composing, so values of $0$ are irrelevant. Just add $25$ to the values I gave: take $g$ to be constant $25$, take $f$ to be $25$ at $25$ and $26$ elseewhere. Then $g$ has limit $a=25$ at $x_0=25$, and $f$ has limit $A=26$ at $a=25$. But $\lim\limits_{x\to 25}f\circ g(x)=25$ and $\lim\limits_{y\to 25}f(y) = 26$. – Arturo Magidin Jul 7 '12 at 18:53

Let $L_1 = \lim\limits_{x \to g(a)} f(x)$ and $L_2 = \lim\limits_{x \to a} f(g(x))$. $L_1$ is unique in $\mathbb{R}$ so that for all $\varepsilon > 0$, there exists $\delta_1(\varepsilon) > 0$ such that if $|x-g(a)| < \delta_1(\varepsilon)$ then $|f(x) - L_1| < \varepsilon$. Similarly $L_2$ is unique so that there exists $\delta_2(\varepsilon) > 0$ such that if $|x-a| < \delta_2(\varepsilon)$ then $|f(g(x)) - L_2| < \varepsilon$.

Now we will show that $L_1$ also satisfies the property that $L_2$ satisfies uniquely. Take $\varepsilon > 0$. When $|x-g(a)| < \delta_1(\varepsilon/2)$,

\begin{align*} |f(g(x)) - L_1| &= |f(g(x)) + f(x) - f(x) - L_1| \\ &\le |f(g(x)) - f(x)| + |f(x) - L_1| \\ &< \varepsilon/2 + |f(g(x) - f(x)|. \end{align*}

Since $f$ is continuous, there exists $\delta(\varepsilon/2) > 0$ such that when $|x-g(a)| < \delta(\varepsilon/2)$, $|f(g(x)) - f(x)| < \varepsilon / 2$. Thus if $|x - g(a)| < \min\{\delta_1(\varepsilon/2), \delta(\varepsilon/2)\}$, then we get \begin{align*} |f(g(x)) - L_1| < \varepsilon/2 + \varepsilon/2 = \varepsilon. \end{align*} Thus $L_1$ is also the limit $\lim\limits_{x\to a} f(g(x))$ and by uniqueness we conclude $L_1 = L_2$, i.e. $\lim\limits_{x\to a} f(g(x)) = \lim\limits_{x\to g(a)} f(x)$.