# Change of Variables in Limits (Part 1)

After answering this question, I was wondering if the following generalization holds true:

Claim: If $\lim \limits_{x\to a}g(x)=b$, then $\lim \limits_{x\to a}f(g(x))=\lim \limits_{y\to b}f(y)$.

I've seen some people use this change of variables before when evaluating difficult limits, but I haven't seen this presented as a theorem in a textbook. Is this claim true? If not, is the claim salvageable with additional hypotheses? For example, must $f$ be continuous for the claim to hold?

• The answer by Pedro is good. I have a different counter example, a different proof and some notes how this applies to continuous functions here: limitinfinite.org/index.php/…
– user154971
Commented Jun 3, 2014 at 16:28
• Commented Oct 24, 2017 at 6:55

You certainly need some assumptions on $$f,g$$, as this answer shows (and includes other cases).

THM Suppose that $$f(y)\to \ell$$ as $$y\to b$$. Suppose that $${\rm im}\, g\subseteq {\rm dom}\, f$$, and suppose that $$g(x)\to b$$ as $$x\to a$$, yet $$g$$ does not attain the value $$b$$ in a neighborhood $$B(x,\eta)-\{x\}$$. Then $$f\circ g(x)\to \ell \;\;\text{ as } x\to a$$

P Let $$\epsilon >0$$ be given. Since $$f\to\ell$$ as $$y\to b$$ there exists $$\delta >0$$ such that $$0<|y-b|<\delta$$ implies $$|f(y)-\ell|<\epsilon$$. Since $$g\to b$$ as $$x\to a$$, there exists $$\eta >\delta'>0$$ such that $$0<|x-a|<\delta'$$ implies $$0<|g(x)-b|<\delta$$. But then we will have $$|f(g(x))- \ell|<\epsilon$$ whenever $$0<|x-a|<\delta'$$, so the claim follows. $$\blacktriangle$$

This then gives the standard

COR Suppose that $$f$$ is continuous at $$g(a)$$ and $$g$$ is continuous at $$a$$. Then $$f\circ g$$ is continuous at $$a$$.

• The definition of $f\to\ell$ as $x\to a$ is that for all $\epsilon>0$, there exists $\delta>0$ such that $0<|x-a|<\delta \implies |f(x)-\ell|<\epsilon$. I've noticed that both you and Jared omitted the part where $0<|x-a|$. Is this part unimportant? I can see that: $$0<|x-a|<\delta' \implies |x-a|<\delta' \implies |g(x)-b|<\delta$$ but how do we do know that $g(x) \neq b$ so that we can use the fact that: $$0<|g(x)-b|<\delta \implies |f(g(x))-\ell|<\epsilon$$ Commented Jul 31, 2013 at 1:05
• @Adriano You're absolutely correct. In this answer, $g$ does not attain the value $b$ in a neighbourhood of $x$, so indeed $0 <$ holds.
– Pedro
Commented Jul 31, 2013 at 1:08
• So there is no requirement on $g(a)$? It can be $b$, or anything else?
– TSJ
Commented Mar 22, 2015 at 2:12
• In the theorem statement, I think the neighborhood has to be of the point a, right? Commented Jan 26, 2020 at 22:18
• this is probably the most used and most unkwnon theorem Commented Jan 9, 2022 at 11:54

A counterexample. Let $a=b=0$, $g(x)=x^2$, and let

$$f(x)=\begin{cases}1&x\ge 0\\0&x<0\end{cases}$$

Then $\lim_{y\to 0}f(y)$ does not exist, but $\lim_{x\to 0}f(g(x))=1$.

If we suppose that $\lim_{y\to b}f(y)$ exists, then the result holds.

First suppose that the limit is finite and equal to $L$. Fix $\epsilon>0$, and let $\delta$ be such that

$$|y-b|<\delta\Longrightarrow |f(y)-L|<\epsilon$$

Now, choose $\delta'$ such that

$$|x-a|<\delta'\Longrightarrow|g(x)-b|<\delta$$

Notice now that we have

$$|x-a|<\delta'\Longrightarrow|f(g(x))-L|<\epsilon$$

which shows that $\lim_{x\to a}f(g(x))=L$. The case of an infinite limit is shown similarly.

