# Examples of nowhere continuous functions

Do you know examples of nowhere continuous functions, besides the Dirichlet function and its modifications?

• I think one could claim that almost all functions are nowhere continuous, but am not sure how to define the appropriate measure and verify it. It is certainly true that most functions are not definable at all. There are only countably many definitions and there are $2^{\mathfrak c}$ functions – Ross Millikan Dec 21 '13 at 0:27
• Examples 2 and 3 in my answer to your other question. – Andrés E. Caicedo Dec 21 '13 at 4:33

The examples given so far seem to be rather "tamely" discontinuous, in that their graphs are included in the union of the graphs of two continuous functions. A somewhat more dramatic example would be a function $f:\mathbb R\to\mathbb R$ whose graph is dense in the plane $\mathbb R^2$. To produce such an $f$, notice first that the set of all rectangles $(a,b)\times (c,d)$ with $a,b,c,d\in\mathbb Q$ is a countable set, so enumerate it as $\{A_n:n\in\mathbb N\}$. Then choose, by induction on $n$, points $(x_n,y_n)\in A_n$ in such a way that each $x_n$ is different from all previously chosen $x_j$'s ($j<n)$. Then define $f(x)$ to be $y_n$ if $x=x_n$, and define $f(x)$ to be $0$ if $x\notin\{x_n:n\in\mathbb N\}$. The graph of $f$ contains all the pairs $(x_n,y_n)$, hence meets every $A_n$, and hence is dense in $\mathbb R^2$.
(Despite the apparent wildness of $f$, the construction doesn't need the axiom of choice. Fix an enumeration of the rationals and then, at each step, take $x_n$ and $y_n$ to be the first, in the enumeration, rational values that satisfy the required conditions.)
• Andres Caicedo's comment links to a mention of Conway's base-$13$ function, which is an explicit example of this kind of function. – A l'Maeaux Dec 22 '13 at 16:55
One of my favorites is on $(0,1) \to (0,1)$ but you can extend it to $\Bbb {R \to R}$ with your favorite bijection. For $x \in (0,1)$, write it in ternary, using the terminating version if there is a choice. If there are an infinite number of $2$'s in the expansion, or the tail is all $0$'s or all $1$'s, set $f(x)=x$ If the last $2$ in the expansion is in the $3^{-m}$ place, multiply by $3^m$ and take the fractional part (erase everything through the last $2$). Now read it as a binary expansion. This function takes all values in every interval, so (if extended to $\Bbb {R \to R}$ with a bijection) is dense in the plane. The point is that on any interval $(a,b)$ you can find an interval of the form $(\frac {3k+2}{3^m},\frac {3k+3}{3^m})$ and you get all the binary expansions in $(0,1)$ within that interval.