Solid angle of a star

The apparent size of a distant object can be measured by projecting the object onto a unit sphere around the observer and calculating the area of the projected image.

A unit sphere has area 4π. If you’re in a ship far from land, the solid angle of the sky is 2π steradians because it takes up half a sphere.

If the object you’re looking at is a sphere of radius r whose center is a distance d away, then its apparent size is

\Omega = 2\pi\left(1 - \frac{\sqrt{d^2 - r^2}}{d}\right)

steradians. This formula assumes d > r. Otherwise you’re not looking out at the sphere; you’re inside the sphere.

If you’re looking at a star, then d is much larger than r, and we can simplify the equation above. The math is very similar to the math in an earlier post on measuring tapes. If you want to measure the size of a room, and something is blocking you from measuring straight from wall to wall, it doesn’t make much difference if the object is small relative to the room. It all has to do with Taylor series and the Pythagorean theorem.

Think of the expression above as a function of r and expand it in a Taylor series around r = 0.

\Omega = 2\pi\left(1 - \frac{\sqrt{d^2 - r^2}}{d}\right) = 2\pi\left(\frac{\sqrt{r^2}}{2d^2} + \frac{r^4}{8d^4} + \cdots \right)

and so

\Omega \approx \frac{\pi r^2}{d^2}

with an error on the order of (r/d)4. To put it another way, the error in our approximation for Ω is on the order of Ω². The largest object in the sky is the sun, and it has apparent size less than 10-4, so Ω is always small when looking at astronomical objects, and Ω² is negligible.

So for practical purposes, the apparent size of a celestial object is π times the square of the ratio of its radius to its distance. This works fine for star gazing. The approximation wouldn’t be as accurate for watching a hot air balloon launch up close.

Square degrees

Sometimes solid angles are measured in square degrees, given by π/4 times the square of the apparent diameter in degrees. This implicitly uses the approximation above since the apparent radius is r/d.

(The area of a square is diameter squared, and a circle takes up π/4 of a square.)


When I typed

    3.1416 (radius of sun / distance to sun)^2

into Wolfram Alpha I got 6.85 × 10-5. (When I used “pi” rather than 3.1416 it interpreted this as the radius of a pion particle.)

When I typed

    3.1416 (radius of moon / distance to moon)^2

I got 7.184 × 10-5, confirming that the sun and moon are approximately the same apparent size, which makes a solar eclipse possible.

The brightest star in the night sky is Sirius. Asking Wolfram Alpha

    3.1416 (radius of Sirius / distance to Sirius)^2

we get 6.73 × 10-16.

Related posts

Interpolating rotations with SLERP

Naive interpolation of rotation matrices does not produce a rotation matrix. That is, if R1 and R2 are rotation (orthogonal) matrices and 0 < t < 1, then

R(t) = (1-t)R_1 + tR_2

is not in general a rotation matrix.

You can represent rotations with unit quaternions rather than orthogonal matrices (see details here), so a reasonable approach might be to interpolate between the rotations represented by unit quaternions q1 and q2 using

q(t) = (1-t)q_1 + tq_2

but this has a similar problem: the quaternion above is not a unit quaternion.

One way to patch this up would be to normalize the expression above, dividing by its norm. That would indeed produce unit quaternions, and hence correspond to rotations. However, uniformly varying t from 0 to 1 does not produce a uniform rotation.

The solution, first developed by Ken Shoemake [1], is to use spherical linear interpolation or SLERP.

Let θ be the angle between q1 and q2. Then the spherical linear interpolation between q1 and q2 is given by

q(t) = \frac{\sin((1-t)\theta)}{\sin\theta}q_1 + \frac{\sin(t\theta)}{\sin\theta}q_2

Now q(t) is a unit quaternion, and uniformly increasing t from 0 to 1 creates a uniform rotation.

[1] Ken Shoemake. “Animating Rotation with Quaternion Curves.” SIGGRAPH 1985.

Another Napoleon-like theorem

A little while back I wrote about Napoleon’s theorem for triangles. A little later I wrote about Van Aubel’s theorem, a sort of analogous theorem quadrilaterals. This post presents another analog of Napoleon’s theorem for quadrilaterals.

Napoleaon’s theorem says that if you start with any triangle, and attach equilateral triangles to each side, the centroids of these new triangles are the vertices of an equilateral triangle.