• You are incorrect. Here is a counterexample for your statement: Let $a=b=0$, $g(x)=x\sin(1/x)$ and f(x)=\left\{\begin{aligned}&2,\quad x= 0\\&1,\quad \text{otherwise}\end{aligned}\right.. Then, $\displaystyle\lim_{x\to a} g(x)=b$ and $\displaystyle\lim_{y\to b} f(y)=1$ . However, the result does not hold because $\displaystyle \lim_{x\to a}f(g(x))$ does not exist: f(g(x))=\left\{\begin{aligned}&2,\quad x= \tfrac{1}{n\pi}\text{ with }n\in\mathbb Z^*\\&1,\quad \text{otherwise}\end{aligned}\right. so that the function jumps from 1 to 2 near zero. Commented May 2, 2023 at 21:59
• The problem is that, if you use the correct definition of limit with $0<|\cdots|<$ instead of just $|\cdots|<$, your last implication is not valid. Commented May 2, 2023 at 22:05
• @Pedro Thanks! You can edit that example into the accepted answer, if you'd like, and make it community wiki, i.e. replace "as Jared shows" by "as this counterexample shows". You can also add another answer, but maybe that's not the best solution since the post is quite old. Best,
– Pedro
Commented May 3, 2023 at 10:37
• @Pedro I decided post a new answer because no existing answer covers for all possible cases. Commented May 4, 2023 at 13:58

I haven't seen this presented as a theorem in a textbook.

Well, this issue is treated in Protter's book (see from theorem 2.7 to theorem 2.17(a)). A general result can be stated as follows.

Theorem of change of variables in limits: Let $$\alpha,\beta,\gamma$$ represent real numbers, $$\infty$$ or $$-\infty$$. We have $$\lim_{x\to\alpha} f(g(x))=\lim_{y\to \beta}f(y),\quad\text{where}\quad \beta=\lim_{x\to\alpha} g(x),$$ provid that $$\displaystyle\lim_{y\to \beta}f(y)=\gamma$$ and at least one of the following conditions is satisfied:

1. $$\beta,\gamma\in \mathbb R$$ and $$f$$ is continuous at $$\beta$$.
2. $$\beta\in\mathbb R$$ and $$g(x)\neq \beta$$ in a punctured neighbourhood of $$\alpha$$.
3. $$\beta=\infty$$ or $$-\infty$$.

The same result is valid for one-sided limits.

Remark: Hipotesis 1, 2 or 3 are not superfluous since the existence of $$\displaystyle\lim_{y\to \beta}f(y)$$ is not enough to ensure the validity of the result. Take, for example, $$\alpha=\beta=0$$, $$\gamma=1$$, $$g(x)=x\sin(1/x)$$ and f(x)=\left\{\begin{aligned}&2,\quad x= 0\\&1,\quad \text{otherwise}\end{aligned}\right.. Then, $$\displaystyle \lim_{x\to \alpha}g(x)=\beta$$ and $$\displaystyle \lim_{y\to \beta}f(y)=\gamma$$. However, the result does not hold because $$\displaystyle \lim_{x\to \alpha}f(g(x))$$ does not exist: f(g(x))=\left\{\begin{aligned}&2,\quad x= \tfrac{1}{n\pi}\text{ with }n\in\mathbb Z^*\\&1,\quad \text{otherwise}\end{aligned}\right. so that the function jumps from $$1$$ to $$2$$ near zero.

Proof: We prove it for two-sided limits. The proof for one-sided is similar.

Suppose that condition 1 is satisfied. Here, we can have $$\alpha$$ real, $$\infty$$ or $$-\infty$$. We suppose that $$\alpha$$ is real. If $$\alpha=\infty$$ or $$-\infty$$ the argument is similar, with the used definition of limit replaced by the appropriate one.

Since $$f$$ is continuous at $$\beta$$, given $$\varepsilon>0$$, there exists $$\delta>0$$ such that $$|y-\beta|<\delta$$ implies $$|f(y)-f(\beta)|<\varepsilon$$. Since $$\displaystyle \lim_{x\to\alpha} g(x)=\beta$$, given $$\tilde{\varepsilon}>0$$, there exists $$\tilde{\delta}>0$$ such that $$0<|x-\alpha|<\tilde{\delta}$$ implies $$|g(x)-\beta|<\tilde{\varepsilon}$$. Taking $$\tilde{\varepsilon}=\delta$$, we see that $$0<|x-\alpha|<\tilde{\delta}$$ implies $$|g(x)-\beta|<\delta$$, which implies $$|f(g(x))-f(\beta)|<\varepsilon$$. Therefore, $$\displaystyle\lim_{x\to\alpha}f(g(x))=f(\beta)=\gamma=\lim_{y\to \beta} f(y)$$.

Suppose that condition 2 is satisfied. Here, we can have $$\alpha$$ as well as $$\gamma$$ real, $$\infty$$ or $$-\infty$$. We suppose that $$\gamma$$ is real and $$\alpha=\infty$$. In the other cases, the arguments are similar (just replace the definition of limit).

Since $$\displaystyle\lim_{y\to \beta}f(y)=\gamma$$, given $$\varepsilon>0$$, there exists $$\delta>0$$ such that $$0<|y-\beta|<\delta$$ implies $$|f(y)-\gamma|<\varepsilon$$. Since $$\displaystyle \lim_{x\to\infty} g(x)=\beta$$, given $$\tilde{\varepsilon}>0$$, there exists $$\tilde{\delta}>0$$ such that $$x>\tilde{\delta}$$ implies $$|g(x)-\beta|<\tilde{\varepsilon}$$, which implies $$0<|g(x)-\beta|<\tilde{\varepsilon}$$. Taking $$\tilde{\varepsilon}=\delta$$, we see that $$x>\tilde{\delta}$$ implies $$0<|g(x)-\beta|<\delta$$, which implies $$|f(g(x))-\gamma|<\varepsilon$$. Therefore, $$\displaystyle\lim_{x\to\infty}f(g(x))=\gamma=\lim_{y\to \beta} f(y)$$.

Suppose that condition 3 is satisfied. Here $$\beta=\infty$$ or $$-\infty$$ and, again, we can have $$\alpha$$ as well as $$\gamma$$ real, $$\infty$$ or $$-\infty$$. We suppose that $$\beta=\gamma=\alpha=\infty$$. The other cases are similar.

Since $$\displaystyle\lim_{y\to \infty}f(y)=\infty$$, given $$\varepsilon>0$$, there exists $$\delta>0$$ such that $$y>\delta$$ implies $$f(y)>\varepsilon$$. Since $$\displaystyle \lim_{x\to\infty} g(x)=\infty$$, given $$\tilde{\varepsilon}>0$$, there exists $$\tilde{\delta}>0$$ such that $$x>\tilde{\delta}$$ implies $$g(x)>\tilde{\varepsilon}$$. Taking $$\tilde{\varepsilon}=\delta$$, we see that $$x>\tilde{\delta}$$ implies $$g(x)>\delta$$, which implies $$f(g(x))>\varepsilon$$. Therefore, $$\displaystyle\lim_{x\to\infty}f(g(x))=\infty=\lim_{y\to \infty} f(y)$$. $$\square$$

• Thank you for this answer, I enjoyed it very much. The theorem you stated allows one to move the limit inside a composite function, i.e. $\lim_{x\to a} f(g(x))=f(\lim_{x\to a} g(x))$. Is there a similar result for sequences, i.e. when is it allowed to write $\lim_{n\to \infty} f(x_n)=f(\lim_{n\to \infty} x_n)$?
– psie
Commented Aug 26, 2023 at 0:40
• It is allowed provided that the limit of the sequence exists, the said limit belongs to the domain of the function and the function is continuous. See this Commented Aug 26, 2023 at 11:22
• @LoaiGhoraba This is the best reference that I found. Actually, I can't remember another book with this topic. ​ Commented Nov 10, 2023 at 14:26
• @LoaiGhoraba It seems that most calculus book are restricted to Case 1, for one variable as well as for two (for example, Stewart, Marsden & Weinstein or Adams & Essex). However, this formulation is not enough because does not allow us to compute some basic limits as $\lim_{(x,y)\to(0,0)}(x^2+y^2)\ln(x^2+y^2)$ (which is solved, for example, in Anton, Bivens & Davis by substitution of variable without justification). Commented Nov 12, 2023 at 12:28
• Elon's book (which is the main analysis reference in my language) presents cases 1 and 3 in the text, but the Case 2 is put as an exercise. In Guidorizzi's book (which is a well known calculus book in my language), cases 1 and 2 are presented as theorems. By now, these are the sources I'm aware of. Commented Nov 12, 2023 at 12:29