Sun, Earth, Moon
Celestial sphere
I saw this picture on Wikipedia the other day.

It struck me that the ecliptic is almost vertical in this picture, super close to the zenith. I've always lived in the 51°N-53°N range where the ecliptic never moves up so high off the horizon.
Everyone knows the Earth orbits the Sun, the Moon orbits the Earth, and the Earth's axis is tilted. But it's surprisingly easy to know those facts without having a mental model of what they imply. This post is an attempt to build that model.
So I'll put myself on the line a bit and try to do a digest of the obvious, i.e. the Sun - Earth - Moon system. I obviously won't cover everything but I'll try to do an overview of the important stuff. And yeah, some of this is obvious - though hopefully still fun to think about. By the end we'll have enough machinery to work out roughly when the picture above was taken - without peeking at the metadata.
As a bonus, I've been enjoying Three.js based visualizations I can get Gemini to cook up. They're almost good as-is and need very few tweaks. Incidentally, I find these three.js visualizations the best way to actually do 3D diagrams.
Initially I wanted to also cover the Moon's nodal precession here but I'll have to do that later.
The celestial geometry
Before we get to the ecliptic, we need one useful abstraction: the celestial sphere. Imagine the Earth at the centre of an enormous sphere with the stars, Sun and Moon projected onto its inside surface. The stars are, of course, nowhere near the same distance from us in reality, but they are so far away compared with the Earth-Moon system that treating them as if they all lie on one giant sphere turns the geometry of the sky into ordinary geometry on a sphere.
With that picture in mind, we can talk about paths, poles and great circles on the sky without worrying about how far away anything actually is.
Let's start with the ecliptic: the plane of the Earth's orbit around the Sun - equivalently, the plane the Sun appears to move in when watched from the Earth. The Earth orbits in that plane but crucially, its axis of rotation is tilted with respect to it by about
So: we have the ecliptic plane; the Earth orbits in that plane, and its axis is tilted with respect to it. The Moon then orbits around the Earth but to make it more complicated, its orbital plane is tilted another ~5.1 degrees with respect to the ecliptic. We end up with something like this.
I added two nodes on the Moon's orbit: those are the points where the Moon's orbit crosses the ecliptic plane. One is the ascending node (since the Moon is crossing on the way UP), the other the descending node.
If you keep watching you might notice the nodes themselves are slowly rotating too - that's the precession of the lunar nodes, an 18.6-year cycle.
Equinoxes and solstices
Due to the axial tilt the Sun will have a different declination throughout the year. When the North Pole side of Earth is facing the Sun we see it at its highest declination
Note some consequences of this fact:
- on the equinoxes the Sun will rise and set due east and west, respectively[1]
- during the Northern hemisphere summer the Sun will rise and set north of east, west respectively; and south of them during the winter
- during the summer solstice the Sun will be directly overhead at noon at the Tropic of Cancer
- during the winter solstice the Sun will be directly overhead at noon at the Tropic of Capricorn
Let's call the Sun's declination
This also tells us when the Sun never sets: it has to stay above the horizon even at its lowest point, on the opposite side of the sky from noon, which happens when
Sun vs Horizon
The Sun will peak at noon but what about a few hours either side of noon? Let's calculate the Sun's altitude throughout the day. To do that, we'll need to use the spherical law of cosines.
Spherical Law of Cosines
This follows the derivation presented in here. I've LaTeX'd the equations, redone the illustrations and streamlined the normalisation step (since I assume a unit sphere to begin with).
Let's take
We have
The arclength of each side is

We want to find the angle
Since the arc
so the dot product gives us the cosine of our angle:
Now using the cross product identity:
And we end up with:
and so

