I calculated the angular distance between the Galactic Center and Andromeda in Equatorial and Galactic coordinates and observed that the distance is calculated differently depending on the coordinate system.

In Equatorial coordinates their locations are

Galactic Center 
    Ra 271.087458 degrees
    Dec -29.519139 degrees     
    Ra 00h 42m 44.3s  (10.6845833 degrees)   
    Dec +41° 16′ 9″   (41.2691667 degrees)

In Galactic Coordinates

Galactic Center
    latitude 0.0
    longitude 0.0
    latitude 121.174329 
    longitude -21.573309

This is my Python codes for calculating the distance.

import numpy as np 

def get_psi(Ra1, Dec1, Ra2, Dec2):
    psi = np.arccos(np.sin(Dec1)*np.sin(Dec2) \
                    + np.cos(Dec1)*np.cos(Dec2)\
                    * np.cos(Ra1-Ra2))
    return psi

GC_ra = np.radians(271.087458)
GC_dec = np.radians(-29.519139)

M31_ra = np.radians(10.6845833)
M31_dec = np.radians(41.2691667)

psi_GC_to_M31 = get_psi(GC_ra, GC_dec, M31_ra, M31_dec)
print(np.degrees(get_psi(0,0, np.radians(121.174329), np.radians(-21.573309))))

The results are


Why would the values differ by 3 degrees?

  • 1
    $\begingroup$ @stretch The law of cosines in the posting above would be correct. See en.wikipedia.org/wiki/Angular_distance $\endgroup$
    – Nownuri
    Jun 11, 2023 at 23:46
  • 1
    $\begingroup$ @stretch I got the galactic coordinates of Andromeda from SIMBAD and added it to the question. $\endgroup$
    – Nownuri
    Jun 11, 2023 at 23:51
  • 1
    $\begingroup$ There’s probably an error in your coordinates. Using 2023.4 (current) coordinates, I get the same angular distance between the two, in both equatorial and galactic coordinates. What is the source of your coordinates for the galactic center? $\endgroup$ Jun 12, 2023 at 1:23
  • $\begingroup$ @Nownuri your formula is correct - at a glance it looks wrong. $\endgroup$
    – stretch
    Jun 13, 2023 at 15:53

1 Answer 1


(1) Distance between 2 points, knowing their equatorial coordinates:

Galactic Center:

Note that $\alpha_1=271.087458^o$ and $\delta_1=-29.519139^o$ are not correct values. According Galactic coordinate system the correct values referred to J2000 are:

$\alpha_1=17^h \ 45^m \ 37.22^s=266.4051^o$

$\delta_1=-28^o \ 56' \ 10.23''=-28.936175^o$

Andromeda galaxy (M31)

$\alpha_2=00^h \ 42^m \ 44.3^s=10.6845833^o$

$\delta_2=+41^0 \ 16' \ 09''=+41.2691667^o$


$$d=\arccos \Big [ \sin \delta_1 \sin \delta_2 + \cos \delta_1 \cos \delta_2 \cos (\alpha_1-\alpha_2) \Big ]$$


(2) Distance between 2 points, knowing their galactic coordinates:

Galactic Center:

Galactic Longitude $l_1=0^o$

Galactic Latitude $b_1=0^o$

Andromeda galaxy (M31)

Galactic Longitude is not $l_2=-21.573309^o$ is $l_2=121.174329^o$

Galactic Latitude is not $b_2=121.174329^o$ is $b_2=-21.573309^o$


$$d=\arccos \Big [ \sin b_1 \sin b_2 + \cos b_1 \cos b_2 \cos (l_1-l_2) \Big ]$$


Perhaps it might be interesting to browse the thread: How can I convert my sky coordinate system (RA, Dec) into galactic coordinate system (l, b)?

Best regards.


You must log in to answer this question.

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