In the previous article on basic trigonometry for astrologers, we derived formulas for converting spherical coordinates to Cartesian ones. In this article, we will get acquainted with the equations for the coordinate conversion from one spherical coordinate system to another. It will help us solve the previously stated task of converting ecliptic coordinates to equatorial, which is necessary for calculating primary directions.

Cartesian Vector

First, we need to convert the spherical angles of the celestial object to cartesian coordinates with equation (2) from the previous article. We will perform all the conversions in cartesian coordinates.

For convenience, we introduce the idea of cartesian vector as a pointer to an object in the XYZ\textbf{XYZ} coordinate system.

Vector has

  • starting point with coordinates (0,0,0)(0, 0, 0)
  • endpoint with coordinates (x,y,z)(x, y, z) that coincides with the object’s location.

We will denote the vector by the letter v\vec{v} and write its direction in the following form:

v=xX+yY+zZ\vec{v} = x \textbf{X} + y \textbf{Y} + z\textbf{Z}

In the latter notation, we mean that the vector has an extent of X\textbf{X} units in the direction of the X\textbf{X}-axis, an extent of Y\textbf{Y} units along the Y\textbf{Y}-axis and the same for Z\textbf{Z}.

Rotation of the Coordinate System

What happens if we rotate the coordinate system by the angle α\alpha in XY\textbf{XY} plane?

X Y α α x y y' x' X rot Y rot v

In the initial XYZ\textbf{XYZ} system vector has coordinates (x,y)(x, y), but in a new (rotated) system, it has coordinates (x,y,z)(x^\prime, y^\prime, z^\prime), i.e.

v=xXrot+yYrot+zZrot\vec{v} = x^\prime \textbf X_\text{rot} + y^\prime \textbf Y_\text{rot} + z^\prime \textbf Z_\text{rot}

Let’s consider an X\textbf{X} part of the vector v\vec{v}, namely, xXx \textbf{X}. It is a pointer to the xx coordinate.

α x Y rot X rot x cos(α) x sin(α)

We can project this pointer (i.e., vector) to the Xrot\textbf X_\text{rot} and Yrot\textbf Y_\text{rot} axes. We remember from (1) of the previous article that these projections are xcosαx \cos\alpha and xsinα-x \sin\alpha. So we can write:

хX=xcosα Xrotxsinα Yrotх \textbf{X} = x \cos\alpha~ \textbf X_\text{rot} - x \sin\alpha~ \textbf Y_\text{rot}

In the same way

yY=ysinα Xrot+ycosα Yroty \textbf{Y} = y \sin\alpha~ \textbf X_\text{rot} + y \cos\alpha~ \textbf Y_\text{rot}

We do not change the Z\textbf Z -axis, so zZ=zZrotz\textbf Z = z\textbf Z_\text{rot}. Putting it all together, we have:

v=(xcosα+ysinα)Xrot +(xsinα+ycosα)Yrot +zZrot v=xXrot+yYrot+zZrot\begin{aligned} \vec{v} &= \left(x \cos\alpha + y \sin\alpha\right) \textbf X_\text{rot} \\\ &+ \left( -x \sin\alpha + y\cos\alpha \right) \textbf Y_\text{rot} \\\ &+ z\textbf Z_\text{rot}\\\ \vec{v} &= x^\prime \textbf X_\text{rot} + y^\prime \textbf Y_\text{rot} +z^\prime\textbf Z_\text{rot} \end{aligned}

It means that:

