Let $A ⊆ B ⊆\mathbb{R}$, let $f: B→\mathbb{R}$ and $g$ be restriction of $f$ to $A$(that is, $g(x) = f(x)$ for $x∈A$) then, a) if $f$ is continuous at $c∈ A$ then, g is continuous at $c$. b)Show by example that, if $g$ is continuous at point $c$ , it need not follow $f$ is continuous at $c$.
(Excercise Reference: introduction to Real analysis, Bartle sec 5.1)
My attempt:
a) given $f$ is continuous at $c∈ A$, hence $$\lim_{x\to c}f(x)=f(c)$$
Now,
$$\lim_{x\to c}g(x) =\lim_{x\to c}f(x)= f(c)=g(c)$$
(Since, $g(x) = f(x)$ if $x∈A$)
So that, $g$ must be continuous at $c$.
(b) I am stuck here, is b) is wrong? I mean, how could be, restriction is continuous but function is not continuous? Or I am not able to find such example! Please help me.
How about $A=\{x\in\mathbb{R}\colon x\geq 0\}$ and $B=\mathbb{R}$ and
$$ f(x)=\begin{cases} 1, & x\geq 0 \\ 0, & x<0 \end{cases}$$
Its restriction to $A$ is continuous (it is constant on $A$), but it is not continuous on $B$, as it has a jump discontinuity at $0$.