Predicting Sunrise and Sunset Times
Donald A. Teets ([email protected]), South Dakota School of Mines and Tech-
nology, Rapid City, SD 57701
For a given location and day of the year, can you predict the times of sunrise and
sunset? Although the solution to this problem is somewhere between old and ancient,
the standard solution requires the understanding of a considerable number of prelim-
inary ideas from celestial mechanics. The following approach uses only simple tools
from trigonometry and analytic geometry to produce a fairly good set of approxima-
tions for sunrise and sunset times. One can leave it at that and have a nice project
for average students or, for students with stronger backgrounds, one can pursue cer-
tain corrections that make these sunrise and sunset predictions quite accurate. These
corrections can be studied at any level from a simple “Here’s the source of the error
and here’s a term that we can add on to fix it,” to a more complete analysis involving
Fourier sine series and a deeper understanding of celestial mechanics.
Observer at (x0,y0,z0)
• L
y
r (xs,ys,zs)
⍜p rp
⍜
r sin⍜
(xs,ys,0)
Sun’s position on
x first day of spring
Figure 1. The earth and sun in the geocentric equatorial coordinate system.
In the geocentric equatorial coordinate system of Figure 1, the x y-plane contains
the earth’s equator, with the positive x-axis chosen so that it passes through the sun’s
center on the first day of spring. The angle = 23.45◦ (0.409 radians) is the inclination
between the x y-plane and the ecliptic plane containing the earth’s orbit about the sun.
At noon on the day of our observation, the sun appears directly over the observer’s
meridian at xs , ys , z s . If θ p is the angle between the projection vector xs , ys , 0 and
the positive x-axis, L is the observer’s latitude, and R = 6378 km is the radius of the
earth, then the observer’s position (at noon) will be
x0 = R cos L cos θ p , y0 = R cos L sin θ p , z 0 = R sin L . (1)
(This is just the standard spherical-to-rectangular coordinate conversion, with the ob-
servation that latitude is measured up from the x y-plane instead of down from the
z-axis as is usual in spherical coordinates presented in calculus texts.) Since the earth
rotates 2π radians in 1440 minutes (24 hours), the observer’s coordinates t minutes
from noon will be
2π
x0 = R cos L cos θ p + t ,
1440
2π
y0 = R cos L sin θ p + t , (2)
1440
z 0 = R sin L ,
VOL. 34, NO. 4, SEPTEMBER 2003 THE COLLEGE MATHEMATICS JOURNAL 317
Standard time meridian
Time zone extends roughly 7½˚ east …
…and 7½˚ west of meridian
Figure 2. Standard time meridian and corresponding time zone.
where t < 0 before noon and t > 0 after noon. We also note in Figure 1 that r is the
length of the earth-sun vector xs , ys , z s , θ is the angle between this vector and the
positive x-axis, and r p is the length of the projection xs , ys , 0 .
Up to this point there has been no mention of the observer’s location with respect
to time zones. We shall assume throughout this discussion that our observer is on a
standard time meridian ( i.e., east or west longitude 0◦ , 15◦ , 30◦ , etc.) each of which
corresponds roughly to the middle of a time zone. (See Figure 2.) For observers not on
such a meridian, sunrise and sunset times must be adjusted by 1440 minutes/360◦ = 4
minutes per degree of longitude, with earlier sunrises and sunsets as one moves east,
later as one moves west within a time zone.
Though the vector x0 , y0 , z 0 was introduced as the location of our observer, it also
can be thought of as a normal vector for the plane tangent to the earth’s surface at the
observer’s location. Hence, the equation of this tangent plane is
x0 (x − x0 ) + y0 (y − y0 ) + z 0 (z − z 0 ) = 0.
Since the tangent plane provides a local approximation of the earth’s surface at the ob-
server’s location, the sun lies below this plane (from the observer’s perspective) before
sunrise and above the plane after sunrise. At sunset, the sun moves from just above to
just below the plane. Therefore, the sunrise and sunset times can be approximated as
the times at which the center of the sun lies in the tangent plane, that is, the times at
which
x0 (xs − x0 ) + y0 (ys − y0 ) + z 0 (z s − z 0 ) = 0.
Since x02 + y02 + z 02 = R 2 , we obtain
x0 xs + y0 ys + z 0 z s = R 2 .
Substituting the values x0 , y0 , z 0 in (2) into this equation, we get
2π 2π
xs R cos L cos θ p + t + ys R cos L sin θ p + t + z s R sin L = R 2 . (3)
1440 1440
Using the angle addition formulas for sine and cosine and the relationships
xs ys
r p = r 2 − z s2 , cos θ p = , sin θ p = , and z s = r sin θ sin ,
rp rp
we can solve equation (3) for t, obtaining
1440 R − z s sin L
t0 = cos−1 .
2π r p cos L
318 c THE MATHEMATICAL ASSOCIATION OF AMERICA
This t0 value gives the number of minutes after noon that sunset occurs. Likewise,
−t0 solves equation (3) and represents the number of minutes before noon that sunrise
occurs. If we assume that the earth’s orbit is circular and use r = 149598000 km (the
earth’s mean distance from the sun), then
2π
θ= (d − 80),
365.25
where d is the day of the year. (This gives θ = 0 on the 80th day of the year, which
is the first day of spring.) Finally, since these computations are based on the location
of the center of the sun, a correction is needed to account for the length of time be-
tween sunrise (or sunset) and the moment the sun’s center is at the horizon. Experience
suggests replacing t0 by tˆ = t0 + 5 minutes.
Example. June 10 is the 161st day of the year. Therefore, d = 161 and θ = 1.3934.
At L = 40◦ (0.698 radians) north latitude, z s = 5.8560 × 107 and r p = 1.3766 × 108 ,
and so the computed time value is t0 = 444 minutes. Thus, tˆ = 449 minutes, or 7
hours 29 minutes. Therefore, sunrise occurs at 4:31 am and sunset at 7:29 pm. The
sunrise time agrees exactly with that found in an almanac [1], and sunset time is off by
1 minute!
At this point, one can declare victory and leave it at that, but further computational
examples using different days of the year and different latitudes reveal that the error
is not always so small. In fact, errors as large as 28 minutes occur at some times of
the year, especially at high latitudes. So what is going wrong? One source of error is
fairly clear: according to Kepler’s first law, the earth’s orbit is elliptical, not circular,
so the value for r changes from day to day. And according to Kepler’s second law, the
vector from sun to earth sweeps out equal areas in equal times, so θ does not change
at a constant rate. But another (and, as it turns out, larger) source of error is an effect
known as the equation of time, which we now briefly describe.
M
f
M
Figure 3. Solar noon on successive days.
The essential idea in the equation of time is that the length of time between noon
(i.e., sun at its highest point) one day and noon the next is not constant. There are two
reasons for this variability, the first of which is illustrated in Figure 3. Here M denotes
the angle through which the earth moves from noon one day until noon the next, if we
assume constant speed in its orbit. Note that angle M also is the angle in excess of 2π
VOL. 34, NO. 4, SEPTEMBER 2003 THE COLLEGE MATHEMATICS JOURNAL 319
radians that the earth must rotate in order for the sun to be directly overhead again. But
in January, when the earth-sun distance is at its minimum, the earth’s speed in its orbit
must be greater than average to satisfy Kepler’s second law. Because of the earth’s
higher speed in its orbit at this time of year, the angle is not M but the slightly larger
f , so the earth must rotate f − M radians more than average from noon to noon. At
1440 minutes per 2π radians, one might say that noon is delayed
1440
( f − M) minutes.
2π
By accurately describing f and M and expanding their difference in a Fourier sine
series, one can show that for a given day d, this delay is approximated by
2π
8 sin d minutes.
365.25
See [2, p. 87] and [3] for details.
The second reason that the “noon-to-noon” time varies through the year is that the
earth’s orbital motion and daily rotation take place in different planes, and this affects
the amount in excess of 2π radians that the earth must rotate in order for the sun to
to be in its directly overhead position each day. The earth’s orbital motion must be
projected onto the equatorial plane to correctly describe this angle. This requires that
the noon-to-noon time also take into account a term whose Fourier approximation is
4π
−10 sin (d − 80) .
365.25
Again, more details (including some clever animations) are given in [3].
One can achieve fairly good computational results by allowing “noon” to vary ac-
cording to
4π 2π
n = 720 − 10 sin (d − 80) + 8 sin d
365.25 365.25
minutes past midnight. Using r and θ to compute tˆ as described previously, sunrise oc-
curs at n − tˆ and sunset at n + tˆ minutes past midnight. When this method is applied at
latitude 40◦ north on all days of the year and compared to values found in an almanac,
the great majority of sunrise and sunset times are correct or off by one minute. The
worst error is 6 minutes, the average (absolute value) of sunrise errors is 1 minute,
and the average (absolute value) of sunset errors is 1.7 minutes. The accuracy can be
improved slightly by using the true, variable value of r instead of the constant value
used above, and replacing θ by the true angle (which changes by a variable amount
each day). Anyone wishing to pursue these changes should look up the ideas of true
anomaly, mean anomaly, eccentric anomaly and their relationship to r in any orbital
mechanics text such as [2].
The beauty of this application is that it can be approached at so many different
levels. Use it in a freshman or sophomore class as an application of tangent planes to
surfaces, or use it as a senior project complete with the celestial mechanics and Fourier
series details.
320 c THE MATHEMATICAL ASSOCIATION OF AMERICA
References
1. W. A. McGeveran Jr., editor, The World Almanac and Book of Facts 2002, World Almanac Education Group,
New York, 2002.
2. A. E. Roy, Orbital Motion, 3rd ed., Adam Hilger, Ltd., Bristol, UK, 1988.
3. R. Urschel, Analemma, http://www.analemma.com.
∞ −x 2
A Calculation of 0 e dx
Alberto L. Delgado ([email protected]) Bradley University, Peoria, IL
61625-0160
If you are looking for a way to tie together different strands of material your students
see in their second semester of a standard three-semester calculus course, the result in
the title will serve you very well. Of course, the result is
∞ √
2 π
e−x d x = .
0 2
Students find it surprising (where does the π come from?) and meaningful (when they
learn its relationship to the bell curve). You can also use this significant improper
integral as an entry into a discussion of approximations of definite integrals over finite
regions.
There are numerous ways to evaluate the integral in the title. In just a few minutes
in the library, I located two evaluations based on Wallis’ infinite product expansion
of π, [8] and [5]; a calculation using contour integration in the complex plane, [1]; a
reduction to Euler’s integral of the first kind, [2]; two evaluations using differentiation
under the integral sign, [7] and [9]; and a calculation based on solids of revolution, [3].
You can find the standard computation based on a double integral in polar coordinates
in almost any statistics or calculus book. The integral is commonly associated with
Gauss, although he credits Laplace with its discovery and publication in 1805. Euler
was working with similar integrals thirty years earlier, but he seems to have missed its
exact formulation. By 1813, the result appears to have been well known. See [6] for a
more detailed history.
Few of the techniques for evaluating this integral are easily accessible to a begining
student. Here is a technique that students can appreciate. Although the method may
not be new (the main idea is already in [3] and [4]) our variation of it is sufficiently
elementary that it can be presented to students.
Let I denote the value of the integral of interest. A comparison with e−x confirms
that I is finite. Let’s start by finding the volume V of the solid of revolution made by
2
revolving the graph of e−x for x ∈ [0, ∞) about the y-axis (Figure 1).
Using the usual technique of nested cylindrical shells, we obtain
∞
2
V = 2π xe−x d x = π.
0
Now let’s compute V a second time. This time take cross sections parallel to the x-axis
(Figure 2).
VOL. 34, NO. 4, SEPTEMBER 2003 THE COLLEGE MATHEMATICS JOURNAL 321