# 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. what sort of weaker result can we obtain under weaker hypotheses?.

• If I is an interval or an open set, the answer to the question is positive.

• If f is locally Lebesgue integrable,the answer to the question is
also positive.

• It's also yes if $I$ is closed, because then there exists a continuous $g:\Bbb R\to\Bbb R$ with $g|_I=f|_I$. Jul 20, 2018 at 16:30
• Do you mean differentiable on I = for a given open interval U covering I, f is differentiable on $I \cap U$ and possibly more points? Because otherwise, a lot of the exotic sets you can think of have no differentiable structure. Jul 20, 2018 at 18:51
• My first guess would be to: (1) replace $f$ by $g(x) = \liminf_{y \to x} f(y)$; we have $f = g$ on $I$, and $g$ is lower semi-continuous, and therefore measurable; (2) note that there is an open set $U$ containing $I$ such that $g$ is locally bounded on $U$; (3) define $F$ to be the indefinite Lebesgue integral of $g$ on $U$, and whatever function in the complement of $U$. Jul 20, 2018 at 21:06
• @Mateusz Kwaśnicki Upper or lower semicontinuity is not a sufficient condition for a function to be locally bounded. Let $f(x) = \ln |x|$, if $x \neq 0$, and 0, if $x = 0.$ Then f is upper semicontinuous, but it is not locally bounded at 0
– Jane
Jul 20, 2018 at 23:33
• @Tina: Done. (Riemann/Darboux integral is far more elementary than the Lebesgue one, though). Jul 21, 2018 at 12:21

Let's start with the case of a locally bounded function $f:J\to\mathbb{R}$ (say defined on some nonempty open interval $J\subset\mathbb{R}$, with a fixed $x_0\in J$). We may consider for any $x\in J$ the upper Darboux integral of $f$ from $x_0\in J$ to $x$: $$F(x):=\overline {\int^x_{x_0}}f(t)dt$$ (with the usual convention that $\overline {\int_b^a}f:=-\overline {\int_a^b}f$ for $a\le b$). The upper integral is not linear wrto functions, but it is additive on intervals: $\overline {\int_a^b}f=\overline {\int_a^c}f+\overline {\int_c^b}f$ for $a,b,c\in\mathbb{R}$. Also, recall that for $a\le b$ $$(b-a)\inf_{a\le t\le b}f(t)\le\underline {\int_a^b}fdt\le\overline {\int_a^b}fdt\le (b-a)\sup_{a\le t\le b}f(t).$$ As a consequence, the fundamental theorem of calculus still holds true for $F$ at any point $x$ of continuity of $f$:

$$F(x+h)=F(x)+ f(x)h+o(h),\qquad h\to0$$

so $F:J\to\mathbb{R}$ fulfills the requirement in the case of locally bounded $f$.

For a general $f:\mathbb{R}\to\mathbb{R}$, I would suggest the following argument to reduce to the preceding case. Since $f$ is locally bounded at any point of continuity, the set of continuity points is covered by a collection of disjoint open intervals $J_k$ such that $f_{|J_k}:J_k\to\mathbb{R}$ is locally bounded. By the preceding argument we have a collection of $F_k:J_k\to\mathbb{R}$ that we can glue to a single $F:\mathbb{R}\to\mathbb{R}$ such that $F'(x)=F_k'(x)=f(x)$ at any continuity point $x\in J_k$ of $f$, and e.g. $F(x)=0$ for $x\in\mathbb{R}\setminus\cup_k J_k$.

• I guess you can handle non-measurable functions here? Otherwise, the OP already pointed out the more general fact that $f\in L^1_{loc}$ is sufficient (which is obvious, by defining $F(x)=\int_0^x f(t)\, dt$). Jul 21, 2018 at 1:08
• They are the connected components of the open set N on which f is locally bounded; N is a nbd of the set cont(f) Jul 21, 2018 at 1:40
• Ok, thanks. I guess I was concerned about $f$ not being bounded on such a component, but that doesn't seem to be a problem in your argument. Jul 21, 2018 at 1:49
• I feel like I'd like to "publish" a majorly detailed version of this on MSE for the benefit of the kids over there. With attribution, of course. That would be ok with you? Heh, for the sake of appearances I'd include a request that any upvotes be sent here... Jul 21, 2018 at 2:46
• @ChristianRemling That bothered me too. If we say $f$ is locally bounded on $S$ if for every $x$ there exists $\delta$ with $f$ bounded on $(x-\delta,x+delta)$ then it's clear that if $f$ is locally bounded on $S_\alpha$ (open) for every $\alpha$ then $f$ is locally bounded on $\cup_\alpha S_\alpha$. So $f$ is locally bounded on those components. And locally bounded implies bounded on compact sets, which is enough for the rest of the argument Jul 21, 2018 at 2:50

First of all, we replace $f$ by its lower semi-continuous envelope: $$g(x) = \liminf_{y \to x} f(x) .$$ Observe that $g(x) = f(x)$ for $x \in I$ and $g$ is continuous at every $x \in I$. Furthermore, $g$ is lower semi-continuous, and hence Borel measurable.
If $g$ is continuous at $x$, then there is a neighbourhood $U_x$ of $x$ such that $g$ is bounded in $U_x$. Let $U$ be the union of $U_x$ over all $x \in I$.
Consider a connected component $(a, b)$ of $U$. Then $g$ is locally bounded on $(a, b)$ (for any compact subinterval of $(a, b)$ can be covered by finitely many sets $U_x$ with $x \in I$), and thus we can define $$F(x) = \int_{(a+b)/2}^x g(y) dy$$ for $x \in (a, b)$. Clearly, $F$ is differentiable at every point of continuity $x \in (a, b)$ of $g$, and $F'(x) = g(x)$. In particular, $F'(x) = g(x) = f(x)$ for all $x \in I \cap (a, b)$.
We define $F$ as above on every connected component $(a, b)$ of $U$, and we set $F(x) = 0$ for $x \notin U$. By construction, $F'(x) = f(x)$ for every $x \in I \cap U = I$, as desired.