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.


1 Answer 1


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.

  • $\begingroup$ Thank you for your comment. I believe it is the latter case - the basis vectors are normalized. I did some calculations using the second way and I think it gives the supposed results. It just confused me because I find it weird calculating the magnitude of a vector by the square of each of its components when using spherical coordinates; that is when using cartesian coordinates. I expected some extra terms to appear, which is why I thought it had to be with the metric. $\endgroup$
    – Sth99
    Apr 12, 2019 at 22:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.