Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Prove or give a counterexample. let $f \colon R \to R$ such that $f$ is continuous on $D \subseteq R$ and $f$ is continuous on $S \subseteq R$. Then f is continuous on $D \cup S$. I am kind of puzzled with notation ($f$ is continuous on $D \subseteq R$ and $f$ is continuous on $S \subseteq R$. Then $f$ is continuous on $D \cup S$) Can you give me an example?

What if I consider this example: f(x) = x if x is rational and f(x) = 0 if x is irrational. Then I will have that f is continuous only at 0.( a counterexample)?

share|cite|improve this question
What part of the notation puzzles you? (At the moment, you simply restate verbatim the question.) – Did Mar 8 '12 at 10:31
Suppose $f$ is continuous on $(-1,0]$ and that $f$ is continuous on $(0,1)$. Does $f$ have to be continuous on $(-1,1)$? – Tom Cooney Mar 8 '12 at 10:41
Or maybe do an example like this: $f$ is continuous on $\mathbb R \setminus \{0\}$ and $f$ is continuous on $\{0\}$. – GEdgar Mar 8 '12 at 13:31
There is a semantic problem here that has not been addressed so far: A function $f:\ {\mathbb R}\to{\mathbb R}$ has a set of continuity $C_f:=\{x\in{\mathbb R}\ |\ f\ {\rm is\ continuous\ at}\ x\}$. When $D\subset C_f$ and $S\subset C_f$ then obviously $D\cup S\ \subset C_f$. On the other hand such an $f$ can be restricted to some given subset $D\subset{\mathbb R}$ which is now a topological space in its own right. When $f_D\ :\ D\to{\mathbb R}, \quad x\mapsto f(x)$ is continuous and similarly $f_S$ is continuous then $f_{D\cup S}$ need not be continuous on $D\cup S$. – Christian Blatter Mar 8 '12 at 15:54

The question could be understood in the following way: A function $f:\mathbb R\to\mathbb R$ is continuous on a set $A\subseteq\mathbb R$ iff it is continuous at each point $x\in A$.

If $f$ is continuous on $D$, that means that each $x\in D$ is a continuity point of $f$. Similarly, if $f$ is continuous on $C$, this means that each $x\in C$ is a continuity point. This obviously implies that $f$ is continuous at each point $x\in C\cup D$.

So if this is what OP has in mind when he speaks about a function continuous on a given subset of the domain, then the claim is true.

This is different from the answers which discuss continuity of the restrictions $f|_C$ and $f|_D$.

share|cite|improve this answer
What if I consider this example: f(x) = x if x is rational and f(x) = 0 if x is irrational. Then I will have that f is continuous only at 0. – max Mar 8 '12 at 13:45
As I said in my post, the whole thing depends on what you mean by by the term continuous on a set. It is true, that in your example both $f|_{\mathbb Q}$ and $f|_{\mathbb R\setminus\mathbb Q}$ are continuous. It is not true that this function is continuous at each point $x\in\mathbb Q$. It is not true that it is continuous at each point $x\in\mathbb R\setminus\mathbb Q$. – Martin Sleziak Mar 8 '12 at 14:14

Here’s a simple example of the situation that’s being described. Let $D=[0,1]$ and $S=[1,2]$, and define $$f(x)=\begin{cases}x,&\text{if }x\in[0,1]\\2-x,&\text{if }x\in[1,2]\;.\end{cases}$$ You can easily check that $f:[0,1]\to\Bbb{R}$ and $f:[1,2]\to\Bbb{R}$ are both continuous, as is $f:[0,2]\to\Bbb{R}$.

However, what happens if, for example, you take $D=\Bbb{Q}$, the set of rational numbers, and $S=\Bbb{R}\setminus\Bbb{Q}$? Can you define a function $f:\Bbb{R}\to\Bbb{R}$ such that $f$ is not continuous at any point, but $f\upharpoonright D$ and $f\upharpoonright S$ are both continuous?

For that matter, what if you take $D=[0,1)$ and $S=[1,2]$? Can you find a rather simple function that is continuous on $D$ and on $S$ but not on $[0,2]$?

share|cite|improve this answer

The result holds for closed sets.

Take $x_n\rightarrow a\in D\cup S$ then we have that part of this sequence pertains to $D$ and part pertain to $S$.

Let $(x_{n_j})\subset D$ then $f(x_{n_j})\rightarrow f(a)$ for the part that pertain to $D$, because $D$ is closed, for the part that pertains to $S$ we get $(x_{n_k})\subset S$ since $S$ is closed we have $f(x_{n_k})\rightarrow f(a)$ that implies $f(x_n)\rightarrow f(a)$, if one of the sequence is finite the result is achieved because for $n$ large enough $(x_{n})\subset D$ or $(x_{n})\subset S$ any way we will have $f(x_n)\rightarrow f(a)$ since the sequence was arbitrary we have $f$ is continuous.

The result is false for sets in general sets for a counter example take $f=1$ in $(0,1)$ and $f=0$ in $[1,2)$.

share|cite|improve this answer
Unfortunately, there is no guarantee that $(x_n)\subset S$ implies that $a\in S$ hence your proof breaks down. As it should... consider $D=\{x\mid x\leqslant0\}$ and $S=\{x\mid x\gt0\}$. – Did Mar 8 '12 at 10:46
Yeah the result is for both closed sets. It is false sets in general set for a counter example take $f=1$ in $(0,1)$ and $f=0$ \in $[1,2)$. – checkmath Mar 8 '12 at 11:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.