# Find spherical coordinates from which to define great circle

I've found a formula for defining a great circle (since it's the set of points $$(\theta, \varphi)$$ such that their distance is $$\pi/2$$ from a given point $$(\theta_0, \varphi_0)$$):

$$-\tan(\varphi)\tan(\varphi_0) = \cos(\theta_0 - \theta).$$

Now, I have two points on the sphere $$(\theta_1,\varphi_1),(\theta_2,\varphi_2)$$. I want to use them to define a great circle, but to do that, I need to use those two points in some way to derive $$(\theta_0, \varphi_0)$$ (either one of the two possibilities assuming the two points aren't antipodal or equal). How can I do so (whether using the above formula or another part of spherical geometry)?

Note: I want to do this entirely with spherical geometry and spherical coordinates if possible. I know that there's a very easy way to do it: simply take the cross product of the 3-dimensional vector representation of the two points and normalize it. But I'm also doing a lot of other things in spherical coordinates and so hopefully a spherical geometry solution will help me with other similar problems.

## 1 Answer

If $$\varphi_1=\pm\frac\pi2,$$ if $$\varphi_1=\pm\frac\pi2,$$ or if $$\theta_1 - \theta_2$$ is an integer multiple of $$\pi$$ then you know $$\varphi_0=0$$ and you can easily find $$\theta_0$$ if it is determined. If $$\varphi_1=0$$ (or if $$\varphi_2=0$$) then you know that $$\theta_0 = \theta_1 \pm \frac\pi2$$ (or $$\theta_0 = \theta_2 \pm \frac\pi2,$$ respectively) and can then easily find $$\varphi_0$$ if it is determined.

Now let's assume a case in which none of the conditions above is true. This implies that $$\tan\varphi_0\neq 0.$$

You know that if your great circle's pole is at $$(\theta_0,\varphi_0)$$ then your two points must satisfy the equations

\begin{align} -\tan\varphi_1\tan\varphi_0 &= \cos(\theta_0 - \theta_1) = \cos\theta_0\cos\theta_1 + \sin\theta_0\sin\theta_1, \tag1\\ -\tan\varphi_2\tan\varphi_0 &= \cos(\theta_0 - \theta_2) = \cos\theta_0\cos\theta_2 + \sin\theta_0\sin\theta_2. \tag2 \end{align}

Cross-multiply Equation $$(1)$$ and Equation $$(2)$$ to get $$-\tan\varphi_1\tan\varphi_0 (\cos\theta_0\cos\theta_2 + \sin\theta_0\sin\theta_2) = -\tan\varphi_2\tan\varphi_0 (\cos\theta_0\cos\theta_1 + \sin\theta_0\sin\theta_1).$$

Since $$\tan\varphi_0\neq 0,$$ divide by $$-\tan\varphi_0$$ on both sides and distribute the multiplication to get $$\tan\varphi_1 \cos\theta_0\cos\theta_2 + \tan\varphi_1 \sin\theta_0\sin\theta_2 = \tan\varphi_2 \cos\theta_0\cos\theta_1 + \tan\varphi_2 \sin\theta_0\sin\theta_1.$$

Collect terms in $$\cos_0$$ and $$\sin_0$$: $$(\tan\varphi_1 \cos\theta_2 - \tan\varphi_2 \cos\theta_1) \cos\theta_0 = (\tan\varphi_2 \sin\theta_1 - \tan\varphi_1 \sin\theta_2) \sin\theta_0.$$

Since $$\varphi_1,$$ $$\varphi_2,$$ $$\theta_1,$$ and $$\theta_2$$ are all known, you now have an equation of the form $$k_1 \cos\theta_0 = k_2 \sin\theta_0$$ for known $$k_1$$ and $$k_2$$ and you can solve for $$\theta_0.$$ For example, if $$\tan\varphi_2 \sin\theta_1 - \tan\varphi_1 \sin\theta_2 \neq 0$$ then you can set $$\theta_0 = \arctan\left(\frac{\tan\varphi_1 \cos\theta_2 - \tan\varphi_2 \cos\theta_1} {\tan\varphi_2 \sin\theta_1 - \tan\varphi_1 \sin\theta_2}\right).$$

Once you know $$\theta_0$$ you can use it to solve for $$\varphi_0$$ in one of equations $$(1)$$ or $$(2).$$