A vector field $\mathbf{A}$ in space is defined by $\mathbf{A}=\mathbf{R} f(r)$, where $\mathbf{R}=xi+yj+zk$ and $r=(x^2+y^2+z^2 )^{1/2}$. Determine $f(r)$ so that the field may be irrotational and solenoidal.
I know for vector field $\mathbf{A}$ to be irrotational the curl of $\mathbf{A}$ should be zero and similarly for vector field $\mathbf{A}$ to be solenoidal the divergence of $\mathbf{A}$ should be zero.
But I am stuck because I do not able to comprehend how to incorporate $f(r)$ which is required. Any help would be much appreciated. Thanks.
Assuming that $f$ is differentiable, since $\mathbf{A}=(xf(r),yf(r),zf(r))$ then, by the chain rule, it follows that $$\begin{align}\nabla \cdot \mathbf{A}&=\frac{\partial (xf(r))}{\partial x}+\frac{\partial (yf(r))}{\partial y}+\frac{\partial (zf(r))}{\partial z}\\ &=3f(r)+f'(r)\left(x\frac{x}{r}+y\frac{y}{r}+z\frac{z}{r}\right)=3f(r)+f'(r)r. \end{align}$$ Notice that $\mathbf{A}$ is a central vector field and therefore it is easy to check that $\nabla \times \mathbf{A}=\mathbf{0}$.
Therefore it remains to solve the ODE: $$3f(r)+f'(r)r=0.$$ By separation of variables we get $$\frac{f'(r)}{f(r)}=-\frac{3}{r}\Leftrightarrow \ln(f(r))=-3\ln(r)+c \Leftrightarrow f(r)=\frac{C}{r^3}.$$