# Extending a Continuous Function a Closed Set

## Homework Statement

Let ##E## be a closed set of real numbers and ##f## a real-valued function that is defined and continuous on ##E##. Show that there exists a function ##g## defined and continuous on all of ##\Bbb{R}## such that ##f(x) = g(x)## for each ##x \in E##.

## The Attempt at a Solution

Since ##E## is closed, the set ##U = \Bbb{R} - E## must be open, which means that it can be written as a union of disjoint intervals like so: ##U = \bigcup_{i \in I} (a_i,b_i)##. Now, if ##x \in E##, simply define ##g(x) = f(x)##. However, if ##x \in U##, then there exists a ##i## such that ##x \in (a_i,b_i)##. In this case, let ##g(x) = \frac{f(b_i)-f(a_i)}{b_i-a_i}(x-a_i) + f(a_i)##. So, in other words,

$$g(x) = \begin{cases} f(x), & x \in E \\ \\ \frac{f(b_1)-f(a_1)}{b_1-a_1}(x-a_1) + f(a_1), & x \in (a_1,b_1) \\ \\ \frac{f(b_2)-f(a_2)}{b_2-a_2}(x-a_2) + f(a_2), & x \in (a_2,b_2) \\ \vdots & \vdots \\ \end{cases}$$

Now we prove continuity. To do this, we need only concern ourselves with the endpoints of the intervals. Take one of these intervals ##(a,b)##, and without loss of generality we will verify continuity at ##x = a##. I think only need to compute the right-hand limit (using the definition of course, but I will omit it since it is trivial). Since linear functions are continuous, the right-hand limit exists and equals the actual limit; i.e.,

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

which shows ##g## is continuous at ##x=a##.

What worries me is that left and right hand limits have not been introduced, and if they were suppose to be used, then they would be introduced, since Real Analysis by Royden and Fitzpatrick is a rigorous graduate level book. However, this is the only method of proof I could come up with. Maybe the book is presupposing knowledge of left and right handed limits. What do you think? Is there a better way to solve the problem?

I just realized that I left out the case in which one of the open intervals being is unbounded. That shouldn't be too hard though; I just make the sure the one finite endpoint 'matches up' with ##f##, as I did above.

Related Calculus and Beyond Homework Help News on Phys.org
RUber
Homework Helper
In your write-up, you refer to ##f(a_i) ## and ##f(b_i)##. Since ##f## is only defined in ##E##, wouldn't this mean that all your points ##a_i, b_i \in E## as well?
I gather that the function you defined is sort of a 'connect the dots' sort of linear interpolation between disjoint points.
What if ##E## is a closed interval? This seems more likely since ##f## is defined to be continuous.

Yes. The ##a_i## and ##b_i## are going to be in ##E##, since the open intervals are disjoint, and so the only other place for them is in ##E##. I don't see why it's more likely that ##E## is a closed interval. Nonetheless, this case can be treated in the same way as the case where there is at least one unbounded open interval. So is my solution acceptable?

RUber
Homework Helper
Got it. Since you didn't make that explicit in the proof, I was not following your logic. In that case, the only thing missing are the infinite endpoints. If ##\exists m \in \mathbb{E} \, s.t. \forall x \in E, x \geq m## and likewise if ##\exists M \in \mathbb{E} \, s.t. \forall x \in E, x \leq M##, then you might use any continuous function to extend the infinite tails...but your existing definition does not sufficiently describe that case.

Okay. Here is an attempt. Suppose there exists an unbounded open interval in the union ##U = \bigcup_{i \in I} (a_i,b_i)##. Then it must be either ##(-\infty, a)## or ##(a, \infty)##, or both. We will just deal with first case. In this situation, just take our function ##g## defined above and stipulate that ##g(x) = (x-a) +f(a)##, and for the rest of the open intervals that are bounded, define ##g## as I did in my first post. Clearly the left-hand limit of ##g## at ##a## is ##f(a)##, which proves continuity.

RUber
Homework Helper
That makes sense.

• Bashyboy