1. The spherical triangle

On the unit sphere, a great circle is the intersection with a plane through the center ; it is the geodesic of the sphere. Three points not lying on the same great circle, joined by arcs of great circles shorter than , form a spherical triangle.
- The sides are central angles: , , .
- The angles are the dihedral angles between the planes of the sides meeting at each vertex (equivalently, the angle between the tangents to the two sides at the vertex).
Unlike the plane triangle, ; the spherical excess equals the area of the triangle (Girard’s theorem).
We write for the unit vectors . Then , and .
2. The cosine formula

Theorem.
Proof. The tangent at to the arc is the component of perpendicular to , normalized:
where the denominators are the norms: . The angle is the angle between and :
For small sides, and give : the plane law of cosines (problem 1).
3. The sine formula

Theorem.
Proof. From the cosine formula,
Expanding the numerator with :
which is symmetric in . Therefore
does not depend on which vertex we choose. Since all angles and sides lie in , the sines are positive and we may take the square root.
(Geometrically, , the square of the scalar triple product: the volume of the parallelepiped, which favors no vertex.)
Five-part formula. Applying the cosine formula to and substituting again, one obtains
which we will use for the azimuth.
3.1 The polar triangle and the cosine formula for the angles
Given a triangle , its polar triangle has as vertices the poles of the sides: is the pole of the great circle lying on the same side as , and so on. One proves (Todhunter, ch. II) that its sides and angles are the supplements of the angles and sides of the original: , . Applying the cosine formula to the polar triangle and substituting:
This is the cosine formula for the angles: it yields a side from the three angles, something impossible in the plane (where the three angles fix only the shape, not the size). On the sphere the size is determined because the spherical excess is the area.
3.2 Numerical conditioning: when the cosine formula fails
The angular separation between two celestial bodies is often computed with (problem 2). For small this is an ill-conditioned formula: is computed with an absolute error of the order of the machine epsilon, in double precision, and on inverting,
For ( rad) the error is rad , tolerable; but for mas (milliarcsecond, the precision of Gaia), rad mas: the error exceeds the result. The cure is a formula that does not subtract nearly equal quantities. With the haversine , the cosine formula is rewritten (problem 8) as
in which all terms are small and positive when is, and is obtained with relative error . Equivalent, and even more robust over the whole range, is the vector form: with and the unit vectors, , which is exact at the level both for and for (where the haversine, in turn, degrades). It is the one used by SOFA and Astropy.
4. The astronomical triangle

For an observer at latitude we consider three points on the celestial sphere:
- , the north celestial pole (taking with its sign, negative in the south, the formulas also hold in the southern hemisphere),
- , the zenith,
- , the celestial body, with declination and hour angle (measured westward from the meridian).
Its sides are
and its angles at and at are and if the body is in the west (), with the azimuth measured from north through east. (If it is in the east, and ; the final formulas are the same.) That the altitude of the pole equals is immediate: the arc is the colatitude.
4.1 Derivation of the equatorial → horizontal transformation
Altitude. Cosine formula for the side , opposite :
Azimuth, sine. Sine formula with the pairs and :
Azimuth, cosine. Five-part formula (or the cosine formula for the side , substituting ):
Dividing, and using the two-argument function to obtain the correct quadrant,
These are exactly the formulas of equatorialToHorizontal in src/lib/math/coordinates.ts (Meeus eqs. 13.5–13.6, with azimuth from north instead of from south).
Matrix form. The three equations are equivalent to a rotation by the angle about the east–west axis that carries the pole to the zenith (problem 3); in practice the rotations of precession, nutation and sidereal time are chained in this way.
5. Sidereal time

The hour angle of a celestial body is , where is the local sidereal time: the hour angle of the vernal equinox. It is obtained from that of Greenwich by adding the longitude (positive eastward):
The Greenwich mean sidereal time as a function of the Julian date (UT1; time scales are treated in the next lesson) is (Meeus eq. 12.4)
with in Julian centuries since J2000.0. The coefficient per mean solar day reflects the fact that in one solar day the Earth turns slightly more than one full revolution with respect to the stars: the sidereal day lasts . This is why each star rises about 3 min 56 s earlier every night, and the sky seen at a given hour changes with the seasons.
6. Rising and setting of the stars

Imposing in the altitude equation:
is the semi-diurnal arc: the star is above the horizon for (in sidereal time, hours). It rises when and sets when .
- If , it never sets: circumpolar. This is equivalent to (problem 4).
- If , it never rises.
With in the cosine equation for the side , : the azimuth of rising is
and setting is symmetric, at . For Sirius () from Bogotá (): , , between east and southeast.
For the Sun and the Moon one must use (refraction of plus semidiameter of ) or for the Moon (which also has a parallax of ). The general formula is (Meeus ch. 15).
7. The stereographic projection of the planisphere