So if you attach squares to the sides of a quadrilateral, are their centroids the vertices of a square? In general no.

But you can attach squares to two sides, and special rectangles to the other two sides, and the centroids will form the corners of a square. Specifically, we have the following theorem by Stephan Berendonk [1].

If you erect squares on the two “nonparallel” sides of a trapezoid and a rectangle on each of the two parallel sides, such that its “height” is equal to the length of the opposite side of the trapezoid, then the centers of the four erected quadrangles will form the vertices of a square.

Here’s an illustration. Berendonk’s theorem asserts that the red quadrilateral is a square.

[1] Stephan Berendonk. A Napoleonic Theorem for Trapezoids. The American Mathematical Monthly, April 2019, Vol. 126, No. 4, pp. 367–369

Van Aubel’s theorem

Van Aubel’s theorem is analogous to Napoleon’s theorem, though not a direct generalization of it.

Napoleon’s theorem says to start with any triangle and draw equilateral triangles on each side. Connect the centers of the three new triangles, and you get an equilateral triangle.

Illustration of Napoleon's theorem

Now suppose you start with a quadrilateral and draw squares on each side. Connect the centers of the squares. Do you get a square? No, but you do get something interesting.

Van Aubel’s theorem says that if you connect the centers of squares on opposite faces of the quadrilateral (dashed lines below), the two line segments are the same length and perpendicular to each other.

The solid gray lines show that if you connect the centers of the square you do not get a square.

Further development

Van Aubel’s theorem dates to 1878 [1], and there have been numerous extensions ever since. Recently [2] Pellegrinetti found that six points related to Van Aubel’s theorem all lie on a circle. The six points are the midpoints of the two Van Aubel line segments (the dashed line segments above), the intersection of these two line segments, the midpoints of the two diagonals of the quadrilateral, and one more point.

The final point in Pellegrinetti’s theorem comes from flipping each of the squares over, connecting the centers, and noting where the connecting lines intersect. This is analogous to the messy case of Napoleon’s theorem: When you draw the squares on the inside of the quadrilateral rather than on the outside, the picture is hard to take in.

[1] Van Aubel, H., Note concernant les centres des carrés construits sur les cotés dun polygon quelconque, Nouv. Corresp. Math., 4 (1878), 40-44.

[2] Dario Pellegrinetti. The Six-Point Circle for the Quadrangle. International Journal of Geometry. 4 (2019) No 2, pp. 5–13.

Converting between barycentric and trilinear coordinates

Barycentric coordinates describe the position of a point relative to the three vertices of a triangle. Trilinear coordinates describe the position of a point relative to the three sides of a triangle. It’s surprisingly simple to convert from one to the other.

Why should this be surprising? Because the distance from a point to a line is more complicated to compute than the distance between two points. Hiding this complication is one of the things that makes trilinear coordinates convenient for some tasks.

Both barycentric and trilinear coordinates are homogeneous. This means the coordinates are only unique up to a scaling factor. The proportions between the components are unique, not the components themselves. Barycentric and trilinear coordinates are written with colons separating the components as a reminder that they are proportions rather than absolute numbers.

If the vertices of our triangle are A, B, and C, the barycentric coordinates of a point P are proportional to the distances from P to A, B, and C. The trilinear coordinates of P are proportional to the distances from P to the sides opposite A, B, and C.

Let a be the length of the side opposite vertex A and similarly for b and c. Then a point with trilinear coordinates

x : y : z

has barycentric coordinates

ax : by : cz

Similarly, a point with barycentric coordinates

α : β : γ

has trilinear coordinates

α/a : β/b : γ/b.

If you have trilinear coordinates x : y : z you can find the actual distances to the sides of the triangle by scaling by a factor involving the area of the triangle. The distances to sides opposite A, B, and C are kx, ky, and kz respectively, where

k = area / (ax + by + cz).

Note that the denominator is the sum of the corresponding barycentric coordinates. This is because barycentric coordinates of P can be interpreted as the areas of the three triangles formed by drawing lines from P to each of the vertices.

Foreshadowing Page Rank

Douglas Hofstadter, best known as the author of Godel, Escher, Bach, wrote the foreword to Clark Kimberling’s book Triangle Centers and Central Triangles. Hofstadter begins by saying that in his study of math he “sadly managed to sidestep virtually all of geometry” and developed an interest in geometry, specifically triangle centers, much later.

