<p>Alternative approach:</p>
<p>Right ascension + declination + distance are spherical coordinates.  Apply a standard conversion from spherical to rectangular coordinates and the distance calculation becomes easy.</p>

CC BY-SA 4.0
2022-03-28T18:28:14.480Z
They're [spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system), not polar. And there are a couple different conventions for specifying the angles that make up a spherical coordinates (not to mention that spherical coordinates tend to use a polar angle, whereas declination is measured from the reference plane)., so it probably would be best to include the actual calculations.
notovny
CC BY-SA 4.0
2022-03-29T02:33:03.813Z
@notovny Yeah, I used the wrong word, but the idea is valid--the calculation is easy if you transform the coordinate system.
Loren Pechtel
CC BY-SA 4.0
2022-03-28T02:41:27.103Z
2022-04-23T13:37:00.453Z
2022-04-23T13:37:00.453Z
Loren Pechtel
<p>The really, really easy way to find the distances between two stars with kown directions and distances from Earth is to use an application which calculates those distances.</p>
<p>See:</p>
<p><a href="https://astronomy.stackexchange.com/questions/45105/what-is-the-closest-stellar-neighbour-to-sirius/45135#45135">What is the closest stellar neighbour to Sirius?</a></p>
<p>In my answer I say that my first impression is that Procyon would probably be the closest stellar neighbor to Sirius.  Then I investigate a few stars, listing their differences in angles from the right ascension and the declination of Sirius, and also by how much their distances from Earth differ from that of Sirius.</p>
<p>And then I tried using an app which calculates the distance between two stars.  And of all the star pairs I tried, Procyon was the closest to Sirius according to that online app.</p>
<p><a href="https://www.wolframalpha.com/widgets/view.jsp?id=1ece06643e87f3c4d90813af5ee12223" rel="nofollow noreferrer">https://www.wolframalpha.com/widgets/view.jsp?id=1ece06643e87f3c4d90813af5ee12223</a></p>

CC BY-SA 4.0
2022-03-28T17:26:29.860Z
2022-03-28T17:40:16.370Z
2022-03-28T17:40:16.370Z
M. A. Golding
<p>If you know the right ascension and declension of the stars, then you know the angle between them (ie the A-Sun-B angle). Working this out is an exercise in spherical trigonometry. The cosine of angular separation of the stars <span class="math-container">$\cos(C)$</span> is given by
<span class="math-container">$$\cos(C) = \sin(d_a)\sin(d_b) + \cos(d_a)\cos(d_b)\cos(r_a-r_b)$$</span></p>
<p>Where <span class="math-container">$d_i$</span> is the declension of the star <span class="math-container">$i$</span> and <span class="math-container">$r_i$</span> is the right ascension (in degrees or radians as necessary)</p>
<p>Then the distance between the stars is just an application of the cosine law.
<span class="math-container">$$c^2=a^2+b^2 -2ab\cos(C).$$</span> In which <span class="math-container">$a$</span> and <span class="math-container">$b$</span> are the distances to each star and <span class="math-container">$c$</span> is distance between the stars.</p>

CC BY-SA 4.0
2022-03-27T16:39:10.830Z
Thank you. My trigonometry days are far behind me.
Jason
CC BY-SA 4.0
2022-03-27T16:32:12.833Z
2022-03-27T16:32:12.833Z
James K
<p>If I have the following information about star A and Star B, how can I compute the distance between A and B?</p>
<ul>
<li>Distance from Sol for Star A</li>
<li>Right Ascension/Declination of Star A</li>
<li>Parallax/Absolute Magnitude of Star A</li>
<li>Distance from Sol for Star B</li>
<li>Right Ascension/Declination of Star B</li>
<li>Parallax/Absolute Magnitude of Star B</li>
</ul>
<p>I can use the parallax and absolute magnitude to compute distance from Sol, but I don't know how to get the distance between A and B.</p>
<p>Obviously there will be errors in the parallax, but I'm looking for a best effort means to calculate this.</p>
<p><strong>Edit</strong></p>
<p>I've implemented this in Java and made it available via this link:</p>
<p><a href="https://gist.github.com/fergusonjason/fa4794dc0dc5d45f7a7ed12296577ed5" rel="nofollow noreferrer">https://gist.github.com/fergusonjason/fa4794dc0dc5d45f7a7ed12296577ed5</a></p>
<p>I realize for actual science work most people wouldn't use Java, but this is for a project that is part of my Java portfolio.</p>

