Let us define a piecewise dense function as follows.

A function $f$ is piecewise dense if and only if there is a finite number of dense mutually exclusive sets $S_1, S_2, S_3, \cdots S_n$ such that for all $S_i$ we have that for all $x \in S_i$ that $f(x) = g_i(x)$ where $g_i$ is a continuous function for all real numbers $x$.

Now consider the example $f$ where $f(x) = x$ when $x$ is rational and $f(x) = -x$ when $x$ is irrational. This function is piecewise dense. It's graph also looks like the following:

enter image description here

The red line is the portion defined for the rationals and the green is the portion defined for the irrationals. Furthermore this function is not differentiable or integrable anywhere. The function is continuous at $x = 0$ and only at that point. The proof of this specific example is not relevant here.

What I've observed is that when we have a piecewise dense function with $n$ sets then the functions graph appears to more resemble a set of curves in the Euclidean plane with each curve being the graph of $g_i$ where $g_i$ is the function associated with the ith set in some piecewise dense function.

To go a step even further I believe that the derivative, integral, and limit respond similarly. The limit only exists in places where the collection of planar curves intersect above any given $x$. The derivative only exists if they intersect and the derivatives of each curve coincide assuming the curves are even differentiable which they need not be. The integral only exists if the curves coincide for an interval.

What I'm looking for is either a formal proof or disproof of this notion I've presented here. That the derivative, integral, and limit do treat piecewise dense functions as if they are collections of curves according to the rules given in the previous paragraph.


closed as unclear what you're asking by KReiser, Eevee Trainer, Brian Borchers, Lord Shark the Unknown, user91500 Dec 30 '18 at 6:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I apologize for not posting a formal version of the statement I'm asking to prove as I usually prefer to do for completeness. It is late and I kept attempting to write the statement only to find I'd butcher the logic. I will try editing something in tomorrow. The written version is consistent with what I am intending. $\endgroup$ – The Great Duck Dec 29 '18 at 7:21
  • 1
    $\begingroup$ Your definition of piecewise dense function is not clear. What does $g$ denote in your definition? $\endgroup$ – Test123 Dec 29 '18 at 7:28
  • $\begingroup$ @Test123 derp. I forgot to write the rest in. $\endgroup$ – The Great Duck Dec 29 '18 at 7:29
  • $\begingroup$ @Test123 all better now (I think) $\endgroup$ – The Great Duck Dec 29 '18 at 7:29
  • 1
    $\begingroup$ Still not clear. Are you saying the restriction of $f$ to each $S_i$ is continuous on $S_i?$ $\endgroup$ – zhw. Dec 29 '18 at 21:15

Yes, assuming a natural interpretation of what you describe (and Riemann integrability as opposed to Lebesgue integrability), it works pretty much as described.


  • We have a finite collection of sets $S_1,S_2,\ldots,S_n$ such that each is dense in $\Bbb{R}$ (standard topology), their union is all of $\Bbb{R}$, and $S_i\cap S_j=\emptyset$ whenever $i\neq j$. In other words, the sets $S_i,i=1,2,\ldots,n$, form a partition of $\Bbb{R}$ of dense subsets.
  • We have a collection of everywhere continuous functions $g_1,g_2,\ldots,g_n:\Bbb{R}\to\Bbb{R}$.
  • We define the function $f:\Bbb{R}\to\Bbb{R}$ by declaring that on the set $S_i$ it agrees with $g_i$. Because we have a partition, $f$ is well-defined.

Continuity: The function $f$ is continuous at a point $x_0\in S_i$ if and only if $g_j(x_0)=g_i(x_0)$ for all $j\neq i$ (IOW, all the functions $g_j$ agree at $x_0$).

