# Existence of an antiderivative function on an arbitrary subset of $\mathbb{R}$

Let $f:\mathbb{R}\to \mathbb{R}$ be continuous at $x$ for every $x\in I$ where $I\subset \mathbb R$ could be arbitrary. Does there always exist a function $F:\mathbb{R}\to \mathbb{R}$ differentiable on $I$ and $F'(x) = f(x)$ for every $x \in I$?

The definition of a primitive is naturally defined on an interval. A mathematical curiosity is to understand the difficulties that can be encountered when trying to define this notion on any part of $\mathbb{R}$.

A first difficulty is to try to find a good definition of the notion of a primitive on any part of $\mathbb{R}$. That was the purpose of this thread "Correct definition of antiderivative function."

If we ask $F$ to be differentiable on an open set $J$ containing $I$, the thread "Existence of an antiderivative for a continuous function on an arbitrary subset of $\mathbb{R}$" gives a counterexample to the question.

If $I$ is an interval, the answer to the question is positive. If $I$ is an open set, the answer to the question is also positive. (see comment)

• I suspect what you meant was "Let $f:\mathbb{R}\to \mathbb{R}$ be continuous at everu point of a set $I\subset \mathbb{R}$." Saying that $f:\Bbb R\to\Bbb R$ is "a continuous function on $I$" is at best problematic, because "function on $I$" sounds like the domain is $I$. Also note that saying "continuous at every point of $I$" is stronger than saying "$f|_I$ is continuous", which is how one might interpret "continuous on $I$". – David C. Ullrich Jul 18 '18 at 14:28
• An example to illustrate the sort of problem I have with the way you phrased it, in case it's not clear: Say $f(t)=1$ for rational $t$, $f(t)=0$ for irrational $t$. Is it correct to say "$f$ is continuous on $\Bbb Q$"? Probably no, since $f$ is continuous nowhere. But one might say yes, since $f|_{\Bbb Q}$ is continuous... – David C. Ullrich Jul 18 '18 at 14:45
• Perhaps the first sentence should be "Let $f:\mathbb{R}\to \mathbb{R},$ let $I\subset \mathbb R,$ and assume $f$ is continuous at each point of $I.$ – zhw. Jul 18 '18 at 15:09
• @David C. Ullrich Yes I edited my question – cerise Jul 18 '18 at 15:15
• @Tina I see that you have put a lot of effort into improving this question. Thank you. This is a nice question now. – Xander Henderson Jul 23 '18 at 21:37

Please do not upvote this answer! It's just a detailed version of an answer that appeared on MO; if you feel the need to upvote something please upvote that answer instead. $\newcommand\ui{\overline{\int_{#1}^{#2}}}$

The obvious thing to try is $$F(x)=\int_0^x f(t)\,dt.$$Except "trying" that is stupid, since it's clear the integral need not exist. I thought about replacing $f$ by some nicer function $g$ such that $g(x)=f(x)$ if $f$ is continuous at $x$, as in a comment to the question on MO; couldn't make that work. The lightbulb Pietor Majer had is this: Use the upper Darboux integral, which we will denote $$\ui ab f(x)\,dx.$$

The beauty of this is that if $f:[a,b]\to\Bbb R$ is any function whatever then $\ui ab f$ exists, at least as an element of $[-\infty,\infty]$, and if $f$ is any bounded function then $\ui ab f\in\Bbb R$.

Of course the upper Darboux integral probably doesn't really deserve to be called an integral, since it's not linear. But it does retain a shred of linearity:

Lemma. If $a<b<c$ and $f:[a,c]\to\Bbb R$ is bounded then $\ui acf=\ui ab f+\ui bc f$.

Proof: Exercise. Easy or not, depending on who you are. If you get stuck you should be able to extract a proof from a proof that $\int_a^c=\int_a^b+\int_b^c$ for the Riemann integral. Note that of course you need to find a proof in a context where the author defined the RIemann integral in terms of "upper and lower (Darboux) sums" instead of using Riemann sums. I suspect the proof in baby Rudin will qualify, not sure since I don't have a copy.

It follows that the upper Darboux integral satisfies a version of FTC sufficient for our purposes:

Lemma (UDI-FTC). Suppose $f:(a.b)\to\Bbb R$ is bounded and $p\in(a,b)$. Define $F:(a,b)\to\Bbb R$ by $F(x)=\ui pxf(t)\,dt$ (with the convention that $\ui\beta\alpha=-\ui\alpha\beta$). If $f$ is continuous at $x\in(a,b)$ then $F$ is differentiable at $x$ and $F'(x)=f(x)$.

Proof: Hint: The previous lemma shows that $$\frac{F(x+h)-F(x)}{h} =\frac1h\ui x{x+h}f(t)\,dt;$$if $h$ is small then $f(t)$ is close to $f(x)$ on $[x,x+h]$ (or $[x+h,x]$, whichever makes sense).

If that's not enough note that $F'(x)=f(x)$ is explained in somewhat more detail in the answer on MO.

Of course it's not clear how that helps, since $f$ is not bounded. But it's clear that $f$ is "locally bounded" on a neighborhood of $I$, and that that's enough. (This is the part where I'm adding details to the answer on MO, if anyone was wondering; at least one other person and I were both initially confused about this.)

Definition If $f:\Bbb R\to\Bbb R$ and $S\subset \Bbb R$ then $f$ is locally bounded on $S$ if for every $x\in S$ there exists $\delta>0$ such that $f$ is bounded on $(x-\delta,x+\delta)$.

