Magnitude of vector field [closed]

I think this is more of a mathematical question, but since it's for a physics problem I decided to ask it here.

I have this complicated magnetic field in spherical coordinates $$(r, \theta,\phi)$$,

$$\mathbf{B} = \left( B_r(r,\theta,\phi) , B_\theta(r,\theta,\phi) , B_\phi(r,\theta,\phi) \right)$$

And I need to compute $$|\mathbf{B}|^2$$. Instead of converting this to cartesian coordinates, which would be laborious and painful, and computing $$|\mathbf{B}|^2$$ as $$B_x^2 + B_y^2 + B_z^2$$, I did

$$|\mathbf{B}|^2 = g_{ab} B^a B^b$$

Where $$B^a$$ are the components of the vector and $$g_{ab}$$ is the metric tensor in spherical coordinates,

$$g_{ab} = \text{diag}(1,r^2, r^2 \sin^2 \theta)$$

Is this correct? Or is $$|\mathbf{B}|^2$$ given by

$$|\mathbf{B}|^2 = B_r^2 + B_\theta^2 + B_\phi^2$$

This is really confusing me.

• What is the metric tensor for? Apr 13, 2019 at 6:25

Depends whether the components given are in terms the coordinate vectors, or unit coordinate vectors. If it's in a GR or field theory book it's probably the former, if it's in something like Jackson or Griffiths (an EM book) it's probably the latter. What you did is right in the first case. But if the basis vectors are already normalized unit vectors, the metric is just $$diag(1,1,1)$$. Either way the equation in terms of $$g_{ab}$$ is fine, just changes what the metric is.