# Finding angle between two points on the surface of a sphere.

1. Feb 13, 2013

### yungman

If I specify the latitudes and longitudes of both point A and B on the surface of a unit sphere, how can I find the great circle angle between the two points?

Say if Latitude and longitude of A is $\epsilon_1 \;\hbox { and }\;\tau_1$ respectively. Latitude and longitude of B is $\epsilon_2 \;\hbox { and }\;\tau_2$ respectively. How do I find the angle between A and B?

I know in spherical trig.,

$\frac {\sin A}{\sin a}\;=\;\frac {\sin B}{\sin b}\;=\;\frac {\sin C}{\sin c}$

$\cos a\;=\;\cos b \cos c-\sin b\sin c\cos A$

I know how to find the great circle angle for each point as they both form a right angle spherical triangle. I don't have enough to find the great circle angle between the two points because they don't form a right angle spherical triangle. I found this:

http://en.wikipedia.org/wiki/Great-circle_distance

Can anyone explain how the equation come about?

Thanks

Last edited: Feb 13, 2013
2. Feb 13, 2013

### Simon Bridge

You mean the angle at the origin (being the center if the Earth?)
How would you normally find the angle between two vectors?

3. Feb 13, 2013

### yungman

Thanks for the reply. So in spherical coordinates, if latitude is 2ε and longitude is 2$\tau$, then

$\phi=2\tau$, $\theta=\frac{\pi}{2}-2\epsilon$

Is this correct?

4. Feb 15, 2013

### Simon Bridge

I'm sorry:
- if you don't answer questions I cannot help you.
-i f you want to know if something is correct, you'll have to explain your reasoning.

5. Feb 16, 2013

### yungman

I since verified already. Latitude is measuring from equator ( z=0 on rectangular coordinates). θ is measure from the z axis at x=y=0. Whereby $\theta=\frac {\pi}{2}-2\epsilon$.

Say I used

$\hat{OP}=\hat x \cos\phi sin(\frac {\pi}{2}-2\epsilon)+\hat y \sin\phi sin(\frac {\pi}{2}-2\epsilon)+\hat z \cos(\frac {\pi}{2}-2\epsilon)$

to solve the equation, I got the equation given by the Wikipedia link. That was a very good tip by you, all the books using Spherical Trigonometry to solve these kind of problem, you reminded me that I can just use Spherical Coordinates to do all the calculation. I spent two week digging around, listening to the youtube video on spherical geometry and I don't even have to use it anymore. Well, I guess I can't call that waste of time, but it sure take me two weeks as it is not easy to find good article on spherical trig. like the other more common type math. The light bulb lighted up BIG TIME the moment you mentioned Spherical Coordinates!!!

Thanks

Alan

6. Feb 16, 2013

### Simon Bridge

Well done - after that all you need to realize is that the two points on the surface, and the origin, form a big triangle where you know the length of two of the sides. The actual coordinate system doesn't matter though - you could have converted them to cartesian to get two (x,y,z) points you are familiar with.

7. Feb 16, 2013

### yungman

Yes, I miss spoked. It is rectangle coordinates in every sense, not spherical coordinates. Only difference is the scalar amplitude of the x, y and z components are represented by the radius components of the spherical coordinates by using $\theta \;\hbox { and }\;\phi$.

Spherical coordinates is very different where $\hat {\phi}\;\hbox { and }\;\hat {\theta}$ has to be referenced back to the original position vector. ie, two position vectors have their own $\hat {\phi}\;\hbox { and }\;\hat {\theta}$. That's the reason spherical coordinates representation of a position vector has no θ and ∅ components, only R component with the given θ and ∅.

8. Feb 16, 2013

### Simon Bridge

That last but does not make sense. A position vector in spherical coordinates is $\vec{r}=R\hat{r}+\Theta\hat{\theta}+\Phi\hat{ \phi}$ surely?
Otherwise how do you tell where on the sphere you are?

9. Feb 17, 2013

### yungman

From my understanding, position vector has no θ and ∅ component because position vector is from origin to a point in space. For example from origin to a point P is $\vec{OP}$. Only vector field has θ and ∅ component as a vector field at point P has directions (R,∅,θ) and magnitude for each component. A position vector has only R component with specified ∅ and θ to indicate the direction of the position vector.

I understand that

$\vec A\;=\;\hat x A_x+\hat y A_y+\hat z A_z\;=\;\hat R A_R+\hat {\phi}A_{phi}+\hat {\theta} A_{\theta}$

Where

$A_R=\vec A\cdot \hat R\;=\;A_x\cos\phi \sin\theta \;+\;A_y\sin\phi \sin\theta \;+\;A_z\cos\theta$

$A_{\phi}=\vec A\cdot \hat {\phi}\;=\;-A_x\sin\phi \;+\;A_y\cos\phi$

$A_{\theta}=\vec A\cdot \hat {\theta}\;=\;A_x\cos\phi \cos\theta \;+\;A_y\sin\phi \cos\theta \;-\;A_z\sin\theta$

You take any position vector in rectangular coordinates and transform into Spherical coordinates, the ∅ and θ components are always 0. For example, you plug in any constants into $A_x,\;A_y,\;A_z$ the θ and ∅ component are always zero. That's how position vector is. You cannot put x, y, z as variable in $A_x,\;A_y,\;A_z$ as this immediately turn it into a vector field. That you will have all three components.

