Finding a Vector With a Given Curl

Suppose we have a vector field  
\[\mathbf{v}\]
  satisfying  
\[\mathbf{\nabla} \cdot \mathbf{v} =0\]
  for which we want to find a vector field  
\[\mathbf{w}\]
  such that  
\[\mathbf{\nabla} \times \mathbf{w} = \mathbf{v}\]
.   (1)
For any vector  
\[\mathbf{u}\]
  ,  
\[\mathbf{\nabla} \cdot (\mathbf{\nabla}\times \mathbf{u}) =0\]
  so all solutions of (1) are given by  
\[\mathbf{u} = \mathbf{u_o} + \mathbf{\nabla} f \]
  where  
\[f=f(x,y,z)\]
  is an arbitrary scalar and  
\[\mathbf{w_0}\]
  is any vector satisfying nbsp;
\[\mathbf{\nabla} \times \mathbf{w} = \mathbf{v}\]
.
Example  
\[\mathbf{v}=3x \mathbf{i} +2y \mathbf{j} - 5z \mathbf{k}\]

 
\[\mathbf{\nabla} \cdot \mathbf{v} = \frac{\partial (3x) }{\partial x} + \frac{\partial (2y) }{\partial y} + \frac{\partial (-5x) }{\partial z}=0\]

Because  
\[\mathbf{w_0}\]
  is arbitrary we can choose  
\[\mathbf{w_0} = w_1 \mathbf{i} + w_2 \mathbf{j}\]
  Then  
\[\begin{equation} \begin{aligned} \mathbf{\nabla} \times \nabla{w_0} &= (\frac{\partial}{\partial x} \mathbf{i} + \frac{\partial}{\partial y} \mathbf{j} + \frac{\partial}{\partial z} \mathbf{k}) \times (w_1 \mathbf{i} + w_2 \mathbf{j}) \\ &=- \frac{\partial w_2}{\partial z} \mathbf{i} + \frac{\partial w_1}{\partial z} \mathbf{j} + (\frac{\partial w_2}{\partial x} - \frac{\partial w_1}{\partial y})\mathbf{k} = 3x \mathbf{i} + 2y \mathbf{j} -5z \mathbf{k} \end{aligned} \end{equation}\]

Equating components gives  
\[- \frac{\partial w_2}{\partial z} = 3x\]
  ,  
\[- \frac{\partial w_1}{\partial z} = 2y\]
  ,  
\[\frac{\partial w_2}{\partial x} - \frac{\partial w_1}{\partial y} = -5z\]

Integration gives  
\[w_2 = -3xz+ g(x,y)\]
  and  
\[w_1 = 2yz+ h(x,y), \]

Substituting thse into  
\[\frac{\partial w_2}{\partial x} - \frac{\partial w_1}{\partial y} = -5z\]
  gives  
\[-3z + \frac{\partial g}{\partial z} -2z - \frac{\partial h}{\partial y} = -5z\]

This equation is satisfied with  
\[g(x,y)=h(x,y)=0\]

Hence  
\[\mathbf{w} = \mathbf{w_0} + \mathbf{\nabla} f = 2yz \mathbf{i} -3xz{j} + \mathbf{\nabla} f\]
  where  
\[f\]
is arbitrary.