Geodesics Using Mathematica
Geodesics Using Mathematica
Volume 3
Article 3
Issue 1
Recommended Citation
Lewis, Jacob (2002) "Geodesics Using Mathematica," Rose-Hulman Undergraduate Mathematics Journal: Vol. 3 : Iss. 1 , Article 3.
Available at: https://scholar.rose-hulman.edu/rhumj/vol3/iss1/3
1
Jacob Lewis*
Columbia University
coordinate patch, geodesic, etc. This summary closes with a proof of the length-
examples. The surfaces chosen include some with Clairaut patches, some
*
The author wishes to thank Professor Charles Doran for his gracious help.
2
straight line.” This is certainly true on the plane, but on other surfaces the adage
proves to be false. For example, assume the earth to be a sphere. New York
City and Madrid, Spain are both at latitudes of about 40°N. Yet an airplane
taking the shortest distance between the two does not follow the 40th parallel.
Rather, it arcs north, following the great circle (i.e., circle centered at the sphere’s
To generalize the adage--and along the way to explain why planes travel
geodesics. Geodesics have the useful property that the shortest curve segment
great circles are geodesics on the sphere, and they therefore have the property
that they are the "shortest" curves on the sphere. To examine geodesics, we will
vector calculus. In order to see geodesics, even when they cannot be found
Differential Geometry
R³ that locally look like a plane-that is, given any point on the surface, there is a
small neighborhood of that point which appears to be planar. Again, the earth’s
surface taken as a sphere is a good example. The earth’s surface curves, yet by
looking around, one cannot see this curvature. This is because the area of the
earth one can see is a small enough neighborhood of the point where he/she is
3
standing that this neighborhood appears flat. So the sphere is a surface in R³.
More technically,
valid definition. In fact, some of the surfaces we will examine cannot be placed in
R3.
xu × x v
zero. This means it is possible to construct a unit normal U = at any
xu × x v
above is orthogonal. xu = (-r sin(u) cos(v), r cos(u) cos(v), 0), and xv = (-r cos(u)
1
(cos 2 (u ), cos( u ) sin( u ), sin( v ))
cos (u ) + sin ( v )
2 2
, as the reader can easily verify
x(u0, v0) = p. Then, the tangent plane to M at p-denoted by TpM-is the two
dimensional vector space spanned by {xu(u0, v0), xv(u0, v0)}. It is fairly easy to
show that this space is equivalent to the space of all vectors v such that v =
α’(t0), where α is a curve on M with α(t0)=p (see [3]). Since TpM is a vector space,
essentially the extensions into M of straight lines in the plane—that is, relative to
Since α’’ is always normal to M, that means that the dot product of α’’ and a
vector in in TpM is always zero. In particular, α’’ • α’ = 0. Let s(t) be the speed of
α ′′(t ) • α ′(t )
(1) s′(t) = =0
α ′(t ) • α ′(t )
unit-speed.
∂x ∂x
α′= u ′( t ) + v ′( t ) = x u u ′ + x v v ′
∂u ∂v , and so
So, using (2) and (3) and the fact that xu•xv = 0 yields the differential system
which a curve must satisfy to be a geodesic. These two equations are called the
Proof: Let γ(t)=x(u(t), v(t)). Then γ(0)=p gives initial conditions u(0) and
v(0). γ′(0)=v gives initial conditions u′(0) and v′(0). Then, by the
6
If every geodesic can be extended infinitely without leaving the surface, then the
give a Mathematica procedure for this below. On a few surfaces, such as the
sphere, explicit solutions can be found. One class of surfaces for which the
geodesic equations can often be explicitly solved are surfaces given a Clairaut
patch. A Clairaut patch is an orthogonal patch in which |xu| and |xv| are both
∂
independent of v. This implies (x u • xu ) = 2x uv • x u = 0 and
∂v
∂
(x v • x v ) = 2x vv • x v = 0 , or simply xuv•xu = xvv•xv = 0. Also, since xu•xv = 0,
∂v
∂
(x u • x v ) = x uu • x v + x u • x uv = x uu • x v = 0 . Therefore, the geodesic equations
∂u
d 2v ∂G
(8) dt = v ′′ = −2u ′ x uv • x v = − du ∂u , where G= x •x .
2
v v
dv v′ xv • xv dt G
dt
7
Integrating both sides of (8) with respect to t, and making the substitution w =
dw G dG
dv/dt, ∫ w
= − ∫ u du = − ∫
G G
⇒ ln v′ = − ln G + c . Taking the exponential of both
dv k
(9) = v′ =
dt G
for some constant k. Now we use the fact that we may assume the geodesic α(t)
k2
1 = α ′ • α ′ = (x u u ′ + x v v′) • (x u u ′ + x v v′) = xu u ′ + Gv′ = xu u ′ +
2 2 2 2 2
, or
G
du G − k2
(10) = u′ = ± 2
dt xu G
2
dv xu k 2
Dividing (9) by (10) gives =± , and integrating this yields
du G2 − k 2 G
2
xu k 2
(11) v = ±∫ du
G2 − k 2 G
If for a particular surface with a Clairaut patch, the integral on the right-hand side
of (11) can be solved explicitly, this gives an explicit solution to the geodesic
equations for this surface. If |xu| and |xv| are independent of u, then the patch is
shortest curve between two points might not exist if the surface is not
Now, for any point p on a surface M, there exists a small neighborhood N(p) of M
around p for which we can give a patch x(u,v), called the geodesic polar patch,
Details of how to define this patch are given in [4]. For q in N(p), there is a
If q = x(u0, v0), then this geodesic, called the “radial geodesic,” is given by g(u) =
Theorem: For each point q in N(p), the radial geodesic from p to q is the
v0). Then, γ(u) = x(u, v0). Let α be an arbitrary curve from p to q. Assume
discard the loops, thereby shortening α. Therefore, we can write α(u) = x(a1(u),
a2(u)), with 0 ≤ u ≤ u0. Since x(a1(0), a2(0)) = x(0, 0) = p, and x(a1(u0), a2(u0)) =
x(u0, v0) = q, we see that a1(0)=a2(0)=0, a1(u0)=u0, and a1(v0)= v0. Since E=1
u0 u0
u0
u0 u0
∫ a1′ + Ga 2′ du = ∫ a1′du = u 0 , so
2 2
(7)
0 0
a1′ 2 + Ga ′22 = a1′ . Then, since G > 0, a2’ = 0. So a2 = v0, which implies that α(u) =
smallest length. !
give the shortest path between two points on the plane, geodesics perform this
function on arbitrary surfaces. In a very real sense then, geodesics are the
abstraction of the notion of a line to other surfaces. (Indeed, the theorem implies
built-in function named NDSolve, and it can graph a parametrized surface using
study surfaces is [2], which includes a handy appendix giving the Mathematica
10
code necessary to make many surfaces and curves, and to do various other
matter. First, input the equation for the patch. To input a function, the argument
colon precedes the equals sign. For example, to define the sphere, the
graph is all black.) It may be convenient to view the surface from a particular
ViewPoint->{x,y,z} is added.
equations increases as the order of the system increases. For this reason, it is
u ′ = p
v' = q
−1
p ′ = 2
(x uu • x u p 2 + 2x uv • x u pq + x vv • x u q 2 )
xu
−1
q ′ = 2
( )
x uu • x v p 2 + 2x uv • x v pq + x vv • x v q 2
xv
(12)
11
Figure 1
Figure 2
points. In the following code in Figure 3, the variables {u0, v0} represent the
starting point of the geodesic; ang gives the initial direction of the geodesic,
which combined with the fact that the geodesic is unit-speed, gives the initial
12
velocity. Therefore, {u0, v0} and ang give the necessary initial conditions to
Figure 3
Take[..., {a,b}] selects the ath through bth elements of a list and outputs
them in another list; First[...] gives the first element of a list as a number.
To display the solution on a surface, two different plots are made and
g1=ParametricPlot3D[Evaluate[Append[x[u[t],
{t,0,tfin}],
v2}, Lighting->True].
geodesic, and often requires trial and error. Now, we give specific examples of
The Sphere
For the patch for the sphere, we see that G = xu ● xu = r2, and E = xv ● xv
= r2cos2u, so the patch for the sphere is a v-Clairaut patch. So, using a unit
E −k2 cos 2 v − k 2 k
sphere for simplicity, v ′ = = 2
and u ′ = . So
EG cos v cos 2 v
k k tan v
u=∫ = sin −1 ( ) + c . This implies
cos v cos 2 v − k 2 1− k 2
k k tan v 1− k 2
u=∫ = sin −1 ( ) + c , and so sin(u − c) = tan v ⇒
cos v cos 2 v − k 2 1− k 2 k
1− k 2 1− k 2
sin(u − c) cos v = sin v ⇒ (sin u cos c − cos u sin c )cos v = sin v ⇒
k k
cos c 1 − k 2 sin c 1 − k 2
(13) sin u cos v − cos u cos v = sin v
k k
Note that the components of the patch for the sphere are here in this last
equation. Setting x = cosu cosv, y= sinu cosv, z = sinv, we see that equation
(13) implies that the points all lie on the same plane. So a geodesic on a sphere
Moreover, note that if a point (x, y, z) on the sphere satisfies (13) so too
does (-x, -y, -z). So if the plane in question includes (x, y, z), it includes (-x, -y, -
z). Hence it includes the line between them, and therefore the plane passes
through the origin. So a geodesic on the sphere is the intersection of the sphere
and a plane passing through the origin—a great circle! Choosing two points that
14
are not antipodal—that is, not on opposite sides of the sphere—allows one to
Using the Mathematica procedure above verifies the fact that the
sphere.
Figure 4
Returning to the example of a plane flying from New York City to Madrid,
we can now plot its path and find the distance that it will travel. Madrid is located
at 40û 26ý = 40.43û North latitude and 3û 42ý = 3.70û West longitude; New York
City is at 40û 47ý = 40.78û North latitude and 73û 58ý = 73.97û West longitude,
according to [5]. The patch given for the sphere is called the “geographical
patch” because the point x(u,v), u and v give the latitude and longitude when
converted into degrees. u gives longitude; a positive value is East longitude, and
latitude. This means that New York = x(-73.97 π/180, 40.78 π/180), and Madrid
= x(-3.70 π/180, 40.43 π/180). Since the geodesic segment between them is an
15
arc of a great circle, the length of this arc is rθ, where r is the radius of the earth
and θ is the angle between the vector from the center of the earth to New York
and the vector from the center of the earth to Madrid. Using Mathematica we can
find θ by
This gives θ = 0.904385. The radius of the earth can be estimated as 6378 km
(3963 miles). So the distance from New York to Madrid along the shortest path
is 5768.17 km (3589.50 miles). The radius of the circle around the fortieth
parallel is 2
x NYC + y NYC
2
− z NYC
2
= 2443.48 km; the center of this circle is (0, 0,
4165.83). So the angle between the vector from the center of this circle to New
York and the vector from the center of this circle to Madrid (assuming for
angle = 1.22644, so the distance from New York to Madrid along the 40th parallel
The Cylinder
xu●xu = r2, xu●xv = 0, and xv●xv = 1, so this is clearly a Clairaut patch. Solving
the Clairaut integral for v in terms of u gives v = ku. Now, unit-speed implies 1 =
16
t kt
r2 u’2 + v’2 = (r2 + k2) u’2. So u (t ) = + c ⇒ v(t ) = + c , for some
r2 + k2 r2 + k2
t t kt
α (t ) = r cos + c , r sin + c , + c . This is the equation
r +k r +k r +k
2 2 2 2 2 2
of a helix. Two interesting degenerate cases are where the initial velocity is
horizontal (k=0)—in which case the geodesic is a circle going around the
cylinder—and where the initial velocity is vertical (k=∞)—in which case the
geodesic is a vertical line up the side of the cylinder. These cases and one non-
degenerate helical case are shown, using the Mathematica procedure, in Figure
5.
Figure 5
17
The torus of revolution is the surface formed by revolving a circle in the y-z
plane, which does not touch the z-axis, about the z-axis. The surface looks like a
doughnut. A patch for the torus of revolution is x(u, v) = ((a + rcosv) cosu, (a +
rcosv) sinu, rsinv). r here represents the radius of the circle being revolved; a
represents the distance from the circle to the z-axis. The case r=1, a=2 is shown
in Figure 6.
Figure 6
The patch here is a v-Clairaut patch. In fact, all surfaces of revolution admit a
Clairaut patch. If the curve being revolved is (g(v), h(v)), the patch is x(u,v) =
examples may be instructive. If the initial direction is π/2, the geodesic goes
Figure 7
If the initial point is above the largest circle around the outside of the torus, and
the initial direction is 0 (i.e. horizontal), then the geodesic turns downward to the
bottom of the torus, then turns upward to the top, then downward, and so on.
Figure 8 is an example.
Figure 8
As we saw with the torus of revolution, there are cases were with a
Clairaut patch no explicit equations for the geodesics can be found. If the patch
we are working with for a surface is not Clairaut, it becomes even less likely that
a search for explicit geodesics will be successful. For example, consider the
this surface the “Two-Banana” surface because it looks like two bananas meeting
Figure 9
or v-Clairaut. We can use the Mathematica procedure geo to get an idea of what
the geodesic equations look like in this case. The results, in Figure 10, are not
pretty.
Figure 10
Mathematica, however, can still graph the geodesics implicitly. If the geodesic
begins horizontally along the widest circle of a banana, it will go around that
circle as in Figure 11. If it begins vertically along the outermost part of a banana,
it will loop around both bananas as in Figure 12. In general, however, the
geodesics stay on one banana and have complicated shapes. For example,
Figure 13 shows the geodesic starting at u=0, v=0 and with initial direction π/4.
20
Figure 11
Figure 12
Figure 13
21
Thus far all the surfaces examined have been surfaces in R3. For
consider the hyperbolic plane. This is modeled as the upper half-plane U2, the
set of all (u, v) such that v>0. The properties of the plane, however, are different
from those of R2. Here, the inner product depends on where it is applied. If two
vectors w1 and w2 are applied at (u, v), w1◦w2=(w1●w2)/v2, where ◦ is the inner
product in U2, and ● is the standard dot-product in R2. The upper half-plane with
this inner product is called the Poincaré plane. So x(u,v)= (u,v), and xu(u,v) =
(1,0), but xu(u,v) ● xu(u,v) = 1/v2, and xv(u,v) = (0, 1/v), but xv(u,v) ● xv(u,v) =
2
k k2 1 c
u=∫ dv ⇒ ku = ∫ dv ⇒ ku = −v 2 − k 2 + c ⇒ k 2 u − = 1 − k 2 v 2 ⇒
1 1 v k
2
−k2 −k 2
v v2
2
1 c
= v 2 + u − . This gives the equation of a circle with radius 1/k centered at
k
2
k
(c/k, 0). Since we are dealing with the Poincaré plane, the geodesics are the
upper halves of these circles. The initial conditions determine k and c. In the
Given two points (u1, v1) and (u2, v2) in the Poincaré plane, if v1 = v2, then
they are connected by a vertical half-line but by no circle. If v1 ≠ v2, then the only
geodesic passing through (u1, v1) and (u2, v2) is the half-circle centered at
u 22 − u12 + v 22 − v12
,0 with radius v2
−
(u 2
1 − 2u1u 2 + u 22 − v12 + v 22 )
2
. This geodesic
2(u 2 − u1 ) 4(u 2 − u1 )
1 2
Figure 14
For example, Figure 15 shows the geodesic in the Poincaré half-plane passing
Figure 15
Conclusion
surfaces, it is no less fundamental. For this reason, it is critical to know what the
References
[4] Oprea, J. Differential Geometry and Its Applications. Upper Saddle River,