{x=xcosα+ysinα y=xsinα+ycosα z=z(1)\begin{cases} x^\prime = x\cos\alpha + y \sin\alpha \\\ y^\prime = -x \sin\alpha + y\cos\alpha \\\ z^\prime = z \end{cases}\tag{1}

For the reverse conversion we need to change α\alpha to α-\alpha, which gives:

{x=xcosαysinα y=xsinα+ycosα z=z(2)\begin{cases} x = x^\prime\cos\alpha - y^\prime \sin\alpha \\\ y = x^\prime \sin\alpha + y^\prime\cos\alpha \\\ z = z^\prime \end{cases}\tag{2}

Sine and Cosine of Two Angles

From (2)(2), it follows a vital equation. Lets denote spherical longitude in XrotYrot\textbf X_\text{rot} \textbf Y_\text{rot} plane by β\beta, i.e.

{x=cos(α+β) y=sin(α+β) x=cosβ y=sinβ \begin{cases} x = \cos(\alpha + \beta) \\\ y = \sin(\alpha + \beta) \\\ x^\prime = \cos\beta \\\ y^\prime = \sin\beta \\\ \end{cases}
X Y α x y y' x' X rot Y rot v β

Then we immediately get the equations for the sine and cosine of the sum of two angles:

cos(α+β)=cosαcosβsinαsinβ sin(α+β)=sinαcosβ+sinβcosα(3)\begin{aligned} &\cos(\alpha + \beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta \\\ &\sin(\alpha + \beta) = \sin\alpha\cos\beta + \sin\beta\cos\alpha \end{aligned}\tag{3}

Rotation Matrices

Let’s return to formula (2)(2). This time we write it more implicitly:

{x=cosα×x+sinα×y+0×zy=sinα×x+cosα×y+0×zz=0×v+0×y+1×z\begin{cases}& x' = \cos\alpha &\times& x &+& \sin\alpha &\times& y &+& 0 &\times& z \\ & y' = -\sin\alpha &\times&x &+& \cos\alpha &\times& y &+& 0 &\times& z \\ & z' = 0 &\times& v &+& 0 &\times& y &+& 1 &\times& z\end{cases}

We have a repeating pattern — we sequentially multiply the xx, yy, and zz coordinates by specific coefficients in the first, second, and third rows and then sum the product of these multiplications.

We can separately list these coefficients of the 1st, 2nd, and 3rd rows in square brackets and express the same idea more concisely:

(x y z)=[cosαsinα0 sinαcosα0 001]×(x y z)\left(\begin{array}{r}x' \\\ y' \\\ z'\end{array}\right) = \left[\begin{array} {rrr} \cos\alpha & \sin\alpha & 0 \\\ -\sin\alpha & \cos\alpha & 0 \\\ 0 & 0 & 1 \end{array}\right] \times \left(\begin{array}{r}x \\\ y\\\ z\end{array}\right)

It is a more convenient representation of these three equations, but this compactness will make our lives easier. We pronounce it like this: If we multiply the coordinates xx, yy, and zz by these coefficients, then we will get the new coordinates of the vector in the coordinate system rotated at an angle α\alpha.

These coefficients are commonly referred to as the rotation matrix, and the expression above is the multiplication of the coordinates (x,y,z)(x, y, z) by the rotation matrix, which gives new coordinates (x,y,z)(x’, y’, z’).

For rotation in the XY\textbf{XY} plane on angle α\alpha we use the following matrix

A=[cosαsinα0 sinαcosα0 001](4)\mathbf{A} = \left[\begin{array} {rrr} \cos\alpha & \sin\alpha & 0 \\\ -\sin\alpha & \cos\alpha & 0 \\\ 0 & 0 & 1 \end{array}\right]\tag{4}

A\mathbf{A} is the rotation matrix in the XY\textbf{XY} plane, i.e., a 2-dimensional array of coefficients to be multiplied with coordinates.

For the inverse conversion, we change α\alpha to α-\alpha, which gives an inverted matrix symmetrical to the original:

AT=[cosαsinα0 sinαcosα0 001]\mathbf{A^T} = \left[\begin{array} {rrr} \cos\alpha & -\sin\alpha & 0 \\\ \sin\alpha & \cos\alpha & 0 \\\ 0 & 0 & 1 \end{array}\right]

In the same way, the rotation matrices for rotation in XZ\textbf{XZ} and YZ\textbf{YZ} planes are:

AXZ=[cosα0sinα 010 sinα0cosα](5)\mathbf{A}_{XZ} = \left[\begin{array} {rrr} \cos\alpha & 0 & \sin\alpha \\\ 0 & 1 & 0 \\\ -\sin\alpha & 0 & \cos\alpha \end{array}\right]\tag{5} AYZ=[100 0cosαsinα 0sinαcosα]\mathbf{A}_{YZ} = \left[\begin{array} {rrr} 1 & 0 & 0 \\\ 0 & \cos\alpha & \sin\alpha \\\ 0 & -\sin\alpha & \cos\alpha \end{array}\right]

Multiple Rotations

This concise notation for translating cartesian coordinates through rotation matrices gives us a significant advantage. Now, we can efficiently perform multiple sequential rotations in different planes and express them with a straightforward formula.

Suppose we want to rotate the coordinate system by an angle α\alpha along the XY\textbf{XY} plane and then rotate the new coordinate system by an angle β\beta along the XZ\textbf X' \textbf Z' plane. First, we obtain the vector’s coordinates after rotation by angle α\alpha:

(x\y\z)=A×(x\y\z)\left(\begin{array}{c}x'\\\y'\\\z'\end{array}\right) = \mathbf{A} \times \left(\begin{array}{c}x\\\y\\\z\end{array}\right)

Then we rotate this vector by angle β\beta in the second plane:

(x\y\z)=B×(x\y\z)\left(\begin{array}{c}x''\\\y''\\\z''\end{array}\right) = \mathbf{B} \times \left(\begin{array}{c}x'\\\y'\\\z'\end{array}\right)

We can express this even more simply:

(x\y\z)=B×A×(x\y\z)\left(\begin{array}{c}x''\\\y''\\\z''\end{array}\right) = \mathbf{B} \times \mathbf{A} \times \left(\begin{array}{c}x\\\y\\\z\end{array}\right)

As you can see, we simply multiply the matrices in the required sequence. Here, the first rotation matrix, according to (4)(4), is:

A=[cosαsinα0 sinαcosα0 001]\mathbf{A} = \left[ \begin{array}{rrr}\cos\alpha & \sin\alpha & 0 \\\ -\sin\alpha & \cos\alpha & 0 \\\ 0 & 0 & 1\end{array} \right]

And the second rotation matrix, according to (5)(5), is:

B=[cosβ0sinβ 010 sinβ0cosβ]\mathbf{B} = \left[ \begin{array}{rrr}\cos\beta & 0 & \sin\beta \\\ 0 & 1 & 0 \\\ -\sin\beta & 0 & \cos\beta \end{array} \right]

As you can see, we can write translations from one coordinate system to another very compactly.

Voila, we have coordinates of the initial vector in a new coordinate system. What we have to do eventually is to convert new cartesian coordinates into spherical angles in the rotated coordinate system.

To do this, we will use equation (2) from the previous article.

Bottom Line

You are now familiar with vector objects and rotation matrices.

You also know that the general approach to converting one spherical system to another consist of 3 steps.

Step 1

Covert spherical angles to cartesian coordinates with equation (2) from the previous article. We denote cartesian coordinates by (x,y,z)(x, y, z)

Step 2

Rotate the coordinate system by angle α\alpha and then by β\beta and express cartesian coordinates in a new (rotated) system:

(x\y\z)=B×A×(x\y\z)\left(\begin{array}{c}x''\\\y''\\\z''\end{array}\right) = \mathbf{B} \times \mathbf{A} \times \left(\begin{array}{c}x\\\y\\\z\end{array}\right)

Step 3

Finally, convert cartesian coordinates (x,y,z)(x'', y'', z'') to spherical angles with equation (2) from the previous article.