Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Can we construct a function $f:\mathbb{R} \rightarrow \mathbb{R}$ such that it has intermediate value property and discontinuous everywhere?

I think it is probable because we can consider $$ y = \begin{cases} \sin \left( \frac{1}{x} \right), & \text{if } x \neq 0, \\ 0, & \text{if } x=0. \end{cases} $$ This function has intermediate value property but is discontinuous on $x=0$.

Inspired by this example, let $r_n$ denote the rational number,and define $$ y = \begin{cases} \sum_{n=1}^{\infty} \frac{1}{2^n} \left| \sin \left( \frac{1}{x-r_n} \right) \right|, & \text{if } x \notin \mathbb{Q}, \\ 0, & \mbox{if }x \in \mathbb{Q}. \end{cases} $$

It is easy to see this function is discontinuons if $x$ is not a rational number. But I can't verify its intermediate value property.

share|improve this question
Kindly typeset your post in future. –  user17762 Feb 13 '11 at 9:13

5 Answers 5

Sure. The class of functions satisfying the conclusion of the Intermediate Value Theorem is actually vast and well-studied: such functions are called Darboux functions in honor of Jean Gaston Darboux, who showed that any derivative is such a function (the point being that not every derivative is continuous).

A standard example of an everywhere discontinuous Darboux function is Conway's base 13 function.

(Perhaps it is worth noting that the existence of such functions is not due to Conway: his is just a particularly nice, elementary example. I believe such functions were already well known to Rene Baire, and indeed possibly to Darboux himself.)

share|improve this answer
+1 for the base 13 function. I also thought sin(1/x) was a bit of a cheat, being discontinuous only in one point. –  Glen Wheeler Feb 13 '11 at 10:57

Any function that give all the reals numbers on any open interval is an example. You can find other examples of this in the answers to this question on MathOverflow.

share|improve this answer

Please look at the problem $1.3.29$ in Problems in Mathematical Analysis Vol II, Continuity and Differentiation, by Kaczor and Nowak.

They have provided solutions also. Anyhow since one can't view it in Google books, I am Texing out the solution here.

Question: Recall that every $x \in (0,1)$ can be represented by a binary fraction $0.a_{1}a_{2}a_{3}\cdots$, where $a_{i} \in \{0,1\}$ and $i=1,2, \cdots$. Let $f: (0,1) \to [0,1]$ be defined by $$ f(x) = \overline{\lim_{n \to \infty}} \ \frac{1}{n} \sum\limits_{i=1}^{n}a_{i}$$ Prove that $f$ is discontinuous at each $x \in (0,1)$ but nevertheless has the intermediate value property.

Solution. We show that if $I$ is a subinterval of $(0,1)$ with non-empty interior then, $f(I)=[0,1]$. To this end, note that such an $I$ contains a sub-interval $\bigl(\frac{k}{2^{n_0}}, \frac{k+1}{2^{n_0}}\bigr)$. So it is enough to show that, $$f\biggl(\biggl(\frac{k}{2^{n_0}},\frac{k+1}{2^{n_0}}\biggr)\biggr)= [0,1]$$

Now observe that if $x \in (0,1)$ then either $x-\frac{m}{2^{n_0}}$ with some $m$ and $n_0$ or $x \in \bigl(\frac{j}{2^{n_0}},\frac{j+1}{2^{n_0}}\bigr)$ with some $j=0,1, \cdots, 2^{n_0}-1.$ If $x = \frac{m}{2^{n_0}}$, then $f(x)=1$, and the value of $f$, at the middle point of $\bigl(\frac{k}{2^{n_0}}, \frac{k+1}{2^{n_0}}\bigr)$ is also $1$. Next if $x \in \bigl(\frac{j}{2^{n_0}}, \frac{j+1}{2^{n_0}}\bigr)$ then there is $x' \in \bigl(\frac{k}{2^{n_0}}, \frac{k+1}{2^{n_0}}\bigr)$, such that $f(x)=f(x')$. Indeed, all numbers in $\bigl(\frac{k}{2^{n_0}}, \frac{k+1}{2^{n_0}}\bigr)$ have the same first $n_0$ digits, and we can find $x'$ in this interval for which all the remaining digits are as in the binary expansion of $x$. Since $$\overline{\lim_{n\to\infty}} \ \frac{\sum\limits_{i=1}^{n} a_{i}}{n} = \overline{\lim_{n\to\infty}} \ \frac{\sum\limits_{i=n_{0}+1}^{n} a_{i}}{n}$$ we get $f(x)=f(x')$.

Consequently it is enough to show that $f((0,1))=[0,1]$, or in other words, for each $y \in [0,1]$ there is $x \in (0,1)$ such that $f(x)=y$. It follows from the above that $1$ is attained, for example at $x =\frac{1}{2}$. To show that $0$ is also attained, take $x = 0.a_{1}a_{2}\cdots,$ where $$ a_{i}=\biggl\{\begin{array}{cc} 1 & \text{if} \ i=2^{k}, \ k=1,2, \cdots, \\\ 0 & \text{otherwise.}\end{array}$$

Then $$f(x) = \lim_{k \to \infty} \frac{k}{2^{k}}=0$$

To obtain $y=\frac{p}{q}$, where $p$ and $q$ are Co-prime positive integers, take $$ x = \underbrace{.00\cdots 0}_{q-p} \: \underbrace{11\cdots 1}_{p} \: \underbrace{00\cdots 0}_{q-p} \cdots,$$ where blocks of $q-p$ zeros alternate with blocks of $p$ ones. Then $f(x) = \lim_{k\to\infty} \frac{kp}{kq}=\frac{p}{q}$. Now our task is to show that every irrational $y \in [0,1]$ is also attained. We know that there is a sequence of rationals $\frac{p_n}{q_n}$, where each pair of $p_n$ and $q_n$ are co-prime converging to an irrational $y$. Let $$x = \underbrace{.00 \cdots 0}_{q_{1}-p_{1}} \: \underbrace{11\cdots 1}_{p_{1}} \: \underbrace{00 \cdots 0}_{q_{2}-p_{2}} \cdots,$$

Then $f(x) = \lim_{n \to \infty} \frac{p_{1} + p_{2} + \cdots + p_{n}}{q_{1} + q_{2} + \cdots + q_{n}} = \lim_{n \to \infty} \frac{p_{n}}{q_{n}} = y$.

Since $\displaystyle\lim_{n \to \infty} q_{n} = +\infty$, the second equality follows from the Stolz theorem.

share|improve this answer
To, the downvoter: why a downvote? –  user9413 Jun 9 '11 at 10:53

Not only such functions exists, but it turns out there are lots of such functions.

There is actually a Theorem, I think by Sierpinski, that any real valued function is the sum of two Darboux functions...

share|improve this answer
Since you mentioned this result here, perhaps you would be able to provide a reference to answer the first part of this question: math.stackexchange.com/questions/100096/… –  Martin Sleziak Apr 1 '12 at 8:14

Any function with a connected dense graph will be an example. See the 4.1 in http://www.apronus.com/math/MRWojcikPhD.htm. This is a general construction of dense connected graphs of functions from any normed vector space to any normed vector space of weight not exceeding the power of the continuum.

That the function y is Darboux follows from the fact that its graph is connected. See for example Kuratowski's Topology textbook Volume II, 46.I.6.

share|improve this answer

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.