Let $X\subset \mathbb R$ and $f:X\to \mathbb R$ be a function.

I want to show

If $A,B\subset \mathbb R$ satisfy $$X=A\cup B, A\cap B=\emptyset,$$ then

$f$ is continuous $\iff$ $f|_A$, $f|_B$ are both continuous.

I did $\Rightarrow$. So I have to show opposite.

Suppose $f|_A$, $f|_B$ are both continuous.

To show the continuity of $f:X\to \mathbb R$, I'll show $$\forall O\in \mathcal O_{\mathbb R}\ ; \ f^{-1}(O)\in \mathcal O_{\mathbb R}^X,$$ where $\mathcal O_{\mathbb R}$ is Euclidean topology and $\mathcal O_{\mathbb R}^X$ is relative topology, i.e., $\mathcal O_{\mathbb R}^X=\{ X\cap O \mid O\in \mathcal O_{\mathbb R} \}.$

I have $$f^{-1}(O)=(f|_A)^{-1}(O)\cup (f|_B)^{-1}(O).$$

And from the continuity of $f|_A$ and $f|_B$, I have $$(f|_A)^{-1}(O)\in \mathcal O_{\mathbb R}^A,\ (f|_B)^{-1}(O)\in \mathcal O_{\mathbb R}^B.$$ So there exists $O_1, O_2\in \mathcal O_{\mathbb R}$ s.t. $$(f|_A)^{-1}(O)=A\cap O_1,\ (f|_B)^{-1}(O)=B\cap O_2.$$

Then, \begin{align} f^{-1}(O) &=(f|_A)^{-1}(O)\cup (f|_B)^{-1}(O)\\ &=(A\cap O_1) \cup (B\cap O_2) \end{align}

So, to show $f^{-1}(O)\in \mathcal O_{\mathbb R}^X$, I want to say $$(A\cap O_1) \cup (B\cap O_2) =X\cap [\mathrm{an \ element \ of\ } \mathcal O_{\mathbb R}]. \ \cdots (\ast) $$

But I'm stacked here. I don't know how I should show $(\ast)$.

  • 3
    $\begingroup$ That is false, see for instance $X=\Bbb R$, $A=(-\infty,0)$, $B=[0,\infty)$ and $f(x)=\begin{cases}0&\text{if }x\ge 0\\ 1&\text{if }x<0\end{cases}$. $\endgroup$ Oct 27, 2022 at 16:44
  • 1
    $\begingroup$ In topology "disjoint union" does not mean the union of disjoint subspaces, but the union of disjoint $A, B$ which are both open in $A \cup B$. $\endgroup$
    – Paul Frost
    Oct 27, 2022 at 16:50
  • $\begingroup$ The question clearly indicates that $A, B$ are disjoint sets. And then it's false, as Sassatelli Giulio's example shows. $\endgroup$
    – Ulli
    Oct 27, 2022 at 17:48
  • $\begingroup$ Of course, if $A, B$ are disjoint, open sets its true. But there is a more powerful version: It suffices that $A, B$ are closed sets, whose union is $X$ (not necessarily disjoint). Try to prove this one, it is really helpful in many situations. $\endgroup$
    – Ulli
    Oct 27, 2022 at 18:19

1 Answer 1


$\Longleftarrow$ is false. In his comment Sassatelli Giulio gave the counterexample $X = \mathbb R, A = (-\infty,0), B= [0,\infty), f(x) = \begin{cases} 1 & x \in A \\ 0 & x \in B\end{cases}$.

But, as Paul Frost comments, perhaps you misunderstood the concept of disjoint union in topology. A space $X$ is the disjoint union of subspaces $A, B$ if

  1. $A \cup B = X$.
  2. $A \cap B = \emptyset$.
  3. $A, B$ are open in $X$.

Note that 3. is equivalent to the requirement that $A, B$ are closed in $X$.

In your question you consider the case $X \subset \mathbb R$. Condition 3. does not mean that $A, B$ are open (or closed) in $\mathbb R$. An example is $X = (0,1] \cup [2,3), A = (0,1], B = [2,3)$.

Now forget that $X \subset \mathbb R$. We only need to know that it is a topological space.

To show that $f$ is continuous, we have to show that for $f^{-1}(U)$ is open in $X$ for each open $U \subset \mathbb R$. We know that $(f \mid_A)^{-1}(U) = f^{-1}(U) \cap A$ is open in $A$ and $(f \mid_B)^{-1}(U) = f^{-1}(U) \cap B$ is open in $B$. But $A$ and $B$ are open in $X$, thus also $f^{-1}(U) \cap A$ and $f^{-1}(U) \cap B$ are open in $X$. Therefore $f^{-1}(U) = f^{-1}(U) \cap A \cup f^{-1}(U) \cap B$ is open in $X$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .