# When is the graph of a function a dense set?

Let $f: \mathbb R \to \mathbb R$ be any function. When is the graph of $f$ dense in $\mathbb R^2$?
The only examples I know for this are for non-measurable functions, but is that a necessary condition?

• of course not, e.g. the graph of a function which is non-zero on the rationals may have a dense graph. – Pietro Majer Sep 28 '12 at 11:24
• See also mathoverflow.net/a/90201/75082 lol – ParaH2 Aug 20 '15 at 23:59

The Conway base 13 function is probably a standard example: the graph is dense because any restriction of the function to an open interval is surjective. But meanwhile, since the graph of the base 13 function is easily defined by an arithmetic property of the digits, the function is Borel and hence measurable. More information is available at Is Conway's base-13 function measurable?

For each $q\in\mathbb Q$ choose a sequence $x_{q,n}\to q$ $(n\to\infty)$ such that all $x_{q,n}$ are pairwise distinct. For $\mathbb Q=\lbrace r_n:n\in\mathbb N\rbrace$ define $f(x_{q,n})=r_n$ and $f(x)=0$ for $x\notin \lbrace x_{q,n}: q\in\mathbb Q, n\in\mathbb N\rbrace.$ Then $f$ is measurable and its graph is dense.

Another example is any of the denegenerate solutions of the Cauchy functional equation (Wikipedia: Cauchy's functional equation - Properties of other solutions), which has also the property of being measurable; unfortunately, I don't know when this condition is achieved, due to the not-so-easy construction of the function: maybe using the linearity one can show something, I don't know...

However this class of function suggests a solution to your problem, for example $f(a+ \sqrt{2} b ) = a - \sqrt{2} b$ whenever $a,b \in \mathbb{Q}$ and $f \equiv 0$ out of $\mathbb{Q} ( \sqrt{2} )$. In this way you have a measurable function (because it is $0$ out of a countable set) and it has the property of the dense graph.