Reference for "distributional derivative being zero implies being constant"

Ok, you said you knew how to prove it. Others may not. And you may like this better than what you have (it's the second thing I always think of when this comes up, and I like it a lot better than the first thing I think of...)

Say $u$ is a distribution and $u'=0$. By definition $u(\phi')=0$ for any test function $\phi$. Hence $u(\phi)=0$ for any test function $\phi$ with $\int\phi=0$.

Fix $\psi_0$ with $\int\psi_0=1$, and let $c=u(\psi_0)$. Now for an arbitrary test function $\phi$, let $\alpha=\int\phi$. Then $u(\alpha\psi_0-\phi)=0$, which says $$u(\phi)=c\int\phi.$$Which is exactly what "$u=c$" means.


Detail: We used the following fact above: Given a test function $\phi$ on $\Bbb R$, there exists a test function $\psi$ with $\phi=\psi'$ if and only if $\int\phi=0$. In case this is not clear: First, if $\phi=\psi'$ then $\int\phi=\int\psi'=0$ because $\psi$ has compact support. Suppose on the other hand that $\int\phi=0$, and define $\psi(x)=\int_{-\infty}^x\phi$. Then $\psi'=\phi$ and hence $\psi$ is infinitely differentiable, while the fact that $\int\phi=0$ shows that $\psi$ has compact support.


I may be aware that this is very bad timing, but I wanted to point out the fact that there is an easy proof also in $\mathbb{R}^N$. Source: lecture notes by Professor P. D'Ancona (in Italian). https://www1.mat.uniroma1.it/people/dancona/IstAnSup/dispense-esercizi/4-Distribuzioni-20191024.pdf

Proposition. Let $T \in \mathscr{D}^{\prime}\left(\mathbb{R}^{N}\right)$ such that $\nabla T=0 .$ Then there exists a constant $c$ such that $T=T_{c}$, where for $f\in L^1_{loc}$ I denote $T_f$ the distribution represented by $f$.

Proof. Let's define $f_{\varepsilon}:=\rho_{\varepsilon} * T$, the standard regularization of $T$. Then $$ \nabla f_{\varepsilon}=\nabla\left(\rho_{\varepsilon} * T\right)=\rho_{\varepsilon} *(\nabla T)=0, $$ thus $f_{\varepsilon}$ is a constant function $f_{\varepsilon}=c_{\varepsilon} .$ On the other hand, $T_{f_{\varepsilon}}=T_{c_{\varepsilon}}$ converge to $T$ in $\mathscr{D}^{\prime}(\Omega)$, hence the sequence of numbers $\left\{c_{\varepsilon}\right\}$ must be convergent, so there exists $c \in \mathbb{R}$ such that $T_{c_{\varepsilon}} \rightarrow T_{c}$.