Last edited: Feb 17, 2013
10. Feb 17, 2013

### Simon Bridge

in a vector field, a vector is assigned to each point in space. However, each point in that space can be pointed to by a vector which, in 3D, must have three components. The two angles you are calling "specified" with R, are the extra two components of the vector.

There are different ways to specify spherical coordinates and different ways to express an angle in spherical coordinates. Without the unit vectors attached to the angles, the size of the angle does not help.

11. Feb 17, 2013

### yungman

That's exactly what I was talking about. Vector field is a function of a point in space, it has all three components. BUT position vector is not a vector field. It is a vector from the origin to a point in space. It is a fixed vector. If you just translate $\vec A=\hat x 3+\hat y 4+ \hat z 5$ or with any constants to Spherical Coordinates, you'll see the θ and ∅ components disappeared.

Remember, $\vec A=\hat x (x+y)+\hat y (y+z)+ \hat z (x+z)$ is a vector field which is position dependent, this has all three components.

12. Feb 17, 2013

### Simon Bridge

Off your example: what is wrong with:
$\vec{A}=(7.0711)\hat{r}+(0.78540)\hat{\theta}+(0.92730)\hat{\phi}$
... the $\theta$ and $\phi$ components seem to be there.

To vanish, they'd have to both be zero... note: with a radial vector field, the angular components do, indeed, vanish and we can say stuff like $\vec{A}=A_r(r)\hat{r}$.

13. Feb 17, 2013

### voko

You do need three numbers to specify a point in a 3D space. If your numbers are the coefficients of the position's vector expansion over some basis vectors, and the basis vectors are those of the spherical coordinate system, then two of the numbers are identically zero. That's because the basis vectors are "co-moving". You still have to use two numbers to specify the orientation of the basis vectors, of course.

14. Feb 17, 2013

### Simon Bridge

I think for me to understand the difference you'll have to walk me through the expansion.
What was wrong with the expansion I did in the last post?

15. Feb 17, 2013

### vela

Staff Emeritus
The point (3,4,5) corresponds to $r = 5\sqrt{2}, \theta = \cos^{-1}(1/\sqrt{2}), \phi=\tan^{-1}(4/3)$, so we have
\begin{align*}
\cos\phi &= 3/5 \\
\sin\phi &= 4/5 \\
\cos\theta &= \sqrt{1/2} \\
\sin\theta &= \sqrt{1/2}.
\end{align*} The spherical basis vectors for that point are
\begin{align*}
\hat{r} &= \sin\theta\cos\phi\,\hat{i} + \sin\theta\sin\phi\,\hat{j} + \cos\theta\,\hat{k} =
\frac{1}{5\sqrt{2}}(3\hat{i} + 4\hat{j} + 5\hat{k}) \\
\hat{\theta} &= \cos\theta\cos\phi\,\hat{i} + \cos\theta\sin\phi\,\hat{j} - \sin\theta\,\hat{k} =
\frac{1}{5\sqrt{2}}(3\hat{i}+4\hat{j}-5\hat{k}) \\
\hat{\phi} &= -\sin\phi\,\hat{i} + \cos\phi\,\hat{j} =
\frac{1}{5}(-4 \hat{i} + 3\hat{j})
\end{align*} So $\vec{r} = r\,\hat{r} = 3\hat{i} + 4 \hat{j} + 5 \hat{k}$. There are no $\hat{\theta}$ and $\hat{\phi}$ components for the position vector.

Last edited: Feb 17, 2013
16. Feb 18, 2013

### Simon Bridge

Oh wow - now I get you.

17. Feb 18, 2013

### yungman

Hi Simon, Sorry, I am just very busy doing other things lately to dig deeper into this to reply your question the last two days. I have to put in the recess lighting, which, has nothing to do with here!!

I am not in a calculus class so I am really rusty and I have to review everything before I can reply. It's like "not in mid season condition!!!", everything is rusty, need a kick to get the wheel spinning!!!:rofl:. Like last time, it took one sentence from you to get the wheels turning for me!!! Thankfully Vela show the derivation.

But actually you make me thing about another scenario......We know that a position vector cannot have x, y, z as independent variables. But what if it contains variables that is function of....say time t. This means the position vector can trace out a path with time t that is not a vector field in the sense that it is position dependent. And at the same time, the vector is not a constant.

I still have to find time to think about this, the little time I have, I am still working on the inverse tangent question.

Thanks for all your help, I'll get back to the other question hopefully tonight.

Sincerely

Alan

18. Feb 18, 2013

### Simon Bridge

It's all right - as House would say "I'm an idiot!"
Of course any vector can be written $\vec{v}=v\hat{v}$ which is to say - it has magnitude v in the direction it is pointing in.

I can write $\vec{r}=(r,\theta ,\phi )^t$ because I can encode the spherical coordinates into a vector - but that is not a position vector because it does not transform as a position vector should. What was wrong with my previous derivation was that I forgot to transform the unit vectors.

Thanks for sticking with me.
I was just having a moment of concept blindness.

19. Feb 19, 2013

### yungman

What are you talking about, you are of great help!!!

Thanks

20. Feb 19, 2013

### Simon Bridge

... yeah, thinking of lat-long as spherical coordinates was the lynchpin for you ... and then I got sidetracked. Now worries ... enjoy.