Vector potential for $\nabla f \times \nabla g$ 
Let $f$ and $g$ be two smooth real-valued functions on $\mathbb{R}^3$. How can we find a vector potential for the vector field $F = \nabla f \times \nabla g$?

In this question - Show that $\nabla\cdot (\nabla f\times \nabla h)=0$ - we have that $\text{div}(F) = 0$, so $F$ has a vector potential, i.e. a vector field $H$ on $\mathbb{R}^3$ such that $\text{curl}(H) = F.$ But how do we specifically find it? If we let $H = (H_1, H_2, H_3)$, then we should have that $$\displaystyle \begin{pmatrix} \frac{\partial H_3}{\partial y} - \frac{\partial H_2}{\partial z} \\ \frac{\partial H_1}{\partial z} - \frac{\partial H_3}{\partial x} \\ \frac{\partial H_2}{\partial x} - \frac{\partial H_1}{\partial y} \end{pmatrix} = \begin{pmatrix} \frac{\partial f}{\partial y} \cdot \frac{\partial g}{\partial z} - \frac{\partial f}{\partial z} \cdot \frac{\partial g}{\partial y} \\ \frac{\partial f}{\partial z} \cdot \frac{\partial g}{\partial x} - \frac{\partial f}{\partial x} \cdot \frac{\partial g}{\partial z} \\ \frac{\partial f}{\partial x} \cdot \frac{\partial g}{\partial y} - \frac{\partial f}{\partial y} \cdot \frac{\partial g}{\partial x} \end{pmatrix}, $$ but i don't know how to continue from here.
 A: As long as $F(\mathbf{x})$ decays sufficiently fast as $\|\mathbf{x}\| \to \infty$, the vector potential $\phi$ such that $\nabla \times \phi = F$ is given by
$$\phi(\mathbf{x}) = \frac{1}{4\pi}\int_{\mathbb{R}^3} \frac{\nabla \times (\nabla f(\mathbf{y}) \times \nabla g(\mathbf{y}))}{\|\mathbf{x} -  \mathbf{y} \|}\, d \mathbf{y} $$
This can be expanded further using $\nabla \times(\nabla f \times \nabla g) = f \nabla \cdot g - g \nabla \cdot f + g \cdot \nabla f - f \cdot \nabla g.$
A: There is a solution in terms of just $f$ and $g$, namely $$H = \begin{pmatrix} f \cdot \frac{\partial g}{\partial x} \\ f \cdot \frac{\partial g}{\partial y} \\ f \cdot \frac{\partial g}{\partial z} \end{pmatrix}. $$ We can see that $\text{curl}(H) = F$. As an example, the first component of $\text{curl}(H)$ is $$\frac{\partial f}{\partial y} \cdot \frac{\partial g}{\partial z} + f \cdot \frac{\partial^2 g}{\partial y \partial z} - \frac{\partial f}{\partial z} \cdot \frac{\partial g}{\partial y} - f \cdot \frac{\partial^2 g}{\partial z \partial y}, $$ and since $g$ is smooth, its partial derivatives commute.