Proof: Assume first that the functions $g_i$ agree at $x_0$. Fix an $\varepsilon>0$. Because $g_j$ is continuous at $x_0$, to each index $j=1,2,\ldots,n$, there exists a $\delta_j>0$ such that $|g_j(x)-g_j(x_0)|<\varepsilon$ whenever $|x-x_0|<\delta_j$. Let $\delta=\min\{\delta_1,\delta_2,\ldots,\delta_n\}$. Observe that because there are only finitely many sets $S_j$, there are only finitely many $\delta_j$s here, and therefore $\delta>0$ (if we had infinitely many sets in the partition, then the argument would fail at this point). Let $x$ be an arbitrary number such that $|x-x_0|<\delta$. Then $x\in S_j$ for some $j$. Therefore $|g_j(x)-g_j(x_0)|<\varepsilon$. But, here $f(x)=g_j(x)$ and $f(x_0)=g_i(x_0)=g_j(x_0)$. It follows that $|f(x)-f(x_0)|<\varepsilon$. Continuity at $x_0$ follows.

Conversely, assume that $f$ is continuous at $x_0$. Let $j\in\{1,2,\ldots,n\}$ be arbtrary. The density of $S_j$ implies that there exists a sequence $(x_k), k=1,2,\ldots,$ such that $x_k\in S_j$ for all $k$, and that $\lim_{k\to\infty}x_k=x_0$. For all $k$ we have $f(x_k)=g_j(x_k)$, so, by continuity of the functions $f$ and $g_j$ at the limit point $x_0$, we have $$f(x_0)=\lim_{k\to\infty}f(x_k)=\lim_{k\to\infty}g_j(x_k)=g_j(x_0).$$ QED.

Differentiability: Assume further that all the functions $g_i,i=1,2,\ldots,n$ are differentiable. Then the function $f$ is differentiable at $x_0\in S_i$ if and only if $g_j(x_0)=g_i(x_0)$ and $g_j'(x_0)=g_i'(x_0)$ for all $j$.

Proof: Very similar to the continuity proof. Only this time we study the limits of the functions $$ \frac{f(x)-f(x_0)}{x-x_0}\quad\text{and}\quad \frac{g_j(x)-g_j(x_0)}{x-x_0}. $$ If the latter collection of functions share the same limit, it follows (because $g_j(x_0)=f(x_0)$ for all $j$) that the former function also shares that limit. Conversely, all the functions in the latter collection have the limit $g_j'(x_0)$ along some sequence of numbers $\in S_j$, when along that same sequence the former function agrees, and thus those limits must agree. Skipping the details.

Integrability: The function $f$ is Riemann integrable over the interval $I=[a,b]$ if and only if the functions $g_i$ all agree on all the points of $I$.

Proof: Sufficiency of the condition $g_i(x)=f(x)$ for all $x\in I$ and all $i$ is obvious. In that case $f$ is continuous on $I$ by our earlier observation, and this is sufficient for integrability.

Necessity is a bit trickier. Assume that there exists a point $x_0\in I$ and two indices, $i$ and $j$, such that $g_i(x_0)\neq g_j(x_0)$. Without loss of generality we can assume that $g_i(x_0)>g_j(x_0)$. Let $A=(g_i(x_0)+g_j(x_0))/2$ be the average, and let $\varepsilon=(g_i(x_0)-g_j(x_0))/4$ be one quarter of the difference. By continuity of the functions $g_i$ and $g_j$ there exists $\delta>0$ such that $g_i(x)>A+\varepsilon$ and $g_j(x)<A-\varepsilon$ whenever $|x-x_0|<\delta$. Let us concentrate on the smaller interval $I'=[x_0-\delta,x_0+\delta]$ (make the obvious modifications in what follows, if $x_0$ is one of the endpoints of $I$). Because both $S_i$ and $S_j$ are dense in $I'$, on every subinterval of $I'$ the supremum of $f$ is $>A+\varepsilon$ and the infimum is $<A-\varepsilon$. This implies that the difference between (Darboux) upper and lower sums over $I'$ will be at least $4\varepsilon\delta$. In other words, bounded away from zero. Therefore $f$ won't be Riemann integrable over $I'$, and hence not over $I$ either. QED.

  • 1
    $\begingroup$ Of course, $f$ can be Lebesgue integrable. After all, the infamous function with value $1$ at rational points and value $0$ at irrational points is Lebesgue integrable. $\endgroup$ – Jyrki Lahtonen Dec 29 '18 at 9:23
  • $\begingroup$ That is an interesting note in the comments. I was not aware that that was Lebesgue integrable. I have only seen Lebesgue briefly. That's very interesting. $\endgroup$ – The Great Duck Dec 29 '18 at 18:12

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