Scalar potential and vector potential Let $D$ be a simply connected open subset of $\mathbb{R}^3$. It is well-known that
if ${\bf v}(x,y,z)=[P(x,y,z), Q(x,y,z), R(x,y,z)]$ is a $C^1$ function on $D$ such that
$$\mbox{curl }\bf{v}=\bf{0}$$
then there exists $C^2$ function $f(x,y,z)$ on $D$ such that $${\bf v}=\mbox{grad }f$$
on $D$.
My question is: Can we use this fact to prove that if $\bf{w}$ is a vector field with
$\mbox{div }\bf{w}=0$ on $D$, then there exists a vector field $\bf{t}$ on $D$ such that
$\mbox{curl }\bf{t}=\bf{w}$?
I can do this for 2-d case.
 A: Case 1: When the domain of interest is the whole $\mathbb{R}^3$,  the answer is yes. This is obtained by the Helmholtz decomposition for $C^1$-vector field:
$$
\mathbf{w}  = \nabla \phi + \nabla \times \mathbf{A} ,\tag{1}
$$
where
$$
\phi(x) = -\int_{\mathbb{R}^3} \Phi(y-x) \nabla_y \cdot \mathbf{w} (y) \,dy,
\\
\mathbf{A} (x) = \int_{\mathbb{R}^3}  \Phi(y-x) \nabla_y \times \mathbf{w} (y)\,dy .
$$
The $\Phi(\xi)$ is the fundamental solution to $-\Delta \Phi = \delta_0$ in whole $\mathbb{R}^3$.
Here we have to assume $\mathbf{w}$ has certain decaying properties so that the surface integral $\displaystyle\int_{\partial B} \Phi(y-x)\mathbf{n}\times  \mathbf{w} (y)\,dS(y)$ and  $\displaystyle\int_{\partial B} \Phi(y-x)\mathbf{n}\times  \mathbf{w} (y)\,dS(y)$ vanish for arbitrary large ball $B$, $|\mathbf{w}|\to 0 $ when $|y|\to \infty$ suffices.
Now if $\mathbf{w} $ is divergence free, we can see that $\mathbf{w} = \nabla \times \mathbf{A}$.

Case 2: When the domain of interest $\Omega$ is simply-connected, bounded and open, we have to consider the boundary condition of $\mathbf{w}$. The potentials in (1) will become:
$$
\phi(x) = -\int_{\Omega} \Phi(y-x) \nabla_y \cdot \mathbf{w} (y)  \, dy  +\int_{\partial \Omega}\Phi(y-x)\mathbf{w}(y)\cdot \mathbf{n}\,dS(y),
\\
\mathbf{A}(x) = \int_{\Omega}  \Phi(y-x) \nabla_y \times \mathbf{w}(y)\,dy  - \int_{\partial \Omega} \Phi(y-x)\mathbf{n}\times \mathbf{w}(y)\,dS(y). 
$$
Here $\Phi$ is the fundamental solution or Green function for 
$$
\left\{\begin{aligned}
-\Delta_y \Phi(y-x) &= \delta_x(y) \quad \text{in }\Omega,
\\
\Phi &=0 \quad \text{on } \partial\Omega.
\end{aligned}\right. 
$$
We have the boundary term here, by divergence theorem:
$$
\int_{\partial \Omega}\Phi(y-x)\mathbf{w}(y)\cdot \mathbf{n}\,dS(y)
= \int_{\Omega}\nabla \cdot\Big(\Phi(y-x)\mathbf{w}(y)\Big)\,dy
\\
= \int_{\Omega} \Phi(y-x) \nabla_y \cdot \mathbf{w} (y)  \, dy 
+ \int_{\Omega} \nabla_y \Phi(y-x) \cdot \mathbf{w} (y)  \, dy= \int_{\Omega} \nabla_y \Phi(y-x) \cdot \mathbf{w} (y)  \, dy.
$$
Hence we can see that in this case, $\mathbf{w} = \nabla \times \mathbf{A}$ if 


*

*$\mathbf{w}$ is perpendicular to the gradient field of the fundamental solution pointwisely (or a.e.) in this domain.

*$\mathbf{w}\cdot \mathbf{n}=0$ pointwisely (or a.e.) on the boundary of this domain.
Counterexamples for not making boundary term vanish: in $\mathbb{R}^3$, let $\phi$ be the solution to the following boundary value problem
$$
\left\{\begin{aligned}
-\Delta \phi&= 0\quad \text{in }\Omega,
\\
\phi &=g \neq 0 \quad \text{on } \partial\Omega.
\end{aligned}\right. 
$$
We can see that if we let $\mathbf{w} = \nabla \phi$, i.e., the gradient of a harmonic function, $\mathbf{w} $ has zero divergence, yet $\mathbf{w} $ is never a curl field.

This is the classical case, for vector potentials (or Helmholtz decomposition) in the distributional sense, this is my favorite reference: http://perso.univ-rennes1.fr/monique.dauge/publis/ABDG_VPot.pdf