The ancient Greeks had four ways to define the center of a triangle—circumcenter, incenter, orthocenter, and centroid. These are marked in the diagram above in blue, red, green, and orange respectively. But there are many more notions of a center of a triangle. Kimberling’s book (published in 1998) gives 400 triangle centers, and his website now lists tens of thousands of triangle centers.

In the foreword to Kimberling’s book Hofstadter recounts his speculation regarding which notion of triangle center is most central, the most important. He debates several criteria, then focuses on the fact that triangle centers tend to lie on lines, like the Euler line drawn in the image above. He calculates that the first 100 centers on Kimberling’s list fall on far fewer lines than one would expect if the points were distributed randomly.

So one could rank the lines according to how many centers each had, and rank the centers by how many lines pass through each. But then you want to count the ranks of the lines, giving points a higher rank for being on more high ranking lines, and you want rank lines higher for having more high ranking points on them ….

Hofstadter says that although this sounds circular, and it is, his ranking system could be implemented as a system of linear equations.

This system for ranking triangle centers is essentially the same as Google’s PageRank algorithm, giving higher rank to pages that are linked to by high ranking pages. And computing PageRank is indeed an enormous linear algebra problem, specifically an eigenvalue problem.

Hofstadter was not the first to think of this kind of ranking. According to Wikipedia

The eigenvalue problem behind PageRank’s algorithm was independently rediscovered and reused in many scoring problems. In 1895, Edmund Landau suggested using it for determining the winner of a chess tournament.

Hofstadter says

It would be fascinating to see what would come out of this attempt to assign a rank-ordering to the special points and special lines associated with any triangle.

But apparently he did not carry out the calculation, at least not as of 1998. Perhaps the idea of solving an eigenvalue problem for a matrix with hundreds of rows seemed impractical to Hofstadter at the time.

It would be interesting to know whether Hofstadter or anyone else ever followed through on this ranking project.

Kimberling lists his triangle centers in roughly chronological order, which correlates with subjective importance. If someone were to carry out a PageRank of the triangle centers, I’d recommend using only the 400 centers in Kimberling’s book. Or maybe even better, repeat the exercise for the first N centers for an increasing sequence of values of N.

Euler line

The previous post discussed the circumcenter and orthocenter of a triangle. Euler proved that the centroid, circumcenter, and orthocenter all fall on a common line, now called the Euler line.

The centroid is the center of mass of a triangle. If you draw lines from each vertex to the midpoint of the opposite side, the three lines intersect at the centroid.

The center of the nine-point circle also lies on the Euler line, though this was discovered after Euler.

Trilinear coordinates

Let α. β, and γ denote the three angles of the triangle.

The previous post said that the trilinear coordinates, of the circumcenter are

cos α : cos β : cos γ

and the trilinear coordinates of the orthocenter are

sec α : sec β : sec γ.

The trilinear coordinates of the centroid are

csc α : csc β : csc γ.

The center of the nine-point circle has trilinear coordinates

cos β-γ : cos γ-α : cos α-β.

Here’s a visualization for a particular triangle.

triangle with circumcenter, centroid, nine-point center, and orthocenter

The dashed line in the figure above is the Euler line for a particular triangle. The colored dots, moving from northwest to southeast, are the orthocenter, nine-point center, centroid, and circumcenter.

For an equilateral triangle, all four of these points coincide.

Proof outline

Discovering the Euler line required a flash of insight. Verifying it does not.

Three points are colinear if the 3×3 matrix formed by stacking their trilinear coordinates has zero determinant. So we could prove Euler’s original theorem by showing that the determinant of the matrix

\begin{bmatrix} \cos\alpha & \cos\beta & \cos \gamma \\ \sec\alpha & \sec\beta & \sec \gamma \\ \csc\alpha & \csc\beta & \csc \gamma \\ \end{bmatrix}

is zero. This isn’t zero for arbitrary α, β, and γ. But since these are angles in a triangle,

γ = π – α – β

and with that additional information we can show that the determinant is zero. We could replace one of the rows with the trilinear coordinates of the nine-point circle to show that it also lies on the Euler line.

Relating circumcenter and orthocenter

Triangle drawn with circumcenter and orthocenter

