You can express any vector field as the sum of a potential field (curl free) and a solenoidal field (source free):
[tex]\vec{F}(\vec{x})=-\vec{\nabla} U(\vec{x})+\vec{\nabla} \times \vec{W}.[/tex]
Taking the divergence of this equation, you find
[tex]\vec{\nabla} \cdot \vec{F}(\vec{x})=-\Delta U(\vec{x})=D(\vec{x}).[/tex]
Assuming that all the fields vanish sufficiently quickly at infinity and that they are sufficiently well behaved everywhere, this equation (the Poisson-Laplace equation) is solved with help of the Green's function of the Laplace operator:
[tex]U(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x}' \frac{D(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.[/tex]
The Green's function you find by solving the equation
[tex]\Delta_{\vec{x}} G(\vec{x}-\vec{x}')=-\delta^{(3)}(\vec{x}-\vec{x}')[/tex].
This is done most easily by introducing spherical coordinates for [tex]\vec{r}=\vec{x}-\vec{x}' \neq {0}.[/tex]
This yields together with the condition that the Green's function should vanish at infinity,
[tex]G(\vec{r})=\frac{C}{|\vec{r}|}.[/tex]
The constant C is given by integrating the delta distribution over a ball of radius, R:
[tex]-1=-\int_{K_R} \mathrm{d}^3 \vec{r} \delta^{(3)}(\vec{r}) \int_{K_R} \mathrm{d}^3 \vec{r} \Delta G(\vec{r})=\int_{\partial K_R} \mathrm{d} \vec{A} \cdot \vec{\nabla} G(\vec{r})=-4 \pi C.[/tex]
This means [tex]C=1/(4 \pi).[/tex]
Now taking the curl of the above Helmholtz decomposition of the vector field yields
[tex]\vec{\nabla} \times \vec{F}=\vec{\nabla} \times (\vec{\nabla} \times \vec{W})=\vec{\nabla} (\vec{\nabla} \cdot \vec{W})-\Delta \vec{W}=\vec{C}.[/tex]
Now [tex]\vec{W}[/tex] is only determined up to the gradient of a scalar field, and thus we can demand one auxilliary condition (this is a special case of gauge invariance). Here, the condition
[tex]\vec{\nabla} \cdot \vec{W}=0[/tex]
is most costumary since then we have
[tex]\Delta \vec{W}=-\vec{C},[/tex]
and we can again use the Green's function of the Laplace operator to get
[tex]\vec{W}(\vec{x})=\int_{\mathbb{R}^3} \mathrm{d}^3 \vec{x}' \frac{\vec{C}(\vec{x}')}{4 \pi |\vec{x}-\vec{x}'|}.[/tex]