The task of calculating Sunrise & Sunset would be much simpler if:
- The Earth's axis of rotation was at 90 degrees to the plane of its orbit.
- The Earth's orbit was a perfect circle.
- The Earth's orbit was synchronised with the Gregorian calendar.
As this is not the case we will have to accept that there will be some complexity in this task.
Let's start by considering the simple case of no axial tilt and an observer on the equator.
The sun lies on a line through the centre of the earth at the equator. In reality the scale of the sun is much greater and looks more like this:
The sun's rays travel essentially parallel to each other to the earth so as the earth rotates and the sun rises the line of illumination runs along a great circle through the axial poles. This means that the sun appears to rise directly on the eastern horizon, travel directly overhead, and finally set directly on the western horizon. Graphically, it could be represented like this:
Given that I live in Melbourne the equator lies to the north. When the sun reaches it's highest point in the sky (directly overhead at the equator) that point is lower in the sky and to the north.
The angle between the horizon and the sun is 90° - latitude as shown here:
If the sun's travel through the sky is plotted it now looks like this:
The earth, however, does not have a rotational axis perpendicular to the orbital plane. It is angled at ~23°. For better or worse, that rotational axis always points to the same point in the northern / southern sky.
While this is good news for the folks at the Ice Cube Neutrino Detector at the south pole, it is bad news for us as the apparent angle between the sun and the celestial equator. The celestial equator is the earth's equator projected onto the celestial sphere.

At the equinoxes, March and September, the plane of the axial tilt is parallel to the direction of motion of the earth which is the same as having no tilt. At the December solstice the axial tilt points the southern hemisphere towards the sun and at the June solstice the axial tilt points the northern hemisphere towards the sun.

The axial tilt at the solstices causes the lines of sunrise / sunset to strike the earth obliquely. That means that instead of the line of sunrise / sunset running from pole to pole and sunrise / sunset occuring on the eastern / western horizon, sunrise and sunset are shifted northward or southward.
In Melbourne, in December, the sun will rise south of due east, track high in the sky at noon then set south of west. This is the longest path the sun will take through the sky and result in the longest day.
Conversely, in June the sun will rise north of due east, track to its lowest noon height, then set north of west. This is the shortest path through the sky and results in the shortest day.
if the path of the sun from dawn, through noon, to dusk is plotted as an arc in the sky, the plane of that arc always has an angle to the horizon of 90° - latitude regardless of the time of the year. If the paths for the solstices and the equinoxes are shown together they look like this:
The next task is to determine where on the horizon the sun will rise or set. We will take it as read that the azimuth for sunset is the same as the azimuth for sunrise.
To find the sunrise azimuth we need to solve a spherical triangle:
This triangle is known as the PZS triangle and is made up of the three points shown.
- Zenith: The point directly overhead.
- Pole: The celestial pole around which the stars rotate.
- Sun: The sun when it is on the horizon.
The three sides are shown in green, red, and blue. The angles of two of these sides is known which allows us to solve for the unknown azimuth angle.
The green side (ZOS) is always 90° because the sun is on the horizon at sunrise. The red side (ZOP) is called the co-latitude and is 90° - latitude which in this case is 53°. The blue side (POS) is the hour angle and we will need it later. It describes the angle between sunrise and solar noon. It is also called the co-declination and, mathematically, is 90° - declination.