Given two points on a unit sphere, there is a unique great circle passing through the two points. This post will show two ways to find a parameterization for this circle.

Both approaches have their advantages. The first derivation is shorter and in some sense simpler. The second derivation is a little more transparent and generalizes to higher dimensions.

Let the two points on our sphere be **v** and **w**. If these two vectors are orthogonal, then the great circle connecting them is given by

cos(*t*) **v** + sin(*t*) **w**.

The problem is that **w** might not be orthogonal to **v**. So the task is to find a new vector **u** in the plane spanned by **v** and **w** that *is* perpendicular to **v**.

## Cross product

The cross product of two vectors in three dimensions is perpendicular to both. So

**z** = **v** × **w**

is orthogonal to **v** and **w**. So

**y** = **z** × **v**

is perpendicular to **v** and lives in the same plane as **w**. So **y** is the vector we’re looking for, except that it might not have unit length. (In fact, it’s probably too short. It will have length equal to sin θ where θ is the angle between **v** and **w**. If sin θ were 1, then **v** and **w** were orthogonal and we wouldn’t need to go through this exercise.)

So we need to normalize **y**, setting

**u** = **y** / || **y** ||.

This solution is quick and simple, but it obscures the dependence on **w**. It also only works in 3 dimensions because cross product is only defined in 3 dimensions.

If you look back, we used the fact that we’re working in ℝ³ when we argued that **y** was in the plane spanned by **v** and **w**. In more dimensions, we could find a vector **z** perpendicular to **v** and **w**, and a vector **y** perpendicular to **z** but not in the plane of **v** and **w**.

## More general solution

We need to find a unit vector **u** in the space spanned by **v** and **w** that is orthogonal to **v**. Since **u** is in the space spanned by **v** and **w**,

**u** = *a* **v** + *b* **w**,

for some *a* and *b*, and so a parameterization for our circle is

cos(*t*) **v** + sin(*t*) (*a* **v** + *b* **w**).

We just need to find *a* and *b*. An advantage of this approach over the approach above is that the vector **w** is explicit in the parameterization.

Also, **v** and **w** could be vectors on some high-dimensional unit sphere. Even if **v** and **w** live in 100 dimensions, the subspace they span is two-dimensional and everything here works.

Since **u** is orthogonal to **v**, we have

**u** · **v** = (*a* **v** + *b* **w**) · **v** = *a* + *b* cos θ = 0

where the angle θ between **v** and **w** is given by

cos θ = **v** · **w**.

We can obtain another equation for *a* and *b* from the fact that **u** is a unit vector:

*a*² + *b*² + 2 *ab* cos θ = 1.

The solution to our system of equations for *a* and *b* is

*a* = ± cot θ

*b* = ∓ csc θ

and so an equation for our circle is

cos(*t*) **v** + sin(*t*) (cot θ **v** − csc θ **w**).

Very nice write-up! I just wanted to add that you don’t need to go into angles in that last parameterization. Instead you can subtract the projection of w onto v from w. That is u=w-(w*v)v where * is the dot product. Then v*u=v*w-w*v=0 (Since v is on the unit sphere v*v=1).