Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is probably a too simple question for this site, but I would really appreciate any answers.

Lets say I've got a sphere with radius $r = 70$ meters. This sphere has an Earth-like reference system in which coordinates are given as: (longitude, latitude). The coordinate system is exactly like the Earth's, so zero degrees latitude is on the "equator" of the sphere with $90$ degrees being the top or "North pole" of the sphere, and $-90$ degrees being the bottom or "South pole" of the sphere. Also, I've got one vertical line on which positive numbers go "East" and negative numbers go "West". On this sphere I've got two points with their location, both depicted in degrees: $$ \begin{gather} (1, 1)\\ (3, 3) \end{gather} $$ Both points are drawn in the image I've drawn below. In this image, I've also drawn some "help-lines".

enter image description here

I now need to find the length of $d$ (the distance between the two points). So far I can calculate the variables $a$ and $b$, and I know that $D$ (the corner opposite of $d$) is 90 degrees.

To calculate the distance of $d$ I use the Spherical law of cosines (wiki here): $$ \cos(d) = \cos(a) * \cos(b) + \sin(a) * \sin(b) * \cos(D) $$

Since we are using an Earth like reference system, however, the latitude range is $[-\frac{\pi}{2}, \frac{\pi}{2}]$ instead of $[0, \pi]$ and the longitude range is $[-\pi, \pi]$ instead of $[0, 2\pi]$. I read that we therefore need to translate this law to the following: $$ \cos(d) = \sin(a) * \sin(b) + \cos(a) * \cos(b) * \cos(D) $$

Since the spherical law of cosines needs all variables in radians but our points on the sphere are given in degrees, I first transform the degrees to radians: $$ \begin{align} a &= (3 - 1) * \frac{\pi}{180} = 0.0349065850399\\ b &= (3 - 1) * \frac{\pi}{180} = 0.0349065850399\\ D &= 90 * \frac{\pi}{180} = 1.5707963267948966 \end{align} $$

Filling this into the formula I get the following: $$ \begin{gather} \cos(d) = \sin(a) * \sin(b) + \cos(a) * \cos(b) * \cos(D) = 0.00121797487009\\ d \text{ in radians} = 1.56957835162\\ \text{distance in meters} = d * 70 = 109.870484614 \end{gather} $$

The python code with which I calculate this can be found here:

The answer I get here seems to be incorrect though. First of all, a distance of 109 meters between two points which are only two degrees apart on a sphere with a diameter of 140 meters seems like a lot to me. Second of all, if I move the points closer to each other, the distance_in_meters seems to increase. Thirdly, I found this little piece of python code (here), in which they seem to do it differently. They simply take the latitude of the first and second point as the variables 'a' and 'b', instead of the difference between the latitudes as 'a'.

So my question. What am I doing wrong here? What is the mistake I make?

[EDIT] I simplified the question and inserted an image[/EDIT]

share|cite|improve this question
Welcome to math.SE: I have tried to improve the readability of your question by introducing Tex. It is possible that I unintentionally changed the meaning of your question. Please proofread the question to ensure this has not happened. For some more basic information about writing math at this site see e.g. here, here and here. – A.P. Apr 22 '13 at 19:02
@A.P. - Thanks for the welcome and the edit. As far as I can see your edits didn't change the formulas as such. Thanks for the edit and the links. I'll go over them to learn more about it. Would you by any chance also know if my calculations are correct? – kramer65 Apr 22 '13 at 20:00
First of all, I erroneously changed the last 'C' in 'c' (thinking it was a typo). Could you please change it back? I can't change less than 6 (I think) characters. As for your question: from the proof with vectors of the law of cosines, it looks like it doesn't depend on the coordinate system, so I don't think that your second formula is correct. Could you please cite your source for it? – A.P. Apr 23 '13 at 8:30
You can read about Poincare metric. – mez Apr 23 '13 at 9:02
Sorry, I wasn't clear. I'd like to know where you "read that we therefore need to translate this law to the following". I can't seem to be able to find the second formula on the linked Wikipedia page. – A.P. Apr 23 '13 at 9:10
up vote 2 down vote accepted

The spherical law of cosines is about spherical triangles with side lengths $a$, $b$, $c$ (measured along arcs of great circles), and angles $\alpha$, $\beta$, $\gamma$. Your $a$, in whatever units it is measured, is not such a side.

Instead of the triangle in your figure you should consider the spherical triangle with vertices $A=(\phi_1,\theta_1)$ ($(1^\circ,1^\circ)$ in your example), $B=(\phi_2,\theta_2)$ ($(3^\circ,3^\circ)$ in your example), and the north pole $D$. The sides $a$ and $b$ of this triangle (which are not the $a$, $b$ of yours) lie on meridians, i.e., great circles, and you know their lengths, namely $a={\pi\over2}-\theta_2$ and $b={\pi\over2}-\theta_1$. Furthermore you know the angle $\delta=\phi_2-\phi_1$ at $D$ (this is the "real" $a$ of yours!). These data suffice to compute the side $d$ by means of one of the spherical cosine laws. The formula in question is $$\cos d=\cos a\ \cos b+\sin a\ \sin b\ \cos\delta\ .$$ Finally we express $a$, $b$, and $\delta$ by the given quantities $\phi_i$, $\theta_i$: $$\cos d=\sin\theta_1\ \sin\theta_2+\cos\theta_1\ \cos\theta_2\ \cos(\phi_2-\phi_1)\ .$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.