# Trouble understanding Spivak's Calculus Chapter 6 Problem 13 on continuity

I encountered some difficulties with Problem 13 from Chapter 6 of Spivak's calculus dealing with continuities. The question in whole:

(a) Prove that if $$f$$ is continuous on $$[a, b]$$, then there is a function g which is continuous on $$\mathbb{R}$$, and which satisfies $$g(x) = f(x)$$ for all $$x$$ in $$[a, b]$$. Hint: Since you obviously have a great deal of choice, try making g constant on $$(-\infty, a]$$ and $$[b, \infty)$$.

(b) Give an example to show that this assertion is false if $$[a, b]$$ is replaced by $$(a,b)$$.

I understand the solution to part (a), which gives the following function for $$g(x)$$:

$$g(x) = \left\{ \begin{array}{ll} \lim_{x \to a^+} f(x) & \mbox{if } x \le a \\ f(x) & \mbox{if } a < x < b \\ \lim_{x \to b^-} f(x) & \mbox{if } x \ge b \end{array} \right.$$

My interpretation was that since $$f$$ is continuous on $$[a,b]$$, then,

$$\lim_{x \to a^+} f(x) = f(a) \\ \lim_{x \to b^-} f(x) = f(b)$$

Hence, the function definition for $$g(x)$$ satisfies $$g(x) = f(x)$$ for all $$x$$ in $$[a, b]$$.

However, for part (b), I just don't understand how the assertion becomes false just by replacing the closed interval $$[a, b]$$ with the open interval $$(a, b)$$. The only change I can visualize is that we can no longer make the initial statement that $$\lim_{x \to a^+} f(x) = f(a)$$ and $$\lim_{x \to b^-} f(x) = f(b)$$. However, I don't understand how is it then that $$g(x) = f(x)$$ cannot still hold for $$a < x < b$$.

Any pointers would be greatly appreciated!

• You're on the right track: the issue is that $\lim_{x\to a^+}f(x)$ and $\lim_{x\to b^-}f(x)$ may not necessarily exist anymore (so your initial proposal for $g$ is not even well-defined anymore). So, to come up with an explicit counterexample, can you think of a function for which the limit at a certain point does not exist? (Hint: read through the text again, you'll definitely find an example) Aug 25, 2020 at 1:12
• What makes the assertion false is not that $g(x) = f(x)$ can't hold for $x\in(a,b)$ but that, unlike the first case, $g$ no longer exists for all possible $f$. Take $f(x) = \frac{1}{x-a}$ and try to prove that for any value we choose for $g(a)$, $g$ won't be continuous at $x=a$. Aug 25, 2020 at 1:20
• Oh no, I see. I was under the impression that the function $g(x)$ could be 're-defined' to simply $g(x) = f(x)$ with the change to the interval. I see now that the original $g(x)$ is rendered invalid regardless of the value a. Thank you! Aug 25, 2020 at 1:34
• @iobtl for what it's worth: I think that part of the difficulty that you had was caused because part(b) of the problem was worded in a valid but tricky manner. I would have worded part (b) : show that is possible to construct a function $f$ that is continuous on $(a,b)$ $\{$that is, $f$ may or may not be continuous on $[a,b]\}$ and such that no satisfying function $g$ can be constructed. Aug 25, 2020 at 5:52
• @user2661923 yep, that may have been part of it. All is well though, I understand the key idea the problem was trying to bring across with regards to the continuity in a closed vs open interval. Aug 25, 2020 at 13:07

As mentioned in the comments, $$(b)$$ asks to construct a function $$f$$ that is continuous on $$(a,b)$$ for which there is no function $$g$$ satisfying

1. $$g(x)=f(x)$$ for all $$x$$ in $$(a,b)$$.
2. $$g$$ is continuous on $$\mathbb R$$.

Since the closed interval $$[a,b]$$ is replaced by the open interval $$(a,b)$$, the function $$f$$ doesn't need to be continuous at the endpoints $$a$$ and $$b$$.

Two valid constructions for $$f$$ are:

$$f(x)=\frac{1}{x-a} \quad {\text{or}}\quad f(x)=\frac{1}{x-b}.$$

Both of these satisfy the condition that $$f$$ is continuous on $$(a,b)$$. However, if $$g(x)=f(x)$$ on $$(a,b)$$ then $$g$$ becomes arbitrarily large around $$a$$ or $$b$$ and therefore cannot be continuous on $$\mathbb R$$.

• Extremely clear and straightforward. Thank you! Aug 26, 2020 at 1:20

Take $$f(x) =\dfrac{1}{x}$$ which is continuous on $$(0,1)$$, can you find such $$g(x)$$?

The reason why the extension works in part (a) is because $$[a,b]$$ is a closed interval, and $$f$$ is a continuous function, so

1.$$\lim_{x\rightarrow a}f(x)$$ exists and is finite.

2.$$\lim_{x\rightarrow a}f(x)=f(a)$$.

However, if we define $$\tan(x)$$ on $$(-\frac{\pi}{2},\frac{\pi}{2})$$, then both 1. and 2.above fail, since $$\lim_{x\rightarrow \pi/2}\tan(x)=\infty\text{ and }\lim_{x\rightarrow -\pi/2}\tan(x)=-\infty.$$ So in these sort of cases, no continuous extension can exist. Hopefully this helps.

A function may be strictly increasing on the interval $$(a,b)$$ and approach $$+\infty$$ as $$x$$ approaches $$b$$ from below and approach $$-\infty$$ as $$x$$ approaches $$a$$ from above.