# Magnetic field derived from a scalar function

Question:

1. Show that $\mathbf B = \hat r \times \nabla g(\mathbf r)$, where $g$ is an arbitrary scalar function, is a plausible magnetic field.

2. What current density $\mathbf J$ can produce such $\mathbf B$ if $g$ satisfies Laplace's equation?

My solution:

1. This is easy. By showing that $$\nabla \cdot B = \nabla \cdot (\hat r \times \nabla g(\mathbf r)) = \nabla g(\mathbf r)\cdot (\nabla \times \hat r) - \hat r \cdot (\nabla \times \nabla g(\mathbf r)) = 0$$

2. To get $\mathbf J$, use ampere's law $\nabla \times \mathbf B = \mu_o \mathbf J$ $$\nabla \times \mathbf B = \nabla \times (\hat r \times \nabla g(\mathbf r)) = (\nabla g(\mathbf r) \cdot \nabla) \hat r + (\nabla \cdot \nabla g(\mathbf r)) \hat r - (\hat r \cdot \nabla)\nabla g(\mathbf r) - \nabla g(\mathbf r) (\nabla \cdot \hat r)$$

I couldn't really simplify this any further other than applying Laplace's equation on g: $$\nabla^2 g = \nabla \cdot \nabla g = 0$$ and use the formula for divergence in spherical coordinates: $$\nabla \cdot \hat r = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2) = \frac{2}{r}$$ Any suggestions on how to simplify the expression for $\nabla \times \mathbf B$? Thanks a lot for your help!!!

• I'm sure you can simplify ${\vec \nabla}\cdot {\hat r}$. If you're stuck, write down $\hat r$ in Cartesian coordinates. – Jerry Schirmer Nov 3 '14 at 18:32
• Yes, $\nabla \cdot \hat r$ is easy. If you use the divergence formula in spherical coordinates, you get 2/r. However, I can't find a way to combine the three resulting terms... – quarkleptonboson Nov 3 '14 at 19:14
• write the laplacian in sperical coordinates – Nikos M. Nov 3 '14 at 20:42