# Assume f and g are defined on all of $\mathbb{R}$ and that $\lim_{x\to p} f(x) = q$ and $\lim_{x\to q} g(x) = r$.

(a) Give an example to show that it may not be true that $\lim_{x\to p} g(f(x)) = r$

If we are to assume that f and g are defined on all of $\mathbb{R}$, wouldn't that mean that f and g are continuous on all of $\mathbb{R}$? In what circumstance would a discontinuity arise so that this would not be true, or can this statement not be true even if there was no discontinuity?

(b) Show that the result in (a) does occur even if f and g are continuous.

(c) Does the result in (a) hold if f is continuous? How about if only g is continuous?

• Consider the function $f(x):=\text{sgn}(x)$, is it continuous? Is it defined on all of $\mathbb{R}$? – b00n heT May 31 '16 at 11:06

For the first question, consider the following: Let $$g(x)=\begin{cases}1&x=0\\-1&x\not=0\end{cases}.$$ Let $q=0$; then $\lim_{x\rightarrow q}g(x)=\lim_{x\rightarrow 0}g(x)=-1$. Therefore, $r=-1$. Let $$f(x)=0.$$ Suppose that $p=0$, then $\lim_{x\rightarrow p}f(x)=\lim_{x\rightarrow 0}f(x)=0=q$.
Now, $g(f(x))=g(0)=1$. Therefore, $\lim_{x\rightarrow p}g(f(x))=\lim_{x\rightarrow 0}1=1\not=r$.
The question doesn't state that $p$, $q$, and $r$ are universally quantified; as stated, you just need to be able to pick values for $p$, $q$, and $r$. The reason that this example works is that limits at a point don't depend on the value of the function at the point, but by choosing $f$ to be the constant function, $g(f(x))$ only sees the value of the function $g$ at the point $0$ and not the the value of $g$ in a neighborhood of $0$.
• If you follow the ideas, you can get that it's ok if only $g$ is continuous, but not if only $f$ is continuous. @Rhaldryn. – Michael Burr May 18 '18 at 6:18