So I came across this question from physics stack exchange. I'd like you to see the first answer there. I am particularly interested in the conversion from spherical polar unit vectors to cartesian unit vectors.
The answerer, BioPhysicist, writes that (I have simplified it into a matrix equation):

$$\begin{bmatrix}\sin\theta \cos\phi & \cos\theta \cos\phi &-\sin\phi \\ \sin\theta \sin\phi & \cos\theta \sin\phi & \cos\phi \\ \cos\theta & 0 & -\sin\theta \end{bmatrix} \cdot \begin{bmatrix} \hat{r}\\\hat{\theta}\\\hat{\phi} \end{bmatrix} = \begin{bmatrix} \hat{x}\\\hat{y}\\\hat{z} \end{bmatrix}$$

(Typing the matrix took me about half an hour. I need to get used to latex soon. Whew !)

Now what if I want to go from cartesian to spherical polar coordinates ? There exist neat results for cylindrical to cartesian and 2D circular polar coordinates to cartesian and this is all because their respective transformation matrices are simple, neat and invertible. I'll struggle a bit more with my matrix latex and give you an example of cylindrical coordinates.
So, in cylindrical coordinates, we have, $$\begin{bmatrix}\hat{x}\\\hat{y}\\\hat{z}\end{bmatrix} = \begin{bmatrix} \cos\left(\theta\right) & -\sin\left(\theta\right) & 0 \\ \sin\left(\theta\right) & \cos\left(\theta\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix}\hat{r}\\\hat{\theta}\\\hat{\phi}\end{bmatrix}$$ and, $$ \begin{bmatrix}\hat{r}\\\hat{\theta}\\\hat{\phi}\end{bmatrix}= \begin{bmatrix} \cos\left(\theta\right) & \sin\left(\theta\right) & 0 \\ -\sin\left(\theta\right) & \cos\left(\theta\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix}\hat{x}\\\hat{y}\\\hat{z}\end{bmatrix}$$

This all happens because the two matrices above are inverses of each other.
However, when I try to find the inverse matrix of the spherical polar to cartesian transformation matrix, I get messy stuff. Let me put it below for you. You can see the inverse operation being done here

The next moment I realise that they have not simplified it. So I head over to WolframAlpha and get this. So now what I notice is that the inverse does not exist whenever you have $\theta = 90^\circ$. But what exactly is the problem when we have the cartesian vector lying in the XY plane? Why is the determinant zero at that time?

Note : my $\theta$ is the angle measured from the Z-axis and the $\phi$ I use is the angle measured between the positive X axis and the projection of the vector on the XY plane.


1 Answer 1


Problems arise when the vector is parallel to the $z$ axis, because in that case the vector has an infinite number of spherical polar coordinates.

Geographically speaking, the north and south poles can have any longitude you like. Or, saying this another way, longitude is not uniquely defined at the north and south poles.

The geographical explanation is useful because it avoids any mention of the polar angles $\theta$ and $\phi$, which are often defined in different ways by different people. In fact, I suspect that confusion over angle definitions is the source of the trouble, here.

  • $\begingroup$ I don't think vector on XY plane is same as parallel to z axis $\endgroup$
    – Maou
    Apr 8, 2022 at 10:56
  • $\begingroup$ No, of course not. $\endgroup$
    – bubba
    Apr 8, 2022 at 21:24
  • $\begingroup$ I suspect that you’re confused by two commonly-used definitions of $\theta$. $\endgroup$
    – bubba
    Apr 8, 2022 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .