# Equation of a great circle passing through two points

I've searched everywhere for something to help me with this problem, but I can't find anything. What I want to calculate is the midpoint between two locations (latitude and longitude) on a sphere. The midpoint must lie on the shortest path between them. And for this, I need the equation of the great circle on this sphere that passes through these two points.

What I tried to do is first start with an arbitrary great circle given by the following parametric equation:

${x=0}$

${y=cos\space \theta}$

${z=sin\space \theta}$

Or:

$\left( \begin{array}{} 0 \\ cos\space \theta \\ sin\space \theta \end{array} \right)$

Then if we multiply this vector by three rotation matrices $R_x, R_y,$ and $R_z$ about angles $\alpha, \beta,$ and $\gamma$, and then solve the equations for the rotation angles using our known values of the radius and the coordinates of the two points, we should get the exact equations of this circle in 3D space, but the trigonometric equations are extremely messy and I'm not sure if my assumption is correct.

There must be a statement of the equation somewhere but I just can't find it. What is it?

Perhaps a simpler method would be to calculate the midpoint in geographic coordinates and then convert them to cartesian, but I'm not sure how geometry works in geographic coordinates.

• I have worked out the explicit expressions in $(r,\theta)$ of points, geodesics, laplacian, and almost everything else on sphere, where $(r,\theta)$ are local coordinates on the stereographical projection of the sphere minus $N$ onto $R^2.$ If you're desperate enough to want it, tell me! – Behnam Esmayli May 13 '16 at 13:40
• @Behnam Yes it can be found using stereographical projection. But as long as Hex4869 needs this very specific resul, it's shorter, as he considers, to transform spherical -> cartesian -> doing the businness in cartesian -> back to spherical. – Jean Marie May 13 '16 at 14:28
• But, wait minute! If we use spherical $(\theta, \phi)$, won't the answer be the average of the two $\theta$'s and the two $\phi$'s? Just a guess. – Behnam Esmayli May 13 '16 at 16:02
• No risk. Of course, if $(\theta_k,\lambda_k) \ k=1,2$ are not far away one from the other, we know that the result will not be very different from the average you are speaking about. – Jean Marie May 14 '16 at 7:38

In the following, we consider that we are working on a unit sphere.

If your longitude and latitude coordinates are $(\theta_k,\lambda_k) \ k=1,2.$ Let

$$V_1=\begin{bmatrix}\cos \theta_1 \cos \lambda_1 \\ \sin \theta_1 \cos \lambda_1 \\ \sin \lambda_1 \end{bmatrix} \ \ \ V_2= \begin{bmatrix}\cos \theta_2 \cos \lambda_2 \\ \sin \theta_2 \cos \lambda_2 \\ \sin \lambda_2 \end{bmatrix}$$

Set $V_3=V_1+V_2$, and $V_4=\dfrac{V_3}{\|V_3\|}$: it is the desired point. Let $(a,b,c)$ be its coordinates.

It remains to convert it back into its spherical coordinates :

$$\lambda = asin(c) \ \ \ \text{and} \ \ \ \theta = asin(\dfrac{b}{\cos \lambda})$$

• Wow, as simple as that? Thank you very much. – Hex4869 May 14 '16 at 6:36
• Elegant solution. Given the reasoning is not explained, one way to think of this is that V_3 is the vector addition of V_1 and V_2 so will point in the direction of the mid point. V_4 normalises V_3 so it lies on the unit sphere, and so is the projection of the mid point onto the unit sphere. Also note that the normal order for longitude and latitude is latitude-longitude. – Obromios Oct 25 '17 at 15:38
• An ugly formula completely in spherical coordinates: mathematica.stackexchange.com/questions/180422/… – barrycarter Aug 22 '18 at 15:27