A sufficient condition for a function to be of class $C^2$ in the weak sense.

Let $f\colon\mathbb{R}\to\mathbb{R}$ be a continuous function with weak derivative (i.e. the derivative in the sense of distribution) in $C^1(\mathbb{R})$. Does this condition imply that $f$ is two times continuously differentiable (i.e. $f\in C^2(\mathbb{R}))$?

Solutions Collecting From Web of "A sufficient condition for a function to be of class $C^2$ in the weak sense."

The answer is yes.

Lemma Assume that $u \in \mathscr{D}'(X)$, where $X$ is an open interval in $\mathbb{R}$ and that $u' = 0$ (in the sense of distributions). Then $u$ is (can be identified with) a constant.

This result should be in most textbooks on distribution theory. I’ll give a sketch of the proof for $X = \mathbb{R}$.

Step 1: Show that $\phi \in C^\infty_c$ is a derivative of a test function if and only if $$\int_{-\infty}^{\infty} \phi\,dx = 0.$$

Step 2: Choose a fixed $\psi \in C^\infty_c$ with $\int \psi = 1$, and let $C = \langle u, \psi\rangle$.

Step 3: Take an arbitrary $\phi \in C^\infty_c$ and choose $c$ so that $\phi – c\psi$ has integral $0$, i.e. $c = \int \phi$. Then $\phi-c\psi = \chi'$ for some $\chi \in C^\infty_c$.

Put everything together:
$$ 0 = \langle u', \chi \rangle = – \langle u, \chi' \rangle =
-\langle u, \phi \rangle + c\langle u, \psi\rangle
= -\langle u, \phi \rangle + C\int \phi =
-\langle u, \phi \rangle + \langle C, \phi\rangle.

for all $\phi \in C^\infty_c$. This shows that $u$ is in fact a constant $C$.

Returning to the original question. Let $g \in C^1$ be the distributional derivative of $f$ and define
$$ G(x) = \int_0^x g(t)\,dt $$
Then $G \in C^2$, and it’s clear that $G' = g$ (both in classical sense, and in distributional sense). Hence $G' = g = f'$ (in the sense of distributions), so by the lemma, $f = G + C$. In other words, $f$ can be identified with a $C^2$ function.

Let $g\in C^1(\mathbb{R})$ be a weak derivative of $f$. That means that we have
for all $\psi\in C^\infty_c(\mathbb{R})$ (the set of compactly supported $C^\infty$ functions). Since $g$ is continuous, the function
h(t)=\int_0^t g
is well-defined and satisfies $h'(t)=g(t)$ for all $t\in\mathbb{R}$. So

for all $\psi\in C^\infty_c(\mathbb{R})$ ; as this set is invariant under taking derivatives and anti-derivatives, we get
for all such $\psi$. Since $C^\infty_c(\mathbb{R})$ is dense in $L^2(\mathbb{R})$, $f=h$ almost everywhere; but both $f,h$ are continuous, so $f=h$. This shows that $g$ is the actual derivative of $f$, and thus $f$ is twice continuously differentiable.