# A continuous function with measurable domain.

Let $D$ and $E$ be measurable sets and $f$ a function with domain $D\cup E$. We proved that $f$ is measurable on $D \cup E$ if and only if its restrictions to $D$ and $D$ are measurable. Is the same true if measurable is replaced by continuous.

I wrote the question straight out of the book this time to make sure I did this correctly. I mechanically replaced measurable with continuous starting with the measurable after $f$.

Below here is what I wrote before I changed the question I've proven the case where continuous is switched for measurable. I'm just not sure of a meaningful relationship between measurable sets for domains and continuity.

-

That's wrong. Let $f\colon[0,1] \to \mathbb R$ be given by $x\mapsto \begin{cases} 1 & x = 0\\ 0 & x > 0 \end{cases}$ Then $f$ is not continuous, but it is, restricted to $D := \{0\}$ and $E := (0,1]$, both of which are measurable.
Let me add something concerning your edit: As the example above shows, for just measurable parts $D$ and $E$ continuity of $f|_D$ and $f|_E$ doesn't imply that of $f$ on $D \cup E$. But if both $D$ and $E$ are open in $D \cup E$ or both closed, then your result holds:
For open $D$ and $E$ we argue as follows: Let $U \subseteq \mathbb R$ be open, then we have $f^{-1}[U] = f|_D^{-1}[U] \cup f|_E^{-1}[U]$. Now, $f|_D^{-1}[U]$ is open in $D$ by continuity of $f|_D$, as $D$ is open in $D\cup E$, $f|_D^{-1}[U]$ is also. By the same argument, replacing $D$ by $E$, $f|_E^{-1}[U]$ is open in $D\cup E$, hence $f^{-1}[U]$ is, proving the continuity of $f$.