The simulator draws the visible hemisphere by projecting it from the nadir onto the plane of the horizon (which passes through the center of the sphere). A point of zenith distance goes to a point at distance
from the center, in the direction of its azimuth. Proof: the central angle between and is ; the inscribed angle subtending the same arc equals , and in the right triangle (with ) we have . The zenith goes to and the horizon to . Since the sky is viewed from below, the plane is drawn with north at the top and east on the left: , (src/lib/math/proyeccion.ts).
7.1 Conformality
In coordinates the metric of the sphere is , and in the plane, in polar coordinates, . With :
The scale factors in the radial and in the azimuthal direction are equal, , hence : the projection is conformal (it preserves angles, and therefore the shape of small figures: the constellations are not distorted, they only grow toward the edge, up to at the horizon versus at the zenith).
7.2 Circles go to circles
Theorem. The image of every circle on the sphere not passing through is a circle in the plane; if it passes through , it is a straight line.
Proof. Let be the inversion of space with center and radius : on the ray with . An inversion of radius maps a sphere through its center, of diameter , to the plane perpendicular to that diameter at distance from the center. Here and , so the celestial sphere goes to the plane at distance 1 from : the plane of the horizon through . Since each point moves along the line , restricted to the sphere is the stereographic projection (check: because , and the horizon, at distance from , stays fixed). Now:
- a circle on the sphere is the intersection of the sphere with a plane ;
- the inversion maps to a sphere through (or to itself if );
- therefore the image of the circle is the intersection of the horizon plane with a sphere (a circle) or with a plane (a line, when ).
Consequences for the planisphere: the circles of constant altitude are concentric circles; the celestial equator and the parallels of declination (circles on the sphere) are circular arcs, which is what one sees when animating the simulator: each star traces a circular arc around the image of the pole.
Problems
1. Prove that for a small spherical triangle the cosine formula reduces to the plane law of cosines, and estimate the relative error for sides of .
Show solution
With and : , whence , where denotes terms of fourth order in the sides. The neglected terms are of order against , so the relative error is of order : for rad, a few tenths of a percent.
2. Compute the angular separation between Acrux (, ) and Gacrux (, ).
Show solution
In the triangle pole–Acrux–Gacrux the sides meeting at the pole are the polar distances and the angle at the pole is . Cosine formula: . With , , : , so : the “long arm” of the Southern Cross.
3. Write the rotation that carries the local equatorial system (axes: meridian–equator intersection toward the south, west, north pole) to the horizontal system (south, west, zenith) and recover from it the three formulas of §4.1.
Show solution
Both systems share the west axis. The pole is at altitude , so one must rotate by the angle about the west axis. With and (south north, west east):
The third row gives ; the second, ; the first, . They are those of §4.1. Check: for one obtains .
4. Prove that for , and conclude which stars are circumpolar in Bogotá ().
Show solution
If , the product and moreover : neither condition holds. If (the negative case is symmetric): , by the monotonicity of the tangent on . In Bogotá, : among the stars with only Polaris satisfies it ( in 2026).
5. Compute the length of the day in Bogotá at the June solstice (), first with the mathematical horizon and then with .
Show solution
Mathematical horizon: , , day . With : , , day . Refraction and semidiameter add about 8 minutes, more than the entire seasonal variation in Bogotá (about 33 min between solstices).
6. Prove that in the stereographic projection the area is magnified by a factor and compute how much larger a constellation appears at the horizon than at the zenith.
Show solution
By §7.1 the map is conformal with linear factor in all directions, so the area element is multiplied by : . At the zenith ; at the horizon, . A constellation is drawn with 4 times more area (twice the linear size) near the horizon. It is an effect of the projection, unrelated to the “Moon illusion,” which is perceptual.
7. (Simulator) In Bogotá, set the time at which Sirius rises and check with the pointer that its azimuth is close to . Then switch to Buenos Aires () and first predict the new azimuth of rising with the formula.
Show solution
, . The star rises somewhat farther south than in Bogotá, and its diurnal arc, being closer to the elevated pole (the south one), is longer: , sidereal hours above the horizon, versus about 11.8 h in Bogotá.
8. (Computational) Prove the haversine identity of §3.2 from the cosine formula and check the conditioning numerically: compute the separation between and for with the three formulas (cosine, haversine, vector) and tabulate the relative error against the exact value .
Show solution
Identity. . Using and : , and since , we get .
Program (Python):
import numpy as np
def cosenos(a1, d1, a2, d2):
return np.arccos(np.sin(d1)*np.sin(d2) + np.cos(d1)*np.cos(d2)*np.cos(a2 - a1))
def haversine(a1, d1, a2, d2):
h = np.sin((d2-d1)/2)**2 + np.cos(d1)*np.cos(d2)*np.sin((a2-a1)/2)**2
return 2*np.arcsin(np.sqrt(h))
def vectorial(a1, d1, a2, d2):
u = np.array([np.cos(d1)*np.cos(a1), np.cos(d1)*np.sin(a1), np.sin(d1)])
v = np.array([np.cos(d2)*np.cos(a2), np.cos(d2)*np.sin(a2), np.sin(d2)])
return np.arctan2(np.linalg.norm(np.cross(u, v)), np.dot(u, v))
for nombre, x in [("1°", np.radians(1)), ("1'", np.radians(1/60)), ('1"', np.radians(1/3600)),
("1 mas", np.radians(1e-3/3600)), ("1 µas", np.radians(1e-6/3600))]:
print(nombre, [abs(f(0, 0, x, 0) - x)/x for f in (cosenos, haversine, vectorial)])Typical results (relative error): for all three formulas give ; for the cosine formula already has while the other two stay at ; for 1 mas and 1 µas the cosine formula returns exactly 0 (an error of 100 %) because rounds to 1, whereas the haversine and the vector formula remain at (checked with our code in double precision). The haversine only degrades at the opposite extreme, , where the vector formula remains exact. Conclusion: for astrometry, is never used.
✦ Self-assessment
Further reading
- Smart (1977), Textbook on Spherical Astronomy, chs. I–II: the classical development of the formulas and of the astronomical triangle. Todhunter (1886): polar triangle and all the identities, with complete proofs.
- Green (1985), Spherical Astronomy, chs. 1–3: modern treatment with vectors and rotation matrices.
- Meeus (1998), chs. 12, 13 and 15: the formulas as they are programmed, with numerical examples.
- Snyder (1987), §21, and Needham (1997), ch. 3: the stereographic projection from cartography and from complex analysis.
- Sinnott (1984), Sky & Telescope 68, 159: the article that popularized the haversine in computational astronomy.
🍎 Teacher guide
- Time
- 3 classes of 90 min
- Learning outcome
- On completion, the student proves the fundamental formulas of spherical trigonometry, derives the equatorial → horizontal transformation from the astronomical triangle, computes sidereal times, risings and settings, proves the properties of the stereographic projection and chooses the numerically appropriate formula for angular separations.
- Evidence of learning
- Submission of problems 3 (matrix form), 6 (area in the projection) and 8 (program with conditioning table), and a planisphere computed by hand for the student's latitude with three stars and their rising azimuths.
Materials
- A sphere (ball or globe) and adhesive tape to trace great circles
- Python 3 or a scientific calculator
- The portal's interactive Planisphere simulator
- Catalog of bright stars (e.g. those brighter than magnitude 2 with J2000 coordinates)
Suggested sequence
Class 1 (90 min). Opening (15 min): great circles on the ball; the spherical excess measured on an octant. Development (60 min): vector proof of the cosine formula, the sine formula and the five-part formula; polar triangle (§3.1). Closing (15 min): problem 1 (plane limit).
Class 2 (90 min). Opening (10 min): “how do I point to the zenith from the pole?”: the astronomical triangle. Development (60 min): derivation of the equatorial → horizontal transformation, matrix form (problem 3), sidereal time, risings and settings, circumpolar stars (problems 4 and 5). Closing (20 min): simulator: check the computed rising azimuths.
Class 3 (90 min). Opening (10 min): numerical conditioning (§3.2) with the 1 mas example. Development (55 min): stereographic projection: conformality and inversion (§7), problem 6; workshop on problem 8. Closing (25 min): problem 7 and mini-quiz.
Common mistakes
- Measuring the sides of the spherical triangle as lengths instead of central angles. Trace the three great circles on the ball and measure with a protractor from the center.
- Forgetting the sign of the latitude in the southern hemisphere. Do problem 7 (Buenos Aires) explicitly.
- Using the cosine formula with arccos for small separations. Problem 8 shows it with numbers; always ask for atan2.
- Confusing azimuth from north (the portal's convention) with azimuth from south (Meeus). Point out the sign change in the formulas.
- Believing that the stereographic projection distorts the constellations. It is conformal: only the size changes, not the shape; problem 6 quantifies by how much.