It is well known that there exists a constant $C$ such that $$\forall f\in C^\infty_c(\mathbb R^3), \quad \Vert f\Vert_{L^6(\mathbb R^3)}\le C\Vert \nabla f\Vert_{L^2(\mathbb R^3)}. \tag{$\ast$}$$ Now let us assume that $f$ is locally integrable on $\mathbb R^3$ (or more generally that $f$ is a distribution on $\mathbb R^3$) and that $\nabla f\in L^2(\mathbb R^3)$. Does that imply that $$ f=f_0+\alpha, \quad\text{where $\alpha$ is a constant and $f_0$ belongs to $L^6(\mathbb R^3)$?} \tag{$\ast\ast$}$$
2 Answers
Yes. For each $R>0$ consider $f_R \in H_0^{1}(B_R)$ as the solution of $$ \Delta f_R= \Delta f\qquad \text{in $B_R$} $$ Existence follows from Lax-Milgram (or any other variational method) since $$ \Delta f=\mathrm{div} \nabla f \in H^{-1}. $$ By testing the equation with $f_R$ and integrating by parts one gets $$ \frac{1}{C}\|f_R\|_{L^6}^2\le \|\nabla f_R\|^2_{L^2}=\int \nabla f_R \cdot \nabla f \le \|\nabla f_R\|_{L^2}\|\nabla f\|_{L^2}. $$ Hence $f_R $ are equi-bounded in $L^6$ and their gradients in $L^2$. By taking a sub sequential limit one ends up with a function $g\in L^6$, such that $\nabla g \in L^2$ and $$ \Delta g= \Delta f \quad \text{in $\mathbb R^3$.} $$ In particular $g-f$ is an harmonic function with gradient in $L^2$ and thus, by Liouville theorem, it is constant.
This is a special case of embeddings for homogenuous Sobolev spaces and holds if $u \in L^1_{loc}$ with $\nabla u \in L^p$, $1 \leq p<n$ and the usual $p^*$. A proof of this (and much more) is in the book by P. Galdi "An introduction to the mathematical theory of Navier Stokes equations", Theorem II.6.1.
Basically the proof follows the pattern below (for smooth $u$).
If $u$ is radial, then $u' \in L^1(0, \infty)$ (by H"older) and this gives $u(0)=\lim_{r \to \infty}u(r)$ and also a pointwise estimate of $u_0-u(r)$.
For $u$ radial, applying Sobolev to $\eta(x/k) (u-u_0)$ gives the result, using the decay of $u-u_0$ of 1).
For general $u$, let $v(r)=\frac{1}{|S^{n-1}|}\int_{S^{n-1}}u(r\omega)\, d\omega$. One checks that $\nabla v \in L^p$ and since $u-v$ has mean zero on $S^{n-1}$ for every $r$, Hardy inequality holds (and this is a crucial point) $$\left \|\frac{u-v}{|x|}\right \|_p \leq C\|\nabla (u-v)\|_p.$$
Now the same procedure as in b) holds for $u-v:=w$. One writes Sobolev inequality for $\eta(x/k)w$ and let $k \to \infty$.