# Transformation of spherical coordinates — where is my the error?

I have tried to shift the angle of spherical coordinates, with impossible result but can't find what I did wrong.

Using spherical coordinates of the unit sphere in $\mathbb R^N$ we have $x_1=\cos\theta_1$, $x_2=\sin\theta_1\cos\theta_2$ and so on. To get rid of the and so on I would like to write $x_{n+1}=x_n\tan\theta_n\cos\theta_{n+1}$.

Thus we have $\vec x(\vec\theta)$ as a function of $\vec\theta$.

Now, say, we have $\vec y=\vec y(\vec\phi)$ and want to change the underlying coordinate system such that $\vec y(\phi')=\vec e_1=(1,0,\dots, 0)$.

It looks obvious, changing $\vec\theta\mapsto\vec\theta'$ with $\theta'_1=\theta_1-\phi_1$ and $\theta'_n=\theta_n$ for $n>1$ will do this.

But doing so, all points with $\theta_1=\phi_1$ will collapse to $\vec e_1$.

I guess the error is obvious to quite anyone else but me.

• It sounds like you have a vector field and you want to rotate the entire vector field so that it is essentially just rotating the entire coordinate system. Does that sound roughly correct? – jdods Nov 25 '17 at 16:00
• @jdods Yes, that was the plan. – Gyro Gearloose Nov 25 '17 at 16:02
• Consider two sets of spherical coordinates on a unit sphere in $\mathbb R^3,$ one each around two different axes. Look at a small circle around one of the axes; make it small enough that the axis of the other coordinate system is outside the small circle. Now we can see that on that circle, $\theta_1$ is a constant while $\theta_2$ takes on all values from $0$ to $2\pi$ according to the coordinate system around the circle's axis, but in the other coordinate system the range of $\theta_2$ values is much smaller and instead we have varying $\theta_1$ values. – David K Nov 25 '17 at 16:07
• Instead of giving you coordinates around a different axis, the transformation $\theta'_1=\theta_1-\phi_1$ and $\theta'_n=\theta_n$ for $n>1$ just relabels the "latitude" of all points while keeping the same axis of spherical coordinates. For example, if $\phi_1=\frac\pi3,$ you end up with $-\frac\pi3\leq\theta_1'\leq\frac{5\pi}3$ instead of $0\leq\theta_1\leq2\pi.$ – David K Nov 25 '17 at 16:12
• @DavidK I guess you are at my deaf point. I see, but don't understand. If the operation changes latitude, why do (in my computation) all points with same $\theta_1$ collapse into one? – Gyro Gearloose Nov 25 '17 at 16:17

## 2 Answers

I'll give you an answer using different notation and only for $\vec F :\mathbb R^3\rightarrow \mathbb R^3.$ Hopefully you can adapt it to your situation.

Let $\vec F(\vec x)$ be a vector field with $\vec x=(x_1,x_2,x_3),$ i.e. the same as $(x,y,z).$ Let $R$ be some set of rotations. E.g. $R=R_1(\theta_1)R_2(\theta_2)R_3(\theta_3)$ where $R_i(\theta)$ rotates counter-clockwise around positive $x_i$ axis.

An example rotation operator would be rotate $\theta$ counter-clockwise around the positive $x_3$ axis: $$R=R_3(\theta)=\left[\begin{matrix} \cos(\theta) & -\sin(\theta) & 0\\ \sin(\theta) & \cos(\theta) & 0\\ 0 & 0 & 1\end{matrix}\right].$$ See the Wikipedia article.

What I want to do is to view $\vec F$ in the original coordinate system $\vec x$, and to rotate the vector field while still viewing it in $\vec x$ coordinates. This amounts to doing the inverse transform to the coordinate system.

The way to achieve this is $$RF(R^{-1}\vec x).$$

Now to adapt this to a general $\mathbb R^n$ might be tricky.

I'll provide an example. Let $\vec F(x,y,z)=\langle -y, x, 0\rangle,$ and let's rotate this $\frac\pi2$ counter-clockwise around the positive $x$ axis. This rotation operator is $$R=R_1\left(\frac\pi2\right)=\left[\begin{matrix} 1 & 0 & 0\\ 0 & 0 & -1\\ 0 & 1 & 0\end{matrix}\right].$$

So we first apply the inverse transform (which is just the transpose in this situation) to the coordinates: $$R\vec x=\left[\begin{matrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & -1 & 0\end{matrix}\right]\left[\begin{matrix} x \\ y \\ z\end{matrix}\right]=\left[\begin{matrix}x & z & -y\end{matrix}\right].$$ Then we plug this into the vector field formula: $$F(R^{-1}\vec x)=F(x,z,-y)=\langle-z, x, 0\rangle.$$ Then we apply the rotation operator to this $$RF(R^{-1}\vec x)=RF(x,z,-y)=\left[\begin{matrix} 1 & 0 & 0\\ 0 & 0 & -1\\ 0 & 1 & 0\end{matrix}\right] \left[\begin{matrix} -z \\ x \\ 0\end{matrix}\right]=\left[\begin{matrix} -z & 0 & x\end{matrix}\right].$$

So the final result is $R\vec F(R^{-1}\vec x)=\langle -z, 0, x\rangle.$

There are two ways to look at transforming a coordinate system. I prefer to pick an arbitrary point and ask what happens to its coordinates if we transform the coordinate system. If we do that with the transformation $\theta'_1=\theta_1-\phi_1$ and $\theta'_n=\theta_n$ for $n>1,$ an arbitrary point ends up with the same coordinates it had before except for the "latitude."

If (for example) $\phi_1=\frac\pi3,$ the transformed latitude has the range $-\frac\pi3\leq\theta_1'\leq\frac{2\pi}3$ instead of $0\leq\theta_1\leq\pi.$ In that case, look what we're doing to the following sets of coordinates:

The coordinates $(\theta_1,\theta_2,\ldots) = \left(\frac\pi6,0,\ldots\right)$ become $(\theta'_1,\theta'_2,\ldots) = \left(-\frac\pi6,0,\ldots\right).$ Does that make sense?

The coordinates $(\theta_1,\theta_2,\ldots) = \left(\pi,0,\ldots\right)$ become $(\theta'_1,\theta'_2,\ldots) = \left(\frac{2\pi}3,0,\ldots\right).$

What coordinates $(\theta_1,\theta_2,\ldots)$ must you have in order to get $(\theta'_1,\theta'_2,\ldots) = \left(\pi,0,\ldots\right)$? Algebraically, we have $\theta_1 = \theta'_1+\phi_1 = \frac{4\pi}3.$ But what point has coordinates $(\theta_1,\theta_2,\ldots) = \left(\frac{4\pi}3,0,\ldots\right)$? Wouldn't such a point usually be described by coordinates $(\theta_1,\theta_2,\ldots) = \left(\frac{2\pi}3,\pi,\ldots\right),$ that is, coordinates such that $0\leq \theta_1\leq \pi$? But then the point would get mapped to $(\theta'_1,\theta'_2,\ldots) = \left(\frac\pi2,0,\ldots\right),$ not $\left(\pi,0,\ldots\right).$

Another way to do a coordinate transformation is to transform the coordinates of every point, which moves points around in space, and then alter the coordinate system itself in order to return every point back to where it came from. This works fine for translations in Cartesian coordinates, and also works well for rotations in polar coordinates in $\mathbb R^2$: just subtract $\phi$ from $\theta,$ which sends every point (except the origin) clockwise, and then rotate the coordinate system counterclockwise by $\theta$ to bring everything back.

But consider spherical coordinates in $\mathbb R^3$ as an example; specifically, consider what a transformation in spherical coordinates would do to the surface of the Earth if we add $\frac\pi3$ to the colatitude. Recalling that in mathematical spherical coordinates, the first angular coordinate is measured from the positive $z$ axis downward, and that we tend to assume the positive $z$ axis goes through the north pole, adding $\frac\pi3$ to this coordinate moves things $30$ degrees (about $3333$ kilometers) to the south.

Now, since Antarctica is all within less than $3333$ km from the south pole, what happens to it? Does it just disappear, or do all its points go through the pole and start traveling up the other side of the Earth? Note that if it does that, the continent ends up "inside out" (the points that were originally northernmost go through the pole last and end up closer to the south pole than other points do), and moreover East Antarctica will partially overlap with South America. Or we could say that everything that goes into the south pole comes immediately back out at the north pole; this fills in the region within $30$ degrees of the north pole, which otherwise would get nothing (not even ocean), but still has Antarctica inside out and moreover puts it very close to Greenland.

It should be clear that there is no rotation of the globe that will put things back where they came from. Everything is stretched, squashed, inverted, deleted, and/or overlaid on something else.

What you can do is to add $30$ degrees west longitude to every point on the globe and then rotate it all $30$ degrees east to restore things to where they came from. More generally, in $\mathbb R^n$ you can subtract an angle $\phi$ from the last angular coordinate, the coordinate that ranges from $0$ to $2\pi,$ and this will represent a rotation of the coordinates. But you cannot do this to any other coordinate in spherical coordinates (including the radial coordinate) and expect the result to be a rotation.

• Excuse me, I still don't understand. One minor issue, the latitude would really be longitude, on account of having a full circle, right? And I still have no clue why this seemingly simple transformation in $\theta$ coordinates is not one to one for $x$-coordinates. – Gyro Gearloose Nov 25 '17 at 17:07
• My mistake, I should have had $\theta_1\leq\pi,$ not $2\pi.$ I have fixed that. And why ever would you expect a transformation in spherical coordinates to work just like one in Cartesian coordinates? They don't look the same at all! – David K Nov 25 '17 at 17:20
• "And why ever would you expect a transformation in spherical coordinates to work just like one in Cartesian coordinates? They don't look the same at all!" --- instinct tells me this is what I'm missing! I wouldn't have been surprised it that transformation simply did something unexpected, but (I still hope for some computational error) it messes up everything, it doesn't even keep different points apart! – Gyro Gearloose Nov 25 '17 at 17:27