Triviality If $f$ is locally bounded on $S$ and $K\subset S$ is compact then $f$ is bounded on $K$.

Corollary (UDI-FTC v2) The UDI-FTC above holds if we assume just that $f$ is locally bounded on $(a,b)$.

Proof: Given $x\in(a,b)$, choose $c,d$ with $a<c<d<b$ and $x,p\in(c,d)$. Since $f$ is bounded on $[c,d]$ the definition of $F(s)$ makes sense for $s\in(c,d)$, and the proof of the original UDI-FTC shows that $F'(x)=f(x)$.

Theorem. Suppose that $f:\Bbb R\to\Bbb R$, $I\subset \Bbb R$, and $f$ is continuous at $x$ for every $x\in I$. There exists $F:\Bbb R\to\Bbb R$ such that $F$ is differentiable at $x$ and $F'(x)=f(x)$ for every $x\in I$.

Proof. If $x\in I$ there exists an open interval $I_x$ such that $x\in I_x$ and $f$ is bounded on $I_x$. Let $$V=\bigcup_{x\in I}I_x.$$So $V$ is open, $I\subset V$, and $f$ is locally bounded on $V$.

Say $V=\bigcup_kJ_k$, where the $J_k$ are the connected components of $V$. UID-FTC v2 above shows that for each $k$ there exists $F_k:J_k\to\Bbb R$ such that $$F_k'(x)=f(x)\quad(x\in I\cap J_k).$$Define $F:\Bbb R\to\Bbb R$ by $$F(x)=\begin{cases}F_k(x),&(x\in J_k), \\0,&(x\notin V).\end{cases}$$

• I do not see clearly why with your F, we have $F '(x) = f (x)\, \forall x\in I$. I see clearly $\forall k\in \mathbb{N}, \forall x\in J_k,\ F(x)=F_k(x)$ and since the $J_k$ are open intervals we deduce that $\forall k\in \mathbb{N},\, \forall x\in J_k,\ F'(x)=F'_k(x)=f(x)$. Now note that $I\subset V=\bigcup_kJ_k$, thus $\forall x\in I\,\, \exists k\in \mathbb{N}$ such that $x\in J_k$ and $F(x)=F_k(x)$ but $I$ is not an interval "If $F(x)=F_k(x)$ holds only at isolated points, then nothing can be said about the , derivatives" – cerise Jul 22 '18 at 0:27
• @Tina I don't follow your question too well, because some of it is answered by things you say. Anyway, suppose $x\in I$. There exists $k$ so $x\in J_k$. Now $J_k$ is open and $F(t)=F_k(t)$ for all $t\in J_k$, so $F'(x)=F_k'(x)=f(x)$. – David C. Ullrich Jul 22 '18 at 0:35
• @Tina $F=F_k$ does not hold only at isolated points, it holds on all of $J_k$. $I$ is not an interval but $J_k$ is an interval. – David C. Ullrich Jul 22 '18 at 0:37
• Show me clearly that $F '(x) = f (x)\, \forall x\in I$ in case $I=\mathbb{N}$ – cerise Jul 22 '18 at 0:42
• @Tina Whether $I=\Bbb N$ or not does not affect the argument. This part wasn't spelled out explcitly in the answer because it's obvious. Tell me what part you don't follow: (i) Suppose $x\in I$. (ii) There exists $k$ so $x\in J_k$. (iii) $F=F_k$ everywhere on $J_k$. (iv) $J_k$ is open. (v) Hence $F'(x)=F_k'(x)=f(x)$. You ask me to show you this clearly, but you don't say what was unclear about my previous comment. – David C. Ullrich Jul 22 '18 at 1:27

A few comments: If the answer is yes I have no idea how to prove it.

Edit: Maybe it's not hopeless. Given $f:\Bbb R\to\Bbb R$ the set of $x$ such that $f$ is continuous at $x$ is a $G_\delta$. So we can assume that $I$ is a $G_\delta$. It's certainly true if $I$ is open, so perhaps...

Of course the answer would be no if you asked for $F$ to be differentiable on $\Bbb R$, for example $I=(-\infty,0)\cup(0,\infty)$, $f(t)=-1$ for $t<0$, $f(t)=1$ for $t>0$.

Otoh if the answer is no a counterexample can't be very simple. Because the answer is yes if $I$ is closed (in that case there exists $g\in C(\Bbb R)$ which agrees with $f$ on $I$), and the answer is yes if $f$ is locally Lebesgue integrable, in which case the indefinite integral works.

• What if $f$ is locally in $L^1$ and $m(I) = 0?$ – zhw. Jul 18 '18 at 15:38
• @zhw. I don't see what $m(I)$ has to do with it. If $f$ is locally integrable we can define $F(x)=\int_0^x f(t)\,dt$, and it follows that $F'=f$ at every point where $f$ is continuous, in particular at every point of $I$. – David C. Ullrich Jul 18 '18 at 15:41
• It works also if f is Riemann integrable (example f strictly monotone) – cerise Jul 18 '18 at 15:47
• @Tina Well of course. That's actually included in what I said - if $f$ is Riemannn integrable then it's locally Lebesgue integrable... – David C. Ullrich Jul 18 '18 at 15:57
• If we ask that F be differentiable on an open, zhw has already given a counter example – cerise Jul 18 '18 at 16:07