Representation of smooth function Is it true that any smooth function $f\colon \mathbb{R}^n \to \mathbb{R}^n$ can be represented as
$$
   f(x) = \nabla U(x) + g(x)
$$
where $U(x)$ is a scalar function and $\langle g(x), f(x) \rangle \equiv 0$? Is this representation unique?
 A: Let me summarize my comments as an answer to you original question. Given a smooth map $f$, consider a problem of existence of a pair $(U,g)$ such that $U$ is a smooth scalar function and $g$ is a smooth map and such that
$$
  f = \nabla U+g, \tag{1}
$$
$$
f\cdot g = 0. \tag{2}
$$
Multiplying both sides in $(1)$ by $f$, we obtain
$$
  \|f\|^2 - f\cdot \nabla U = f\cdot g = 0.
$$
Hence, problem $(1)+(2)$ can be reduced to the problem of existence of $U$ such that
$$
f\cdot \nabla U = \|f\|^2 \tag{3}
$$
and if the solution of the latter 1st order linear PDE exists, then $g = f - \nabla U$ is the function needed in $(1),(2)$. Unfortunately, I cannot say anything about the existence of solution of this PDE in the general case (i.e. when $f$ is smooth).
Uniqueness does not hold: take $f = 0$, then we are looking for $(U,g)$ such that
$$
  g = - \nabla U.
$$
Clearly, any $U$ smooth solves the problem.
A: This is not true as Ilya said in his comment, however if we modify the statement:

Smooth vector field with compact support $f: \mathbb{R}^n \to \mathbb{R}^n$ can be represented as
  $f = \nabla U + g$, where $\langle g, \nabla U \rangle = 0$.

And this is Helmholtz decomposition for smooth vector fields in $\mathbb{R}^n$, we can set up a variational problem as follows: Find $U\in H^1_c(\mathbb{R}^n)$, such that
$$
\langle \nabla U, \nabla v \rangle = \langle f, \nabla v \rangle = 
-\langle \mathrm{div}f, v \rangle
\quad \text{ for any } v\in H^1_c(\mathbb{R}^n)
$$
This is an elliptic problem with a unique solution $U$, letting $g = f- \nabla U$ will give what you want, and $g$ is orthogonal to $\nabla U$, then the decomposition is unique, you won't have a problem like Ilya mentioned in the first comment, set $f=0$ would get you $g = -\nabla U$, and the orthogonality implies $\nabla U = 0$ and $U$ is a constant, by compact supportedness, $U=0$.