CC BY-SA 4.0
2022-03-27T18:28:24.470Z
Related, if not a duplicate: https://astronomy.stackexchange.com/q/39595/31410
WarpPrime
CC BY-SA 4.0
2022-03-30T02:28:00.493Z
I actually implemented a solution to this for an answer here: https://astronomy.stackexchange.com/a/48970/25729
Greg Miller
CC BY-SA 4.0
2022-04-23T13:35:49.913Z
@GregMiller I've done so as well, however I'm not one of the cool Python kids. See my edit.
Jason
<observational-astronomy><distances><positional-astronomy>
Compute Distance Between Stars
Jason
# Compute Distance Between Stars

(Asked by: username_0 on 2022-03-27)

If I have the following information about star A and Star B, how can I compute the distance between A and B?

* Distance from Sol for Star A
* Right Ascension/Declination of Star A
* Parallax/Absolute Magnitude of Star A
* Distance from Sol for Star B
* Right Ascension/Declination of Star B
* Parallax/Absolute Magnitude of Star B

I can use the parallax and absolute magnitude to compute distance from Sol, but I don't know how to get the distance between A and B.

Obviously there will be errors in the parallax, but I'm looking for a best effort means to calculate this.

**Edit**

I've implemented this in Java and made it available via this link:

<https://gist.github.com/fergusonjason/fa4794dc0dc5d45f7a7ed12296577ed5>

I realize for actual science work most people wouldn't use Java, but this is for a project that is part of my Java portfolio.

**Tags:** observational-astronomy, distances, positional-astronomy
> **Comments:**
> **username_1**: Related, if not a duplicate: https://astronomy.stackexchange.com/q/39595/31410  
> **username_2**: I actually implemented a solution to this for an answer here: https://astronomy.stackexchange.com/a/48970/25729  
> **username_0**: @GregMiller I've done so as well, however I'm not one of the cool Python kids. See my edit.  

---

## 3 answers

### Answer by username_6 on 2022-03-27. Score: 14 | Accepted answer

If you know the right ascension and declension of the stars, then you know the angle between them (ie the A-Sun-B angle). Working this out is an exercise in spherical trigonometry. The cosine of angular separation of the stars $\cos(C)$ is given by
$$\cos(C) = \sin(d\_a)\sin(d\_b) + \cos(d\_a)\cos(d\_b)\cos(r\_a-r\_b)$$

Where $d\_i$ is the declension of the star $i$ and $r\_i$ is the right ascension (in degrees or radians as necessary)

Then the distance between the stars is just an application of the cosine law.
$$c^2=a^2+b^2 -2ab\cos(C).$$ In which $a$ and $b$ are the distances to each star and $c$ is distance between the stars.

> **Comments:**
> **username_0**: Thank you. My trigonometry days are far behind me.  

---

### Answer by username_3 on 2022-03-28. Score: 5

Alternative approach:

Right ascension + declination + distance are spherical coordinates. Apply a standard conversion from spherical to rectangular coordinates and the distance calculation becomes easy.

> **Comments:**
> **username_4**: They're [spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system), not polar. And there are a couple different conventions for specifying the angles that make up a spherical coordinates (not to mention that spherical coordinates tend to use a polar angle, whereas declination is measured from the reference plane)., so it probably would be best to include the actual calculations.  
> **username_3**: @notovny Yeah, I used the wrong word, but the idea is valid--the calculation is easy if you transform the coordinate system.  

---

### Answer by username_5 on 2022-03-28. Score: 0

The really, really easy way to find the distances between two stars with kown directions and distances from Earth is to use an application which calculates those distances.

See:

[What is the closest stellar neighbour to Sirius?](https://astronomy.stackexchange.com/questions/45105/what-is-the-closest-stellar-neighbour-to-sirius/45135#45135)

In my answer I say that my first impression is that Procyon would probably be the closest stellar neighbor to Sirius. Then I investigate a few stars, listing their differences in angles from the right ascension and the declination of Sirius, and also by how much their distances from Earth differ from that of Sirius.

And then I tried using an app which calculates the distance between two stars. And of all the star pairs I tried, Procyon was the closest to Sirius according to that online app.

<https://www.wolframalpha.com/widgets/view.jsp?id=1ece06643e87f3c4d90813af5ee12223>


---