The previous post mentioned that the law of sines gives you the diameter of a circle through the vertices of a triangle. How would you find the center of this circle, the blue dot in the image above?

If the angles of the triangle are α. β, and γ, then the trilinear coordinates of the circumcenter, the center of the circumscribed circle, are

cos α : cos β : cos γ.

Trilinear coordinates are written with colons because the are proportions; any multiple of the same three numbers corresponds to the same point.

My earlier post on the nine-point circle mentioned the orthocenter of a triangle, the point where the three altitudes of the triangle intersect. This is the green dot in the image above. The orthocenter has trilinear coordinates

sec α : sec β : sec γ.

That is, the trilinear coordinates of the orthocenter are the reciprocals of the trilinear coordinates of the circumcenter.

Another way to state this is to say that the orthocenter and circumcenter are isogonal conjugates. Isogonal conjugation can be defined in terms of reflections, but the simplest description is in terms of trilinear coordinates.


Computing inscribed radius and circumscribed radius

triangle with inscribed and circumscribed circles drawn

A few days ago I wrote about the law of cotangents. This law says that if we label the sides of a triangle a, b, c and label the angles opposite each side α. β, γ, then

\frac{\cot \alpha/2}{s - a} = \frac{\cot \beta/2}{s - b} = \frac{\cot \gamma/2}{s - c} = \frac{1}{r}

where s is the semi-parameter, i.e.

s = (a + b + c)/2

and r is the radius of the incircle, the largest circle that can be inscribed in the triangle. This is the red circle in the image above.

The law of sines is sort of a dual to the law of cotangents. Just as the law of cotangents gives you the radius of the inscribed circle, the law of sines gives you the radius of the circumscribed circle, the blue circle in the image above. That is,

\frac{\sin\alpha}{a} = \frac{\sin\beta}{b} = \frac{\sin\gamma}{c} = \frac{1}{d}

where d is the diameter of the circle through the vertices of the triangle.

Rational Trigonometry

Rational trigonometry is a very different way of looking at geometry. At its core are two key ideas. First, instead of distance, do all your calculations in terms of quadrance, which is distance squared. Second, instead of using angles to measure the separation between lines, use spread., which turns out to be the square of the sine of the angle [1].

What’s the point of these two changes? Quadrance and spread can be computed purely algebraically in terms of point coordinates. No square roots, no sines, and no cosines.

The word “rational” in rational trigonometry enters in two ways. The spread of two lines is a rational function of their coordinate descriptions, i.e. the ratio of polynomials. Also, if the coordinates of a set of points are rational numbers, so are the quadrances and spreads.

I became interested in rational trigonometry when I was working on a project to formally verify drone collision avoidance software. Because all calculations are purely algebraic, involving no transcendental functions, theorems are easier to prove.

Rational trigonometry is such a departure from the conventional approach—trig without trig functions!—you have to ask whether it has advantages rather than simply being novel for the sake of being novel. I mentioned one advantage above, namely easier formal theorem proving, but this is a fairly esoteric application.

Another advantage is accuracy. Because a computer can carry out rational arithmetic exactly, rational trigonometry applied to rational points yields exact results. No need to be concerned about the complications of floating point numbers.

A less obvious advantage is that the theory of rational trigonometry is independent of the underlying field [2]. You can work over the rational numbers, but you don’t need to. You could work over real or complex numbers, or even finite fields. Because you don’t take square roots, you can work over fields that don’t necessarily have square roots. If you’re working with integers modulo a prime, half of your numbers have no square root and the other half have two square roots. More on that here.

Why would you want to do geometry over finite fields? Finite fields are important in applications: error-correcting codes, cryptography, signal processing, combinatorics, etc. And by thinking of problems involving finite fields as geometry problems, you can carry your highly developed intuition for plane geometry into a less familiar setting. You can forget for a while that you’re working over a finite field and proceed as you ordinarily would if you were working over real numbers, then check your work to make sure you didn’t do anything that is only valid over real numbers.

[1] Expressing spread in terms of sine gives a correspondence between rational and classical trigonometry, but it is not a definition. Spread is defined as the ratio of certain quadrances. It is not necessary to first compute a sine, and indeed rational trigonometry extends to contexts where it is not possible to define a sine.

[2] Rational trig is not entirely independent of field. It requires that fields not have characteristic 2, fields where 1 + 1 ≠ 0. This rules out finite fields of order 2n.