We take
, the angle from our zenith to the Sun - the one we are looking for , the angle between the celestial pole and the Sun; since declination is measured from the celestial equator this is , the angle between the pole and the zenith: where is our latitude
The angle at the pole (the
Plugging into the law and using
Note that
As a sanity check: Manchester (
Some interesting things to look at:
- the poles - they get 6 month days, 6 month nights
- the polar circles around 66-67 degrees north and south
- the tropics around 23 degrees north and south
- some of the preset cities I put on there
Overhead Ecliptic
The Sun is one thing - what about the ecliptic in general? You'll notice that in the picture the ecliptic is pretty much exactly overhead - at night, possibly close to but definitely before sunrise.
The angle that the ecliptic makes with the horizon will differ throughout the day: the tilt between the celestial equator (i.e. Earth's equator projected out onto the sky) and the ecliptic causes a "wobble" as the Earth rotates. Let's see how we can calculate it based on time of day; then we can work out approximately when the picture was taken.
Also, this was very confusing to me at first. To take a very specific example, let's pretend we're in Manchester, near
Here are two visualizations. The first one is an Earth view at different days of the year and different times of the day. There are two different perspectives: the first one locks the observer in place (zenith always points up) and rotates the rest accordingly. The second one locks the ecliptic and rotates the observer.
Personally I find the fixed ecliptic perspective a bit easier to reason about than the fixed observer.
The second is a graph of this ecliptic vs horizon angle throughout the year.
Derivation
The Sun's position can be easily expressed in the ecliptic frame. We take the line of the Vernal Equinox to be our x-axis. The z-axis is the normal to the ecliptic plane. The y-axis is defined by the right-hand rule from the x and z axes. Note the z component is always 0 (since the Sun lies ON the ecliptic); we just have the
Ecliptic longitude is calibrated so that
There's also the equatorial frame.
Both coordinate systems share an origin (Earth) and share the same reference direction for their zero-point - the vernal equinox, which is defined as the intersection of the ecliptic and equatorial planes. They differ only by a rotation of angle
We have the Sun's position as:
Fixed geometry of the ecliptic pole
Earth's axial tilt
The north ecliptic pole (NEP) sits at a fixed spot on the sky.
Sun's mean ecliptic longitude
For day of year
Ecliptic-to-equatorial coordinate transformation
Step 1 - sun's position vector in ecliptic coordinates. Take the Sun's position vector from before.
Step 2 - rotate by
The x-component is untouched by the rotation - rotating about an axis never changes a vector's own component along that axis (e.g. spinning a globe about its polar axis leaves every point's latitude unchanged). Only
Step 3 - compare coordinate by coordinate against standard spherical coordinates
The third equation directly gives the sun's declination for the year:
Step 4 - solve for
(One implementation note: a plain atan2 of the numerator and the denominator.)
Local Sidereal Time
As a function of clock hour
Note that at
Hour angle of the ecliptic pole
The angle the ecliptic makes with the horizon
The key geometric fact: the angle at which two great circles cross equals the angular distance between their poles.
The horizon is a great circle whose pole is the zenith
(The ecliptic meets the horizon at two points, where it rises and where
it sets. The interior angle is
Setting up the spherical triangle
We get
- the north celestial pole (NCP) - the apex,
- the zenith
, - the north ecliptic pole (NEP).
We do the same as before: set up a spherical triangle, except we swap the Sun for the NEP.
The two sides meeting at the NCP are co-declinations:
using
The angle at the NCP is the difference in hour angles. The zenith is
always on the meridian (hour angle
and
Sanity checks
- North Pole (
): , so , independent of . Correct - at the pole the horizon is the celestial equator, so the ecliptic always meets it at the obliquity. - Equator (
): , which swings with as the ecliptic pinwheels around the sky.
Back to the picture

First, why is a picture like this possible at all? For the ecliptic to pass overhead, the zenith has to lie on the ecliptic - i.e. the zenith-to-NEP distance
Now for the when. Take
Plugging in
So the ecliptic is overhead exactly when the NEP crosses our meridian, i.e. when
The picture looks like deep pre-dawn - call it 3:30 am. From our LST formula:
Inverting
Day 121 is the very start of May.
Time to check our deduction against the metadata: the picture shows the Eta Aquariids, a meteor shower that peaks around the 5th of May.
Wrapping up
So that's the digest of the "obvious": the tilt
The Moon is another topic for another day.
Or close enough to it ↩︎