# Extension of continuous function on a closed subset of $\mathbb{R}$

Any help with this problem is appreciated. It comes up in the context of Lusin's theorem, where it was assumed to be true.

Suppose $E$ is a closed subset of $\mathbb{R}$ and $f:E\rightarrow \mathbb{R}$ is continuous. There exists a continuous function $g: \mathbb{R} \rightarrow \mathbb{R}$ such that $f(x)=g(x)$ for $x \in E$ and $g$ satisfies $$\sup_{x \in \mathbb{R}} |g(x)| \leq \sup_{x \in E} |f(x)|\;.$$

• You might as well replace $\le$ with $=$, since the supremum can’t shrink. – Brian M. Scott Feb 13 '13 at 3:10

$\Bbb R\setminus E$ is open, so it can be written as a union of pairwise disjoint open intervals. (Infinite intervals, e.g. $(a,\to)$, are permitted.)

Suppose that $(a,b)$ is one of these intervals; extend $f$ to $(a,b)$ by defining

$$g(x)=\frac{f(b)-f(a)}{b-a}(x-a)+f(a)$$

for $x\in(a,b)$. In other words, just make the graph of $g\upharpoonright[a,b]$ the straight line segment with endpoints $\langle a,f(a)\rangle$ and $\langle b,f(b)\rangle$. If $(a,\to)$ is one of the intervals, let $g(x)=f(a)$ for $x>a$. And if $(\leftarrow,a)$ is one of the intervals, let $g(x)=g(a)$ for $x<a$. The resulting function $g$ clearly has the desired properties.

• How does this take care of the end points of the open intervals? – user62089 Feb 13 '13 at 5:18
• @pondy: They’re in $E$: $f$ (and hence $g$) is already defined there. And $g$ is defined on the intervals to match up with the values of $f$ at the endpoints. Draw a couple of pictures. – Brian M. Scott Feb 13 '13 at 5:20
• @BrianM.Scott: Could you please explain what $g\upharpoonright[a,b]$ means, notation wise? I'm not familiar with \upharpoonright symbol. (or does it just mean the graph of $g$ is the straight line segment with endpoints $(a,f(a))$ and $(b,f(b))$?) – Sujaan Kunalan Mar 16 '15 at 3:18
• @Sujaan: The restriction of the function $g$ to the set $[a,b]$. Other common notations are $g\mid[a,b]$ and $g\mid_{[a,b]}$. – Brian M. Scott Mar 16 '15 at 3:19
• @BrianM.Scott: Ah,ok. Thanks for the clarification. – Sujaan Kunalan Mar 16 '15 at 3:19