TITLE: Making a vector field divergence-free
QUESTION [5 upvotes]: I have a feeling that this is not true, but I'm not sure how to construct a counter-example. 
Given a non-vanishing smooth vector field $X$ on $\mathbb{R}^n$, is there a positive smooth function $f$ such that the re-scaled vector field $fX$ is divergence-free?
This involves solving the following PDE for $f$, with coefficients depending on $X$ and its first derivatives:
$$df(X) + f\text{div}(X) = 0.$$

REPLY [3 votes]: Here's a recipe for a counterexample in at three dimensions. We can start with a general one which is not nonvanishing:
Let $U(x)=x^ie_i$, where $e_i$ are the standard tangent frame in $\mathbb{R}^n$. Integrating around a ball $B(0,r)$ centered at the origin of radius $r$, we can apply the divergence theorem:
$$
\int_{B(0,r)}\text{div}(fU)dV=\int_{\partial B(0,r)}fU\cdot n\ ds=r\int_{\partial B(0,r)}f\ ds>0
$$
The same type of argument applies to any vector field $V$ for which there exists a closed hypersurface $S$ with normal $n$ such that $V\cdot n\neq 0$ in all of $S$.
In the above example, it's not possible to remove the zero in the interior of the sphere. However, the same general approach is useful in a more complicated case for $\mathbb{R}^3$:
Let $T$ be a torus in $\mathbb{R}^3$ about the $z$-axis with a circle $C$ in its interior on the $xy$-plane. One can construct a rotationally symmetric vector field $U$ which points radially outward on all of $T$, and has zeros only on $C$ and on the $z$-axis. Using bump functions, both of these zeros can be removed with localized fields.
This approach won't work in $\mathbb{R}^2$, but it generalize pretty straightforwardly to higher dimensions It's not at all clear to me what vector fields do satisfy the condition, though it seems to be a very restricted set.