Posts whose title or text contains one of these words are left out of every view.
Whole words only: ai catches "AI-generated" but not "openai". Add a star for word beginnings: llm* catches llm and llms.
99 words is the limit
https://www.johndcook.com/blog
281 posts · 34 Votes · 1 Followers
Science 53% · Tech 39% · Writing 4% · Culture 2% · Life 1% · Art 0% · 2 more 1%
Subscribe via RSS
Kepler’s third law A recent article from Smithsonian magazine says a new dwarf planet candidate is 46 times further from the sun as earth is, and it takes 281.1 years to orbit the sun. I did a back-of-the-envelope calculation and thought something was wrong. Kepler’s third law says T² = c a³. Here T is the orbital period and a is the semimajor axis. If T is measured in years and a is measured in astronomical units (AU) then the proportionality constant c equals 1. If T = 281.1 years, then a =…
A permutation rearranges the elements of a list. The number of arrangements, say of a deck of cards, is finite, so eventually you have to arrive at an arrangement you’ve produced before, and history will repeat itself. Along the way, some cards may move in smaller cycles than others. Example For example, consider the permutation p = [5, 6, 2, 1, 0, 8, 3, 4, 9, 7] that sends i to p(i). Here indices start with 0. The number 2 is a fixed point: p(2) = 2. So it has a cycle length of 1. The number 1…
Suppose you have n different fertilizers you want to test. The simplest experiment would be to take a big plot of land, divide it into n blocks, and apply each fertilizer to a block. That’s fine if you have one big enough plot of land, and the land itself doesn’t matter. If the fertilizer supplies a nutrient that is already abundant in a particular soil, you won’t see as much benefit from that fertilizer on that soil. Plots of land will vary in other ways besides soil composition—some may…
The last several posts have been building up to this one, moving from tangible to more abstract. The posts on finite geometry gave examples of Steiner triples and more generally Steiner systems, introduced in the previous post. Combinatorial designs take this one step further. The previous post gave the following definition: A Steiner triple system, written STS(n), is a collection of three-element subsets, called blocks, of a set X with n elements, such that every two-element subset of X…
Steiner triples Several examples from the recent posts on finite geometry are special cases of Steiner triples. A Steiner triple system, written STS(n), is a set S of n elements and a collection of three-element subsets of S called blocks, such that every two-element subset of S belongs to exactly one block. STS(7) is the smallest finite projective plane, the Fano plane, and STS(9) is the smallest finite affine plane. In both cases you interpret the elements of S as points and the blocks as…
Euclid’s fifth postulate says that given a line ℓ and a point P not on ℓ , there is a unique line through P parallel to ℓ. In the projective plane there are no parallel lines, and in the hyperbolic plane there are at least two lines through P parallel to ℓ. Recent posts have looked at finite projective and affine planes. This post will look at finite hyperbolic planes. Finite projective planes come up far more often in application than finite hyperbolic planes. I’ve seen several resources on…
The previous post was on finite projective planes. This post will look at finite affine planes and the next will look at finite hyperbolic planes. Affine geometry is essentially what remains of Euclidean geometry if you keep the incidence properties, e.g. wanting to know whether things intersect, and forget about metric properties such as segment lengths and angle measurements. As with projective planes, affine planes can be finite. The axioms of an affine plane are as follows. Any two distinct…
The idea of finite geometries sounds like an oxymoron the first time you hear of it, something like dry water or cold fire, but the axioms of some kinds of geometry can indeed be satisfied by finite models. The axioms of projective plane geometry are as follows. Any two distinct points lie on exactly one line. Any two distinct lines meet in exactly one point. There exist four points, no three of which are collinear. The most famous example of a finite projective plane is the Fano plane. It…
A few years ago I wrote about a curious result: a/b is usually greater than c/d when a + d is greater than b + c. And “usually” means with probability 11/12. As stated in the post, you can make this statement rigorous by choosing integers up to size N at random and taking the limit as N goes to infinity. We can also choose a, b, c, and d uniformly from [0, 1]. This is similar to choosing four integers up to N and dividing all the integers by N, which doesn’t change the probabilities. Now a/b >…
Spherical geometry is very tangible because we live on a sphere. Projective geometry seems much more exotic, and yet they’re closely related. To show how they’re connected, let’s go back to the origins of non-Euclidean geometry. Euclidean geometry Here are Euclid’s five postulates, statements about what geometric objects can be constructred. To draw a straight line from any point to any point. To produce (extend) a finite straight line continuously in a straight line. To describe a circle with…
This post will show how a graphic programmer’s hack could lead to a rigorous definition of the projective plane. As mentioned in the previous post, we start by adding some “points at infinity” to Euclidean plane to take care of exceptional situations. For example, instead of saying most pairs of lines intersect at a single point but some don’t intersect at all, you could say all pairs of lines intersect at a point, but for some pairs of lines, namely parallel lines, that intersection point is…
In my newsletter I give an introduction to the latest few posts and occasionally give some additional commentary. In my latest newsletter I wrote Projective space and homogeneous coordinates seemed like arbitrary abstractions when I was a student because they were presented without any motivation. Much later I came to realize that they’re natural, almost inevitable. Exceptional cases and hand-wavy references to objects “at infinity” go away when moving to projective space. My mathematics…
I wrote several posts on poles and polars a few days ago. First, I wrote about the dual of a spherical triangle, called the polar triangle. Then I wrote about poles and polars in plane geometry and briefly mentioned the extension to projective geometry. Poles and polars are a little awkward in the plane because you have to pay attention to special cases. Poles and polars are relative to a conic section, and are defined/computed differently depending on whether you’re taking the dual with…
The classification of finite simple groups (CFSG) has been called the biggest theorem in mathematics. It is big, not necessarily in terms of its importance, but in the sense that its proof developed over the course of decades and thousands of pages of journal articles. Two days ago Axiom announced it had formalized the proof of CFSG in 43.1 million lines of Lean. If you click on the link for the accompanying paper, you’ll find that the title of the paper is The Unbalanced Group Theorem, not The…
If you have an expression in n Boolean variables, how long does it take to find out whether some assignment of values to the variables makes the expression true? There is an obvious upper bound: you can find out in 2n steps by exhaustive search, trying all possible ways of setting each variable to true or false. You can often do better than exhaustive search for a particular problem, but can you always do better, even in the worst case? The Monien–Speckenmeyer branching algorithm, published in…
The previous three post have been part of a series on geometric duality. The traditional but somewhat mysterious terminology is the pole of a line and the polar of a point. As explained here, the terminology was first coined in the context of spherical geometry where the term “pole” makes sense. It was then extended to the plane where the meaning is less obvious. The use of poles and polars is that they preserve certain geometric information, and so they can transform one problem into a dual…
This blog is the main place I write, but I also use other platforms, either to write new content or to announce blog posts. X (née Twitter) I have a several X accounts, one personal account (@JohnDCook) and several specialized accounts (@CompSciFact, @AlgebraFact, @DataSciFact, etc.). I announce new blog posts on the most relevant account. RSS You can subscribe to the blog via RSS and find out about each post as it’s published. RSS was very popular before Google killed its RSS reader, but it…
The previous two posts have been about polar triangles. The first used a polar triangle to derive a theorem, and the second showed how to compute polars using linear algebra. But what exactly is a polar triangle and why is it called that? Poles and polars on a sphere Let’s start with a sphere S and a great circle G. Then G is the intersection of S with a plane through the center of S. The circle G has two poles, two points on opposite sides of S that are as far as possible (i.e. π/2 radians)…
The previous post defined the polar triangle of a spherical triangle in terms of its sides and angles, but it doesn’t construct the triangle. It only specifies one of a family of triangles located anywhere on the sphere. How do we know that polar triangles exist? There is a geometric construction that starts with a spherical triangle and constructs a unique new spherical triangle, and one can show that this new triangle has the angles and sides described in the previous post. There is also a…
I’ve written before about the law of cosines on a sphere: cos(c) = cos(a) cos(b) + sin(a) sin(b) cos(C). But that’s just one of two laws of cosines on a sphere. The equation above is the law of cosines for sides. The law of cosines for angles is typographically very similar, just inverting the case of the letters used as arguments. cos(C) = cos(A) cos(B) + sin(A) sin(B) cos(c). Two kinds of angles Let’s back up and say what the letters refer to. As is conventional in plane geometry, the sides…
A Python script that worked a few days ago wouldn’t work today. I suspect it might have something to do with my updating everything I could think of in response to recent security breaches. I got an error message that said error: The script contains multiple PEP 723 metadata blocks I searched on what that means, then took out the blank line in my header #!/usr/bin/env -S uv run --script # /// script # dependencies = ["pyperclip"] # /// but I still got the same error message. The script in…
You may have seen references to a password being the number 4. There are countless allusions to this online, but they don’t give the context. As I mentioned in an earlier post, eMudrha was using the numbers 4, 56, 115, 155, 156, 230, and 237 as secret keys. I haven’t seen details of how this happened, but in this post I’ll give a plausible account of how it might have happened, what someone could have done to produce those results. I’m not trying to do forensic analysis on this specific…
An elliptic curve E over a finite field F consists of the set of points (x, y) satisfying the equation y² = x³ + ax + b with x and y in F. Typically in cryptography the field F is the integers mod p where p is a very large prime number. The number of points on E is roughly the number of elements in F. So for a curve over the integers mod p, the curve has roughly p points. More precisely, #E = p + 1 − t where |t| ≤ 2√p. So if p is on the order of 2n, the number of points on E is also on the…
The NIST elliptic curves have been in the news twice lately. A few days ago Anthropic posted a paper on the NIST curve seeds that I wrote about here. Now the curves are in the news again, this time over broken certificates. My post a few days ago was about the possibility that the NSA had added a backdoor to the NIST curves. Anthropic researchers showed that this wasn’t the case. The NSA had not able to defend how the curve seeds were chosen because they forgot, but researchers from Anthropic…
I was watching a video by John Higgins this morning about the poem in Ecclesiastes 3, one of the most famous passages in the Bible. There is a time for everything, and a season for every activity under the heavens: a time to be born and a time to die, a time to plant and a time to uproot, a time to kill and a time to heal, a time to tear down and a time to build, a time to weep and a time to laugh, a time to mourn and a time to dance, a time to scatter stones and a time to gather them, a time…
Splitting N! into N factors is trivial. It’s defined as the product of N integers, the integers 1 through N. Can you still split N! into N factors if you put a minimum size requirement on the factors? You can’t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors ≥ 2: 4! = 24 = 2 × 2 × 2 × 3 Define t(N) as the largest number such that N! can be expressed as the product of integers greater than or equal to t(N). So based on the discussion above, t(N) ≥ 1…
Many words can be spelled by stringing together chemical symbols. For example, sarcasm can be written S Ar Ca Sm using the symbols for sulfur, argon, calcium, and samarium. How would you write a program to determine whether a word can be written by stringing together chemical element abbreviations ignoring case? Obviously this isn’t a practical problem, but it illustrates a practical problem. You could solve the problem with a regular expression: (h|he|li|be|b|c|n|o|f|ne|na|mg|al|si| … |og)+…
NIST published a set of elliptic curves for cryptography in 2000. The seeds for the curves were supplied by the NSA, and cryptographers suspected the agency may have installed backdoors in the curves. And not without reason: the NSA did insert a backdoor in the Dual_EC_DRBG random number generator. Two days ago researchers at Anthropic [1] showed that the NIST curves were not seeded with a backdoor. The rest of this post will give the background necessary to appreciate this result. The security…
This post began as a thread on X last night. I’ve edited the thread to turn it into a blog post, making some additions and corrections. I’m watching 2010: The Year We Make Contact. The movie opens saying the monolith is located at the Lagrange point between Jupiter and Io. I got nerd sniped and wondered where that was. There are five Lagrange points, but presumably the movie refers to L1 or L2 because these are near Io. Lagrange points L3, L4, and L5 are essentially in the orbit of Io, but 60,…
When I wrote about the harmonic triangle yesterday, I displayed the triangle left-aligned using fixed-width text because that was easier than producing the format you usually see for Pascal’s triangle and related triangles. 1 1/2 1/2 1/3 1/6 1/3 1/4 1/12 1/12 1/4 1/5 1/20 1/30 1/20 1/5 … I asked Claude to write a LaTeX package to make it easier to create Pascal-like triangles and it did a great job, including handy features I didn’t think to ask for. You can download it here: numtriangle.sty. I…