<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John D. Cook</title>
	<atom:link href="http://www.johndcook.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.johndcook.com/blog</link>
	<description>Applied Mathematics Consulting</description>
	<lastBuildDate>Sat, 14 Nov 2026 15:54:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.johndcook.com/wp-content/uploads/2020/01/cropped-favicon_512-32x32.png</url>
	<title>John D. Cook</title>
	<link>https://www.johndcook.com/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>The longest polynomial level set</title>
		<link>https://www.johndcook.com/blog/2026/11/14/erdos-lemniscate/</link>
					<comments>https://www.johndcook.com/blog/2026/11/14/erdos-lemniscate/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sat, 14 Nov 2026 15:54:10 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Complex analysis]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248242</guid>

					<description><![CDATA[<p>Let p(z) be a polynomial with leading coefficient 1, i.e. a monic polynomial. What is the maximum length of the curve {z : &#124;p(z)&#124; = 1} for each degree n? Erdős conjectured that the maximum length was obtained by the polynomial p(z) = zn − 1. He was right, as Teng Zhang proved recently. Examples [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/14/erdos-lemniscate/">The longest polynomial level set</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Let <em>p</em>(<em>z</em>) be a polynomial with leading coefficient 1, i.e. a monic polynomial. What is the maximum length of the curve</p>
<p>{<em>z</em> : |<em>p</em>(<em>z</em>)| = 1}</p>
<p>for each degree n?</p>
<p>Erdős conjectured that the maximum length was obtained by the polynomial <em>p</em>(<em>z</em>) = <em>z</em><sup><em>n</em></sup> − 1. He was right, as Teng Zhang proved <a href="https://arxiv.org/abs/2611.12830v1">recently</a>.</p>
<h2>Examples</h2>
<p>Here&#8217;s an example for degree five. The maximum length is obtained by <em>p</em>(<em>z</em>) = <em>z</em><sup>5</sup> − 1.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/erdos_lemniscate1.png" width="400" height="400" /></p>
<p>This curve has length 15.02.</p>
<p>Here&#8217;s the corresponding curve for <em>p</em>(<em>z</em>) = <em>z</em><sup>5</sup> − <em>z</em></p>
<p><img decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/erdos_lemniscate2.png" width="400" height="400" /></p>
<p>which has length 6.909.</p>
<p>In general the level set {<em>z</em> : |<em>p</em>(<em>z</em>)| = 1} need not be connected, in which case the length is the sum of the lengths of the components.</p>
<p>Here&#8217;s an example that tweaks the constant parameter of the optimal curve <em>p</em>(<em>z</em>) = <em>z</em><sup>5</sup> − 1.1.</p>
<p><img decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/erdos_lemniscate3.png" width="400" height="400" /></p>
<p>This curve has (total) length 14.59.</p>
<h2>Details</h2>
<p>The length of the maximum curve for given <em>n</em> is the length for the polynomial <em>p</em>(<em>z</em>) = <em>z</em><sup><em>n</em></sup> − 1. The only curves obtaining the maximum length are translations and rotations of this curve.</p>
<p>Note that for <em>n</em> = 1 the maximum curve is a circle and for <em>n</em> = 2 the curve is the lemniscate of Bernoulli. The general curve is called the Erdős lemniscate of order <em>n</em>, generalizing Bernoulli&#8217;s lemniscate.</p>
<p>The maximum length for given <em>n</em> is</p>
<p style="padding-left: 40px;">2<sup>1/<em>n</em></sup> <em>B</em>(1/<em>n</em>, 1/2<em>n</em>)</p>
<p>where <em>B</em> is the beta function.</p>
<p>The Erdős lemniscates look similar to the &#8220;rose&#8221; curves <em>r</em> = cos(<em>n</em>θ), but these curves are not polynomial level sets.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2023/10/04/lemniscate-functions/">Lemniscate functions</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2023/01/20/cassini-ovals/">Cassini ovals</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/11/14/erdos-lemniscate/">The longest polynomial level set</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/14/erdos-lemniscate/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Peeking inside the bash rabbit hole</title>
		<link>https://www.johndcook.com/blog/2026/11/14/bash-rabbit-hole/</link>
					<comments>https://www.johndcook.com/blog/2026/11/14/bash-rabbit-hole/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sat, 14 Nov 2026 13:09:57 +0000</pubDate>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Unix]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248239</guid>

					<description><![CDATA[<p>I have much bigger issues to be concerned with than saving a few seconds of typing with obscure bash features. But precisely because I have bigger issues on my plate, it&#8217;s fun to take a moment and solve some little tangible problem. The shell !$ saves the last part of the latest command. (Mnemonic: bang [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/14/bash-rabbit-hole/">Peeking inside the bash rabbit hole</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I have much bigger issues to be concerned with than saving a few seconds of typing with obscure bash features. But precisely because I have bigger issues on my plate, it&#8217;s fun to take a moment and solve some little tangible problem.</p>
<p>The shell <code>!$</code> saves the last part of the latest command. (Mnemonic: bang often refers to commands, such as <code>!!</code> to redo the previous command, and cash often refers to the last of something, such as the end of a line in a regular expression.)</p>
<p>This comes in handy, for example, when you copy a file to a directory and then want to cd into that directory.</p>
<pre>
cp myfile /big/long/path
cd !$
</pre>
<p>The <code>!$</code> variable is fragile, however. The sequence of commands</p>
<pre>
cp myfile /big/long/path
ls
cd !$
</pre>
<p>won&#8217;t work because after running <code>ls</code> the variable <code>!$</code> now contains &#8220;ls&#8221; rather than &#8220;/big/long/path&#8221;.</p>
<p>There are two ways to fix this. In the previous example you could change the last command to </p>
<pre>cd !-2:$</pre>
<p>This says go back two commands (<code>!-2</code>) and extract (<code>:</code>) the last argument (<code>$</code>).</p>
<p>Another possibility is </p>
<pre>cd !cp:$</pre>
<p>This says to pull up the most recent command that started with &#8220;cp&#8221; (<code>!cp</code>) and extract the last argument.</p>
<p>This only scratches the surface of conveniences bash offers. To learn about similar features, search on &#8220;history expansion&#8221; or &#8220;event designators.&#8221;</p>
<p>Because bash offers so many shortcuts, it&#8217;s hard to learn any of them from reading the manual: nothing will stick. It reminds me of when I was in Paris and had one hour to see the Louvre. I should have meandered around a room or two and been content with that. Instead, I blitzed through the museum. I wanted to &#8220;see the Louvre&#8221; but I didn&#8217;t really <em>see</em> anything. </p>The post <a href="https://www.johndcook.com/blog/2026/11/14/bash-rabbit-hole/">Peeking inside the bash rabbit hole</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/14/bash-rabbit-hole/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Kepler and the dwarf</title>
		<link>https://www.johndcook.com/blog/2026/11/13/kepler-and-the-dwarf/</link>
					<comments>https://www.johndcook.com/blog/2026/11/13/kepler-and-the-dwarf/#respond</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 13 Nov 2026 14:54:38 +0000</pubDate>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Orbital mechanics]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248230</guid>

					<description><![CDATA[<p>Kepler&#8217;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&#8217;s third law says T² = c a³. Here T is the orbital [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/13/kepler-and-the-dwarf/">Kepler and the dwarf</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/ed138.jpg" alt="ED138 " width="1109" height="894" /></p>
<h2>Kepler&#8217;s third law</h2>
<p>A recent <a href="https://www.smithsonianmag.com/smart-news/astronomers-found-a-mysterious-object-orbiting-far-beyond-pluto-it-could-be-a-new-dwarf-planet-hidden-in-our-solar-system-180989857/">article</a> 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.</p>
<p>I did a back-of-the-envelope calculation and thought something was wrong. Kepler&#8217;s third law says</p>
<p style="padding-left: 40px;"><em>T</em>² = <em>c</em> <em>a</em>³.</p>
<p>Here <em>T</em> is the orbital period and <em>a</em> is the semimajor axis. If <em>T</em> is measured in years and <em>a</em> is measured in astronomical units (AU) then the proportionality constant <em>c</em> equals 1.</p>
<p>If <em>T</em> = 281.1 years, then <em>a</em> = 42.91 AU, not 46 AU.</p>
<h2>Eccentricity</h2>
<p>The difference between 46 AU and 42.91 AU is only a contradiction if we assume the dwarf planet is in a circular orbit. The semimajor axis <em>a</em> is the the maximum distance to the center of the orbit, not the distance to the sun. In an elliptical orbit, the focus of the ellipse where the sun sits is not at the center. The orbit is <em>eccentric</em>, meaning off-center.</p>
<p>Assume the dwarf planet candidate ED138 is in an orbit with semimajor axis 42.91 AU. What does the article mean when it says ED138 is &#8220;46 times farther from the sun than Earth is&#8221;? Does is mean that it is <em>currently</em> 46 AU from the sun, or that its maximum distance from the sun at aphelion is 46 AU? Presumably the latter.</p>
<p>If the distance to the dwarf at aphelion is 46 AU and the semimajor axis is 42.91 AU, then the distance between the sun and the center of the dwarf&#8217;s elliptical orbit is <em>c</em> = 3.09 AU. The eccentricity is then</p>
<p style="padding-left: 40px;"><em>e</em> = <em>c</em>/<em>a</em> = 3.09/46 = 0.067</p>
<p>making the orbit more eccentric than that of Saturn but less than that of Mars. This would make the semiminor axis, the minimum distance to the center of the orbit,</p>
<p style="padding-left: 40px;"><em>b</em> = <em>a</em> √(1 &#8211; <em>e</em>²) = 45.9.</p>
<p>The orbit isn&#8217;t far from circular, but far enough to account for the substantial difference between the distance to the sun and the distance to the center of the ellipse.</p>
<p>This touches on something that has come up <a href="https://www.johndcook.com/blog/2022/10/20/eccentricity/">before</a>, and that is eccentricity doesn&#8217;t affect the shape of an orbit so much as the position of the sun in that orbit. The orbit of ED138 isn&#8217;t far from being circular, but the sun is significantly off-center in that orbit.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2022/10/13/very-nearly-circular/">Planetary orbits are very nearly circular</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/08/18/mean-distance-to-the-sun/">Mean distance to the sun</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/02/28/max-min-orbital-speed/">Max and min orbital speed</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2024/11/15/gps-satellite-orbits/">GPS satellite orbits</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/10/16/monoliths-and-lagrange-points/">Monoliths and Lagrange points</a></li>
</ul>
<p>Image credit: NSF-DOE Vera C. Rubin Observatory / NOIRLab / SLAC /AURA / R. Proctor</p>The post <a href="https://www.johndcook.com/blog/2026/11/13/kepler-and-the-dwarf/">Kepler and the dwarf</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/13/kepler-and-the-dwarf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Long permutations and long cycles</title>
		<link>https://www.johndcook.com/blog/2026/11/13/long-cycles/</link>
					<comments>https://www.johndcook.com/blog/2026/11/13/long-cycles/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 13 Nov 2026 11:59:31 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Probability]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248227</guid>

					<description><![CDATA[<p>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&#8217;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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/13/long-cycles/">Long permutations and long cycles</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>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&#8217;ve produced before, and history will repeat itself. Along the way, some cards may move in smaller cycles than others.</p>
<h2>Example</h2>
<p>For example, consider the permutation</p>
<p style="padding-left: 40px;"><em>p</em> = [5, 6, 2, 1, 0, 8, 3, 4, 9, 7]</p>
<p>that sends <em>i</em> to <em>p</em>(<em>i</em>). Here indices start with 0.</p>
<p>The number 2 is a fixed point: <em>p</em>(2) = 2. So it has a cycle length of 1.</p>
<p>The number 1 is part of a cycle of length 3: <em>p</em>(1) = 6, <em>p</em>(6) = 3, and <em>p</em>(3) = 1.</p>
<p>The longest cycle is [0, 5, 8, 9, 7, 4] which has length 6.</p>
<h2>Longest cycles</h2>
<p>What happens to the length of cycles as you permute longer lists? Obviously the longest <em>possible</em> cycle increases with the length of the list, but what happens to the <em>average</em> length of the longest cycle?</p>
<p>Let <em>L</em><sub><em>n</em></sub> be the length of the longest cycle in a random permutation of <em>n</em> items. You&#8217;d expect the average value of <em>L</em><sub><em>n</em></sub>, written E[<em>L</em><sub><em>n</em></sub>], would increase when <em>n</em> increases. But do they increase at the same rate? Conceivably E[<em>L</em><sub><em>n</em></sub>] goes to infinity as <em>n</em> goes to infinity, but at a slower rate, say proportional to √<em>n</em> rather than proportional to <em>n</em>. Let&#8217;s make a plot to see.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/max_cycle_plot.png" width="1350" height="825" /></p>
<p>There&#8217;s a lot of variance, but the central tendency looks approximately linear in <em>n</em>. Let&#8217;s repeat our experiment, this time creating 100 random permutations of each size and averaging their maximum cycle lengths.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/avg_max_cycle_plot.png" width="1350" height="825" /></p>
<p>As we&#8217;d expect from the central limit theorem, averaging over 100 samples reduced the scatter by about a factor of 10.</p>
<p>It appears that the expected value of the maximum cycle length grows in proportion to <em>n</em>, and in fact the expected value is somewhere around 0.6<em>n</em>. In the example at the top of the post, the longest cycle is <em>exactly</em> 0.6<em>n</em>. I didn&#8217;t plan that: the permutation example was chosen at random.</p>
<h2>Asymptotic value</h2>
<p>The limit of the ratio E[<em>L</em><sub><em>n</em></sub>]/<em>n</em> is known to be</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/golomb_dickman.svg" alt="\lim_{n\to\infty} \frac{\text{E}[L_n]}{n} = \int_0^1 \exp(\text{li}(t)) \, dt = 0.6243\ldots" width="350" height="49" /></p>
<p>Shepp and Lloyd [1] proved the result above. The constant on the right hand side is known as the Golomb-Dickman constant. I think Golomb investigated E[<em>L</em><sub><em>n</em></sub>]/<em>n</em> and had found that there was a limiting value, but Shepp and Lloyd were the first to give a closed-form expression for the limit. Dickman had run into the same constant in a theorem in number theory. </p>
<p>[1] L. A. Shepp and S. P. Lloyd, “Ordered Cycle Lengths in a Random Permutation,” Transactions of the American Mathematical Society, vol. 121, no. 2, pp. 340–357, February 1966.</p>The post <a href="https://www.johndcook.com/blog/2026/11/13/long-cycles/">Long permutations and long cycles</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/13/long-cycles/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Balanced Incomplete Block Designs</title>
		<link>https://www.johndcook.com/blog/2026/11/10/bibd/</link>
					<comments>https://www.johndcook.com/blog/2026/11/10/bibd/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 10 Nov 2026 14:26:21 +0000</pubDate>
				<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Design theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248218</guid>

					<description><![CDATA[<p>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 sections, and apply each fertilizer to a section. That&#8217;s fine if you have one big enough plot of land, and the land itself doesn&#8217;t matter. If the fertilizer supplies [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/10/bibd/">Balanced Incomplete Block Designs</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Suppose you have <em>n</em> different fertilizers you want to test. The simplest experiment would be to take a big plot of land, divide it into <em>n</em> sections, and apply each fertilizer to a section. That&#8217;s fine if you have one big enough plot of land, and the land itself doesn&#8217;t matter.</p>
<p>If the fertilizer supplies a nutrient that is already abundant in a particular soil, you won&#8217;t see as much benefit from that fertilizer on that soil. Plots of land will vary in other ways besides soil composition—some may receive more sun than others, some may have better drainage, etc.—that may interact with the effect of the fertilizer. So you&#8217;d like to test your fertilizers on several different plots of land. Call the number of plots <em>b</em>.</p>
<p>Suppose each of your plots is large enough to test <em>q</em> &lt; <em>n</em> fertilizers, i.e. the plots are not large enough to test every fertilizer on every plot. You would like to design your experiment so that each fertilizer is tested the same number of times, and so that every pair of fertilizers is tested somewhere on the same plot of land for a direct comparison.</p>
<p>The resulting experimental design is called a <b>balanced incomplete block design</b> or <b>BIBD</b>. The blocks are the plots of land. The design is incomplete because you cannot test everything on every plot. The design is balanced because every pair of fertilizers is tested together the same number of times. BIBDs are important in the <a href="https://www.johndcook.com/blog/2022/11/21/design/">design of experiments</a>.</p>
<p>A BIBD is a special case of the <a href="https://www.johndcook.com/blog/2026/11/09/combinatorial-designs/">combinatorial designs</a> discussed in the previous post with parameters (<em>n</em>, <em>q</em>, 2, λ), i.e. the parameter <em>r</em> is set to 2 because you want every pair to appear in some number of blocks.</p>
<p>A design with parameters (<em>n</em>, <em>q</em>, <em>r</em>, λ) is sometimes called an <em>r</em>-(<em>n</em>, <em>q</em>, λ) design [1]. <a href="https://www.johndcook.com/blog/2026/11/09/steiner-systems/">Steiner systems</a> correspond to λ = 1 and BIBDs correspond to <em>r</em> = 2.</p>
<p>While the number of blocks <em>b</em> is of interest, it is not an independent parameter. For combinatorial designs in general the number of blocks is determined by the other parameters:</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/number_of_blocks.svg" alt="b = \lambda \frac{\binom{n}{r}}{\binom{q}{r}}" width="69" height="54" /></p>
<p>Similarly, you may see the number of blocks each treatment appears in given as a parameter, but this count is also determined by the other parameters, namely</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/replications.svg" alt="\lambda \frac{\binom{n-1}{r-1}}{\binom{q-1}{r-1}}" width="52" height="60" /></p>
<h2>Examples</h2>
<p>Here is a design to test <em>n</em> = 6 treatments on <em>b</em> = 10 plots, testing <em>q</em> = 3 treatments on each plot, with each pair of treatments (i.e. <em>r</em> = 2) appearing in λ = 2 plots, i.e. a (6, 3, 2) design.</p>
<pre>    0000011122
    1123423433
    2345554545
</pre>
<p>The way to read this is that each treatment is a number 0 through 5, and each column indicates the treatments tested in a particular block (plot).</p>
<p>Here is another example, an (8, 4, 3) design: <em>n</em> = 8 treatments, blocks of size <em>q</em> = 4, with each pair of treatments being tested in λ = 3 blocks.</p>
<pre>    00000001111222
    11123342334334
    22554666455455
    34675777677766
</pre>
<p>[1] Combinatorial designs are sometimes called <em>t</em>-designs, which makes sense if you denote the size of the set you&#8217;re looking for in each block by <em>t</em> but not if you denote it by <em>r</em>. You&#8217;ll see both conventions. And while we&#8217;re mentioning notational variations, the number of treatments is sometimes denoted <em>v</em> for variety, going back to agricultural applications, testing crop varieties.</p>The post <a href="https://www.johndcook.com/blog/2026/11/10/bibd/">Balanced Incomplete Block Designs</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/10/bibd/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Combinatorial designs</title>
		<link>https://www.johndcook.com/blog/2026/11/09/combinatorial-designs/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 10 Nov 2026 01:38:48 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Design theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248212</guid>

					<description><![CDATA[<p>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, [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/09/combinatorial-designs/">Combinatorial designs</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The last several posts have been building up to this one, moving from tangible to more abstract.</p>
<p>The posts on <a href="https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/">finite geometry</a> gave examples of Steiner triples and more generally Steiner systems, introduced in the <a href="https://www.johndcook.com/blog/2026/11/09/steiner-systems/">previous post</a>. Combinatorial designs take this one step further.</p>
<p>The previous post gave the following definition:</p>
<p style="padding-left: 40px;">A Steiner triple system, written STS(<em>n</em>), is a collection of <strong>three</strong>-element subsets, called blocks, of a set <em>X</em> with <em>n</em> elements, such that every <strong>two</strong>-element subset of <em>X</em> belongs to exactly <strong>one</strong> block.</p>
<p>The post pointed out that the smallest projective plane is STS(7) and the smallest affine plane is STS(9).</p>
<p>The post then defined a general Steiner system:</p>
<p style="padding-left: 40px;">A Steiner system <em>S</em>(<em>t</em>, <em>k</em>, <em>n</em>) is a collection of <strong><em>k</em></strong>-element subsets, called blocks, of a set <em>X</em> with <em>n</em> elements, such that every <strong>t</strong>-element subset of <em>X</em> belongs to exactly <strong>one</strong> block.</p>
<p>Moving from Steiner triples to Steiner systems we generalized the size of the blocks from 3 to <em>k</em>, and generalized the size of sets contained in a unique block from 2 to <em>t</em>.</p>
<p>Combinatorial designs take this one step further by generalizing the number of blocks that a set of <em>t</em> elements falls in from 1 to λ.</p>
<p>Unfortunately when we go from Steiner systems to combinatorial designs the notation changes and the order of the parameters changes.</p>
<p style="padding-left: 40px;">A design with parameters (<em>n</em>, <em>q</em>, <em>r</em>, λ) is a collection of <em>q</em>-element subsets of an <em>n</em>-element set <em>X</em> such that every <em>r</em>-element subset of <em>X</em> is contained in exactly λ blocks.</p>
<p>So a Steiner system <em>S</em>(<em>t</em>, <em>k</em>, <em>n</em>) corresponds to a (<em>n</em>, <em>k</em>, <em>t</em>, 1) design.</p>
<h2>Existence of designs</h2>
<p>Given a set of parameters (<em>n</em>, <em>q</em>, <em>r</em>, λ) there may or may not exist a design with these parameters. It&#8217;s easy to show that a few consistency conditions are necessary. It was long conjectured that these conditions were sufficient, except possibly for a finite number of values of <em>n</em>. Peter Keevash proved in 2024 that the conjecture is correct.</p>
<p>Theorem [1]: Fix <em>q</em> &gt; <em>r</em> ≥ 1 and λ ≥ 1. There is an <em>N</em>, depending on <em>q</em>, <em>r</em>, and λ, such that for every <em>n</em> &gt; <em>N</em> with</p>
<p><img loading="lazy" decoding="async" class="aligncenter" style="background-color: white;" src="https://www.johndcook.com/designs.svg" alt="\left. \binom{q-i}{r-i} \;\middle|\; \lambda\binom{n-i}{r-i} \right." width="135" height="48" /><br />
for all 0 ≤ <em>i</em> ≤ <em>r</em>, a design with parameters (<em>n</em>, <em>q</em>, <em>r</em>, λ) exists.</p>
<p>[1] Peter Keevash. The existence of designs. https://arxiv.org/abs/1401.3665v4</p>
<p class="p2">The post <a href="https://www.johndcook.com/blog/2026/11/09/combinatorial-designs/">Combinatorial designs</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Steiner Systems</title>
		<link>https://www.johndcook.com/blog/2026/11/09/steiner-systems/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 17:01:43 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Design theory]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248186</guid>

					<description><![CDATA[<p>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 collection of three-element subsets, called blocks, of a set X with n elements, such that every two-element subset of X belongs to exactly one block. STS(7) is the smallest finite projective [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/09/steiner-systems/">Steiner Systems</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<h2>Steiner triples</h2>
<p>Several examples from the <a href="https://www.johndcook.com/blog/2026/11/08/finite-geometries/">recent</a> <a href="https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/">posts</a> on finite geometry are special cases of Steiner triples.</p>
<p>A Steiner triple system, written STS(<em>n</em>), is a collection of three-element subsets, called blocks, of a set <em>X</em> with <em>n</em> elements, such that every two-element subset of <em>X</em> belongs to exactly one block.</p>
<p>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 <em>S</em> as points and the blocks as lines.</p>
<p>Several questions come up naturally. First, for which values of <em>n</em> does an STS(<em>n</em>) exist? A necessary and sufficient condition for existence is that <em>n</em> = 1 or 3 mod 6.</p>
<p>For a given <em>n</em>, can there be more than one STS(<em>n</em>), i.e. are there Steiner triple systems of the same size that are not isomorphic? Yes indeed. The number of non-isomorphic instances grows rapidly with <em>n</em>.</p>
<p>When does (some instance of) STS(<em>n</em>) correspond to a projective or affine space? When <em>n</em> = 2<sup><em>k</em></sup> − 1 for <em>k</em> ≥ 3. For <em>n</em> ≥ 13 there are multiple isomorphism classes of STS(<em>n</em>), so for <em>k</em> &gt; 3 there will be an instance of STS(2<sup><em>k</em></sup> − 1) that corresponds to a projective space and other instances that do not. The instance that does correspond to a projective plane will be isomorphic to a finite field analog of the real projective plane.</p>
<h2>Steiner systems</h2>
<p>Steiner triple systems are a special case of Steiner systems.</p>
<p>A Steiner system <em>S</em>(<em>t</em>, <em>k</em>, <em>n</em>) is a collection of <em>k</em>-element subsets, called blocks, of a set <em>X</em> with <em>n</em> elements, such that every t-element subset of <em>X</em> belongs to exactly one block. Steiner triples are <em>S</em>(2, 3, <em>n</em>) systems.</p>
<p>Steiner systems often correspond to finite geometries with the blocks interpreted as lines. As with the special case of triples, there can be non-isomorphic instances of Steiner systems, and so when I say below that <em>S</em>(<em>t</em>, <em>k</em>, <em>n</em>) corresponds to a certain geometry, I mean that at least one instance corresponds to that geometry.</p>
<h3>Projective</h3>
<p>The Steiner system</p>
<p style="padding-left: 40px;"><em>S</em>(2, <em>q</em> + 1, (<em>q</em><sup><em>d</em> + 1</sup> − 1)/(<em>q</em> − 1))</p>
<p>with <em>q</em> a prime power greater than 2 is a <em>d</em>-dimensional projective space.</p>
<h3>Affine</h3>
<p>The space</p>
<p style="padding-left: 40px;"><em>S</em>(2, <em>q</em>, <em>q</em><sup><em>d</em></sup>)</p>
<p>is an affine space. Again <em>q</em> &gt; 2 is a prime power.</p>
<h3>Hyperbolic</h3>
<p>The finite hyperbolic plane given as an example in an earlier post corresponds to <em>S</em>(2, 2, 6). Many other Steiner systems are hyperbolic, but I&#8217;m not aware of a tidy classification similar to the ones above.</p>
<h2>Steiner systems outside geometry</h2>
<p>Steiner systems were named after Swiss mathematician Jakob Steiner because he published a highly cited article asking questions about what we now call Steiner triples. His interest in these systems was combinatorial. Others developed the connections to geometry later.</p>
<p>Steiner systems arise in several areas of mathematics outside of geometry, including coding theory, design of experiments, and graph theory.</p>The post <a href="https://www.johndcook.com/blog/2026/11/09/steiner-systems/">Steiner Systems</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Finite hyperbolic planes</title>
		<link>https://www.johndcook.com/blog/2026/11/09/finite-hyperbolic-planes/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 14:26:09 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248199</guid>

					<description><![CDATA[<p>Euclid&#8217;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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/09/finite-hyperbolic-planes/">Finite hyperbolic planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.johndcook.com/blog/2026/11/03/spherical-and-projective-geometry/">Euclid&#8217;s fifth postulate</a> says that given a line ℓ and a point <em>P</em> not on ℓ , there is a unique line through <em>P</em> parallel to ℓ. In the projective plane there are no parallel lines, and in the hyperbolic plane there are at least two lines through <em>P</em> parallel to ℓ.</p>
<p>Recent posts have looked at finite projective and affine planes. This post will look at finite hyperbolic planes.</p>
<p>Finite projective planes come up far more often in application than finite hyperbolic planes. I&#8217;ve seen several resources on finite geometries that don&#8217;t mention the hyperbolic case. Finite hyperbolic geometries have less structure than their projective or affine counterparts and so are less useful.</p>
<p>The definition of a finite hyperbolic plane isn&#8217;t entirely standardized. We will use the following axioms for this post.</p>
<ol>
<li>Any two distinct points lie on exactly one line.</li>
<li>Given a line ℓ and a point <em>P</em> not on ℓ, there exist at least two lines through <em>P</em> parallel to ℓ.</li>
<li>There exist four points, no three collinear.</li>
<li>Every line contains at least two points.</li>
</ol>
<p>An example of a system satisfying these axioms is the complete graph of six vertices. The nodes are the points and the edges are the lines. In set-theoretic terms, the points are the one-element subsets of {1, 2, 3, 4, 5, 6} and the lines are all possible two-element subsets.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/k6.png" alt="Complete graph K6" width="360" height="405" /></p>
<p>Note that lines in the finite hyperbolic plane are two element sets. The lines {5, 6} and {1, 3}, for example, are parallel because they do not intersect, even though the <em>representations</em> of {5, 6} and {1, 3} in the visualization above are not parallel in the Euclidean sense.</p>
<p>There are many other examples of system satisfying the hyperbolic plane axioms. Too many in some sense. You could say finite hyperbolic systems are less common in application because they are more common in count.</p>
<h2>Discrete geometry posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2026/11/08/finite-geometries/">Finite projective planes</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/">Finite affine planes</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/11/09/finite-hyperbolic-planes/">Finite hyperbolic planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Finite Affine Planes</title>
		<link>https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 14:21:49 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248190</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/">Finite Affine Planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The previous post was on <a href="https://www.johndcook.com/blog/2026/11/08/finite-geometries/">finite projective planes</a>. This post will look at finite affine planes and the next will look at <a href="https://www.johndcook.com/blog/2026/11/09/finite-hyperbolic-planes/">finite hyperbolic planes</a>.</p>
<p>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.</p>
<p>The axioms of an affine plane are as follows.</p>
<ol dir="ltr">
<li>Any two distinct points lie on exactly one line.</li>
<li>For any line ℓ and point <em>P</em> not on ℓ, there is exactly one line through <em>P</em> that doesn’t intersect ℓ.</li>
<li>There exist three points that are not collinear.</li>
</ol>
<p>The second axiom says that affine geometry is Euclidean, or maybe Euclidean-lite. It lacks features of Euclidean geometry, but it doesn&#8217;t contradict Euclidean geometry.</p>
<p>To construct an example of a finite affine plane, let <em>p</em> be an odd prime and construct a <em>p</em> × <em>p</em> grid with <em>x</em>&#8211; and <em>y</em>-coordinates 0, 1, 2, …, <em>p</em> − 1. The affine lines are essentially the Euclidean lines that pass through the grid points, if lines can wrap around the sides, i.e. you&#8217;re working on a discrete torus. Algebraically, lines are the solutions to <em>x</em> = <em>c</em> and <em>y</em> = <em>mx</em> + <em>b</em> mod <em>p</em>.</p>
<p>A finite affine plane always has <em>n</em>² points and <em>n</em>² + <em>n</em> lines. The number <em>n</em> can be an odd prime, or any prime power greater than 2. It is unknown whether there are examples in which <em>n</em> is not a prime power. There are no affine planes of order 6 or 10, and the case of <em>n</em> = 12 is open.</p>The post <a href="https://www.johndcook.com/blog/2026/11/09/finite-affine-planes/">Finite Affine Planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Finite Projective Planes</title>
		<link>https://www.johndcook.com/blog/2026/11/08/finite-geometries/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 08 Nov 2026 23:23:49 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248184</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/08/finite-geometries/">Finite Projective Planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>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.</p>
<p>The axioms of projective plane geometry are as follows.</p>
<ol dir="ltr">
<li>Any two distinct points lie on exactly one line.</li>
<li>Any two distinct lines meet in exactly one point.</li>
<li>There exist four points, no three of which are collinear.</li>
</ol>
<p>The most famous example of a finite projective plane is the Fano plane.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/fano_numbered.png" alt="Fano plane illustrtation" width="517" height="397" /></p>
<p>It helps to switch back and forth between thinking of finite geometries geometrically and in terms of set theory. The fact that the Fano plane has an easy-to-understand illustration is fortunate, but not to be taken for granted. Also, it could be misleading to lean to heavily on the fact that the lines and points of finite geometry can, in this case, be represented by points and line segments (and a circle) in the Euclidean plane.</p>
<p>The set-theoretic perspective is that the points are the one-element sets {1}, {2}, …, {7}, and the lines are the sets listed in the legend of the graph: {1, 2, 5}, {1, 3, 7}, …, {5, 6, 7}. It&#8217;s simple to confirm that any pair of points lines in exactly one of the three-element sets, that the intersection of any pair of the three-element sets is a one-element set, and that there are three points—1, 2, 3, and 4 will do—such that no three lie on the same line, i.e. no three belong to the same three-element set.</p>
<p>The Fano plane is the unique projective plane with 7 points, but there are four non-equivalent projective planes with 10 points.</p>
<p>There are many other examples of non-isomorphic finite projective planes with the same number of points, but there are also many unsettled conjectures, at least as of an hour ago, regarding the existence of finite projective planes of various orders.</p>
<p>Finite geometry might seem like a technicality, spaces that satisfy the axioms but are not what anyone had in mind when the axioms were codified. So why care about finite geometries? For one thing, unexpected examples are quite valuable since they help separate the consequences of a set of axioms from common expectations.</p>
<p>For another, finite geometries come up in applications, such as combinatorics and cryptography. These discrete applications take advantage of intuition from traditional geometry. This intuition is an imperfect guide, so conclusions need to be verified by concrete calculations, but geometric intuition suggests what one ought to verify.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2025/08/11/misleading-plots-of-elliptic-curves/">Misleading plots of elliptic curves</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2024/07/22/linear-systems-over-finite-fields/">Linear systems over finite fields</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2022/04/25/projective-duality/">Projective duality</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/11/08/finite-geometries/">Finite Projective Planes</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Fraction comparison trick revisited</title>
		<link>https://www.johndcook.com/blog/2026/11/03/fraction-comparison-trick-revisited/</link>
					<comments>https://www.johndcook.com/blog/2026/11/03/fraction-comparison-trick-revisited/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 03 Nov 2026 14:41:25 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Probability]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248181</guid>

					<description><![CDATA[<p>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 &#8220;usually&#8221; 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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/03/fraction-comparison-trick-revisited/">Fraction comparison trick revisited</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.johndcook.com/blog/2021/02/25/fraction-comparison-trick/">A few years ago</a> I wrote about a curious result: <em>a</em>/<em>b</em> is usually greater than <em>c</em>/<em>d</em> when <em>a </em>+ <em>d</em> is greater than <em>b </em>+ <em>c</em>. And &#8220;usually&#8221; means with probability 11/12.</p>
<p>As stated in the post, you can make this statement rigorous by choosing integers up to size <em>N</em> at random and taking the limit as <em>N</em> goes to infinity.</p>
<p>We can also choose <em>a</em>, <em>b</em>, <em>c</em>, and <em>d</em> uniformly from [0, 1]. This is similar to choosing four integers up to <em>N</em> and dividing all the integers by <em>N</em>, which doesn&#8217;t change the probabilities.</p>
<p>Now <em>a</em>/<em>b</em> &gt; <em>c</em>/<em>d</em> if and only if <em>ad</em> &gt; <em>bc</em>, so another way to state the theorem is that</p>
<p style="padding-left: 40px;">Prob(<em>ad</em> &gt; <em>bc </em>| <em>a</em> + <em>d</em> &gt; <em>b</em> + <em>c</em>) = 11/12.</p>
<p>Or to state it yet another way, pick two pairs of numbers at random. The probability that the pair with the larger sum also has the larger product is 11/12. That seems more intuitive to me than the original statement.</p>
<p>If <em>a</em> + <em>d</em> is greater than <em>b</em> + <em>c</em>, it&#8217;s likely that <em>a</em>/<em>b</em> is greater than <em>c</em>/<em>d</em>. It seems plausible that if <em>a</em> + <em>d</em> is <em>much</em> greater than <em>b</em> + <em>c</em>, it&#8217;s <em>more</em> likely that <em>a</em>/<em>b</em> is greater than <em>c</em>/<em>d</em>. Or in terms of cross products, the more the sum of one pair is bigger than the sum of the other, the more likely the product of the former is to be greater than the latter. That is</p>
<p style="padding-left: 40px;"><em>f</em>(<em>r</em>) = Prob(<em>ad</em> &gt; <em>bc </em>| (<em>a</em> + <em>d</em>)/(<em>b</em> + <em>c</em>) ≥ <em>r</em>)</p>
<p>should be an increasing function of <em>r</em>. We know the probability above equals 11/12 when <em>r</em> = 1. We expect that the probability should approach 1 as <em>r</em> goes to infinity.</p>
<p>This is indeed the case, as shown in the plot below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium" src="https://www.johndcook.com/f_of_r.png" width="480" height="380" /></p>
<p>In particular, <em>f</em>(2) ≈ 0.99 and <em>f</em>(6) ≈ 0.999. So if <em>a</em> + <em>d</em> is two (or six) times bigger than <em>b +</em> c, there is a 0.99 (or 0.999) probability that <em>ad</em> is larger than <em>bc</em>.</p>
<p>You can calculate <em>f</em>(<em>r</em>) analytically or estimate it by simulation. I had Claude do both and they produce comparable results. There is a closed-form expression for <em>f</em>(<em>r</em>) but it&#8217;s really complicated.</p>The post <a href="https://www.johndcook.com/blog/2026/11/03/fraction-comparison-trick-revisited/">Fraction comparison trick revisited</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/03/fraction-comparison-trick-revisited/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Euclidean, Spherical, and Projective Geometry</title>
		<link>https://www.johndcook.com/blog/2026/11/03/spherical-and-projective-geometry/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 03 Nov 2026 12:33:10 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248173</guid>

					<description><![CDATA[<p>Spherical geometry is very tangible because we live on a sphere. Projective geometry seems much more exotic, and yet they&#8217;re closely related. To show how they&#8217;re connected, let&#8217;s go back to the origins of non-Euclidean geometry. Euclidean geometry Here are Euclid&#8217;s five postulates, statements about what geometric objects can be constructred. To draw a straight line from [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/03/spherical-and-projective-geometry/">Euclidean, Spherical, and Projective Geometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Spherical geometry is very tangible because we live on a sphere. Projective geometry seems much more exotic, and yet they&#8217;re closely related. To show how they&#8217;re connected, let&#8217;s go back to the origins of non-Euclidean geometry.</p>
<h2>Euclidean geometry</h2>
<p>Here are Euclid&#8217;s five postulates, statements about what geometric objects can be constructred.</p>
<ol>
<li>To draw a straight line from any point to any point.</li>
<li>To produce (extend) a finite straight line continuously in a straight line.</li>
<li>To describe a circle with any centre and distance (radius).</li>
<li>That all right angles are equal to one another.</li>
<li>That, if a straight line falling on two straight lines makes the interior angles on the same side less than two right angles, the two straight lines, if produced indefinitely, meet on that side on which the angles are less than two right angles.</li>
</ol>
<p>Clearly there&#8217;s something different about the fifth postulate, the parallel postulate. It&#8217;s much longer and more complicated than the other postulates. There was speculation from ancient times that the parallel postulate might be unnecessary, that it could be derived as a theorem rather than stated as an axiom.</p>
<h2>Non-Euclidean geometry</h2>
<p>Giovanni Girolamo Saccheri (1667–1733) tried to prove the fifth postulate by contradiction, and in the process began the study of non-Euclidean geometry. He wasn&#8217;t the first to try to prove the fifth postulate. Ptolemy, for example, tried to prove the fifth postulate as a theorem in the second century AD. But Saccheri was the first to try a proof by contradiction, or at least the first to extensively explore contradictions to the parallel postulate.</p>
<p>A more modern formulation of the parallel postulate says</p>
<p style="padding-left: 40px;">Given a line <em>ℓ</em> and a point <em>P</em> not on <em>ℓ</em>, there is exactly one line through <em>P</em> parallel to <em>ℓ</em>.</p>
<p>Non-Euclidean geometry replaces this axiom with an alternative, such as saying there are multiple lines parallel to <em>ℓ </em>or that there are no lines parallel to <em>ℓ</em>.</p>
<p>Note that non-Euclidean geometry is not an arbitrary tinkering with the axioms of geometry just to see what happens. It tinkers with one specific axiom for motivated reasons.</p>
<h2>Spherical geometry</h2>
<p>You can create models of non-Euclidean geometry using Euclidean geometry. For example, spherical geometry is constructed by defining a (spherical) point as a (Euclidean) point on a sphere, and defining a (spherical) line to be a great circle, the intersection of a (Euclidean) plane with the sphere. In spherical geometry there are no parallel lines: all lines intersect.</p>
<p>This example shows that non-Euclidean geometry need not be non-physical. If you leave general relativity out of the picture and think of physical space as undeniably Euclidean, it can still be useful to think of different geometries to describe objects in Euclidean space.</p>
<h2>Projective geometry</h2>
<p>In projective geometry, all distinct lines intersect at one point.</p>
<p>In spherical geometry, all distinct lines intersect at two points, on opposite sides of a great circle. If you consider antipodal pairs of points on a sphere to be a single point in the projective plane, now all lines intersect at a single point. Projective geometry is just one step away from spherical geometry.</p>
<p>The recent thread of posts started with a <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">post</a> a couple weeks ago about two versions of the law of cosines on a sphere, one for sides and one for angles. You can go from one to the other by going from a spherical triangle to its polar triangle. That started me going down the rabbit hole of poles and polars, first in spherical geometry, then in plane geometry, then in projective geometry, culminating <a href="https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/">here</a>.</p>
<p>Now we have two ways of producing poles and polars on a sphere: the original construction in terms of spherical geometry, and the projective construction. They are consistent: you can do spherical geometry, then identify antipodal points, or you can identify antipodal points, then do projective geometry. You end up at the same place by either path.</p>
<p>One theme in the last few posts has been that projective geometry is not an arbitrary exercise in abstraction but a framework that can simplify how we think about things. For example, when I defined the polar triangle of a spherical triangle <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">here</a>, I said that the vertices of the polar triangle are the poles of the sides of the original triangle. Imagine the side as the equator of the sphere and take one of the poles; that&#8217;s where the abstract concept of &#8220;pole&#8221; comes from. But which pole do you take? There is a convention for answering this question, but in projective geometry it doesn&#8217;t matter: both (spherical) poles constitute one (projective) point.</p>
<h2>Posts in this series</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2026/10/24/polar-triangle/'>Duality in spherical trig</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/10/25/poles-and-polars/'>Poles and polars</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/10/26/inversion-in-an-ellipse/'>Inversion in an ellipse</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/'>Unified view of poles and polars</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/11/02/projective-plane/'>Making peace with the projective plane</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/'>From a hack to a rigorous definition</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/11/03/spherical-and-projective-geometry/">Euclidean, Spherical, and Projective Geometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How a programming might reinvent the projective plane</title>
		<link>https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/</link>
					<comments>https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 03 Nov 2026 10:45:19 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248174</guid>

					<description><![CDATA[<p>This post will show how a graphic programmer&#8217;s hack could lead to a rigorous definition of the projective plane. As mentioned in the previous post, we start by adding some &#8220;points at infinity&#8221; to Euclidean plane to take care of exceptional situations. For example, instead of saying most pairs of lines intersect at a single [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/">How a programming might reinvent the projective plane</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>This post will show how a graphic programmer&#8217;s hack could lead to a rigorous definition of the projective plane.</p>
<p>As mentioned in the <a href="https://www.johndcook.com/blog/2026/11/02/projective-plane/">previous post</a>, we start by adding some &#8220;points at infinity&#8221; 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&#8217;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 &#8220;at infinity.&#8221;</p>
<p>Suppose you need to write a program to find the intersection of two lines. The usual way of doing this would be to implement a <a href="https://www.johndcook.com/blog/2021/12/06/partial-functions/">partial function</a> that takes two lines as input, and sometimes returns a point of intersection and sometimes does something else: it crashes, or throws an exception, or hangs. But if we add in points at infinity, our program could always return a point.</p>
<p>But how are you going to represent points at infinity? It&#8217;s not enough to use a floating point infinity, because different lines intersect at different points at infinity. For example, the lines <em>y</em> = 1 and <em>y</em> = 2 intersect at the point at infinity in the horizontal direction, but the lines <em>x</em> = 1 and <em>x</em> = 2 intersect at the point at infinity in the vertical direction. You could say the former lines intersect at (o, inf) and the latter at (inf, 0), but that won&#8217;t work in general.</p>
<p>The lines <em>y</em> = 3<em>x</em> + 1 and <em>y</em> = 3<em>x</em> + 1 intersect at the point at infinity with slope 3, but the lines <em>y</em> = 5<em>x</em> + 1 and <em>y</em> = 5<em>x</em> + 1 intersect at the point at infinity with slope 5. If you say both pairs of lines meet at (inf, inf) you&#8217;ve lost information.</p>
<p>So you come up with a hack. You represent points not as (<em>x</em>, <em>y</em>) pairs but as (<em>x</em>, <em>y</em>, <em>f</em>) where <em>x</em> and <em>y</em> are real numbers but <em>f</em> is a Boolean flag. Now (<em>x</em>, <em>y</em>, true) represents the ordinary point (<em>x</em>, <em>y</em>) and (<em>x</em>, <em>y</em>, false) represents the point at infinity in the direction of the line from the origin to (<em>x</em>, <em>y</em>). Problem solved!</p>
<p>After a while, you realize that this hack can be useful for more than just finding the intersection of lines. You discover that if you use a real number instead of a Boolean for the last coordinate, you can implement translations and rotations using matrix multiplication. So you replace true and false with 1 and 0, do your matrix calculation, then divide by the last coordinate so the result ends in 1 or 0 again. And this works really well.</p>
<p>This last coordinate is starting to act more like the other coordinates. You treat it as a peer when you multiply triples by a matrix, but only temporarily. You immediately normalize at the end to get back to more familiar territory.</p>
<p>Maybe it occurs to you after a while that you&#8217;re doing something analogous the introduction of imaginary numbers. At first the square root of −1 was seen as a hack that produced correct answers. It wasn&#8217;t <em>really</em> a number but something <em>imagined</em> to be a number as an aid to calculation. Over time mathematicians got more comfortable with these imaginary numbers and explored what would happen if they were treated as first class citizens. Maybe you should do the same with this third coordinate that started out as a hack.</p>
<p>This leads you to homogenous coordinates. A point in the extended plane you&#8217;ve created is represented by a triple (<em>x</em>, <em>y</em>, <em>z</em>) with the understanding that given a number λ ≠ 0, (<em>x</em>, <em>y</em>, <em>z</em>) and (λ<em>x</em>, λ<em>y</em>, λ<em>z</em>) represent the same point. This is the natural extension of always dividing by the last coordinate, if it&#8217;s not zero, so that the triple always ends in 1. And you discover after a while that you need to add in the requirement that not all the coordinates can be zero at the same time.</p>
<p>You show this to a mathematician friend and he puts your construction in fancier language. He says you&#8217;re extended plane is ℝ³ minus the origin, modulo non-zero scalar multiplication. In other words, the points in your extended plane are equivalence classes of points in ℝ³.</p>
<p>Now if you think about this geometrically, your equivalence classes are lines through the origin because that&#8217;s what you get when you look at all scalar multiples of a given vector. What started out as the plane with extra points added is now the set of all lines though the origin. That&#8217;s one way to define the projective plane: a point in the projective plane corresponds to a line through the origin in ℝ³. Furthermore, a line in the projective plane corresponds to a plane through the origin in ℝ³.</p>
<p>Lines through the origin are determined by where they cross the unit sphere, so you could think of the projective plane as a sphere with one modification: because a line through the origin crosses the sphere in two antipodal points, we consider those two points in ℝ³ to be a single point in the projective plane.</p>The post <a href="https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/">How a programming might reinvent the projective plane</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Making peace with the projective plane</title>
		<link>https://www.johndcook.com/blog/2026/11/02/projective-plane/</link>
					<comments>https://www.johndcook.com/blog/2026/11/02/projective-plane/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 02 Nov 2026 14:44:02 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Algebraic geometry]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248151</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/02/projective-plane/">Making peace with the projective plane</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>In my newsletter I give an introduction to the latest few posts and occasionally give some additional commentary. In my latest newsletter I wrote</p>
<blockquote><p>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.</p></blockquote>
<p>My mathematics education was very top-down: abstractions first, specifics later (if ever). I was OK with that for a while, until I hit my abstraction tolerance sometime in grad school. Now I would advocate more of a bottom-up approach, motivating abstractions first rather than presenting them as a <em>fait accompli</em>.</p>
<p>The first time I saw the projective plane was probably in a topology class where someone said you could construct the plane by starting with a square and gluing opposite edges in a physically impossible way. This seemed like a gimmick, a way to construct a non-orientable manifold but not anything practical. Another construction is to say the projective plane is an ordinary sphere with antipodal points identified. I found that a little more satisfying, but it still unmotivated.</p>
<p>What I would have appreciated was someone saying that the projective plane was invented to make geometry more elegant by eliminating exceptional cases and making rigorous the idea of things &#8220;at infinity.&#8221; For example, geometric calculations often have to treat vertical lines specially, but vertical lines are not special in projective geometry.</p>
<p>You could start by saying we&#8217;re going to represent points in the plane not simply as (<em>x</em>, <em>y</em>) but as (<em>x</em>, <em>y</em>, 1) and use (<em>x</em>, <em>y</em>, 0) for the point at infinity in the direction (<em>x</em>, <em>y</em>). That may seem like a hack, but it&#8217;s certainly motivated. It&#8217;s exactly the sort of thing a graphics programmer would do. In fact, I imagine many programmers have done just that, independently bumping into projective geometry.</p>
<p>After having introduced this extra coordinate, it&#8217;s natural to ask what would it mean if the last coordinate were something other than 0 or 1. You&#8217;ll quickly run into this when you start doing calculations on these extended coordinates. You could have a rule that you always normalize by dividing by the last coordinate, if it&#8217;s not zero, and then you have essentially discovered homogeneous coordinates. (<strong>Update</strong>; I develop this idea in more detail in the <a href="https://www.johndcook.com/blog/2026/11/03/hack-to-rigor/">next post</a>.)</p>
<p>You&#8217;ll see something like the approach above in elliptic curve cryptography. Programmers wanting to implement encryption algorithms are thinking concretely in terms of (<em>x</em>, <em>y</em>) points, until they have to worry about a mysterious &#8220;point at infinity&#8221; and handle it correctly. Then homogenous coordinates appear as a tool for getting out of a bind.</p>
<p style="text-align: center;">***</p>
<p>I thought about titling this post something like &#8220;Dr. Strangelove, or: How I Learned to Stop Worrying and and Love the Projective Plane&#8221; but I wasn&#8217;t sure how well that would go over. I doubt many readers have seen the 1964 movie this is alluding to, but the trope &#8220;How I Learned to Stop Worrying and Love …&#8221; is more widely known than the movie itself.</p>The post <a href="https://www.johndcook.com/blog/2026/11/02/projective-plane/">Making peace with the projective plane</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/02/projective-plane/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>A unified view of poles and polars</title>
		<link>https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/</link>
					<comments>https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 01 Nov 2026 20:29:54 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Algebraic geometry]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248142</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/">A unified view of poles and polars</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I wrote several posts on poles and polars a few days ago. First, I wrote about the dual of a spherical triangle, called the <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">polar triangle</a>. Then I wrote about <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">poles and polars</a> in plane geometry and briefly mentioned the extension to projective geometry.</p>
<p>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&#8217;re taking the dual with respect to an <a href="https://www.johndcook.com/blog/2026/10/26/inversion-in-an-ellipse/">ellipse</a>, parabola, or hyperbola. Also, the polar of the center of a conic section isn&#8217;t defined.</p>
<h2>Projective space</h2>
<p>If you move from the Euclidean plane to the projective plane, the exceptions go away, though it may not seem so if you&#8217;re talking about points at infinity or lines at infinity. If you fully commit to working in projective space, there aren&#8217;t any hand-wavy points or lines &#8220;at infinity.&#8221; There&#8217;s not even a distinction between ellipses, parabolas, and hyperbolas.</p>
<p>There&#8217;s no such thing as a free lunch, and the cost of this elegant unification is moving to a bigger geometric space with a different coordinate system. Instead of working in the Euclidean spaces <em>R</em>² or <em>R</em><sup><em>n</em></sup>, we work in <em>P</em><sup><em>n</em></sup> over a field <em>F</em> which could be <em>R</em> but doesn&#8217;t need to be [1].</p>
<p>The coordinates on <em>P</em><sup><em>n</em></sup> are homogeneous coordinates, (<em>n</em> + 1)-tuples of field elements, not all equal to zero, with two (<em>n</em> + 1)-tuples representing the same point if they are proportional, i.e. one is a non-zero multiple of the other.</p>
<p>We can embed <em>R</em><sup><em>n</em></sup> in <em>P</em><sup><em>n</em></sup> by adding an extra coordinate on the end, set equal to 1. You could think of this extra coordinate as a <strong>switch</strong>, set to 1 for finite points and set to 0 for infinite points. But this distinction between finite and infinite points is an artifact of the embedding, not a property of <em>P</em><sup><em>n</em></sup>: there are no special points in <em>P</em><sup><em>n</em></sup>. A point that is &#8220;at infinity&#8221; in one embedding of <em>R</em><sup><em>n</em></sup> in <em>P</em><sup><em>n</em></sup> need not be in another embedding.</p>
<h2>Poles and polars</h2>
<p>Once you accept the need to work in homogeneous coordinates, everything becomes simple and consistent.</p>
<p>A quadric (a conic section when <em>n</em> = 2) is the set of points</p>
<p style="padding-left: 40px;">{<em>x</em> : <em>x</em>ᵀ<em>A</em><em>x</em> = 0}</p>
<p>where <em>A</em> is a non-singular (<em>n</em> + 1) by (<em>n</em> + 1) symmetric matrix over <em>F</em>.</p>
<p>The <strong>polar</strong> of a point <em>p</em> is the hyperplane</p>
<p style="padding-left: 40px;">{<em>x</em> : <em>p</em>ᵀ<em>A</em><em>x</em> = 0}</p>
<p>and the <strong>pole</strong> of a hyperplane</p>
<p style="padding-left: 40px;"><em>H</em> = {<em>x</em> : <em>u</em>ᵀ<em>x</em> = 0}</p>
<p>is the point</p>
<p style="padding-left: 40px;"><em>p</em> = <em>A</em><sup>−1</sup> <em>u</em>.</p>
<p>Notice there&#8217;s no mention of &#8220;infinity&#8221; in this section. All the calculations take place in the field <em>F</em> with no points at infinity added.</p>
<p>[1] The only requirement is that the field <em>F</em> cannot have characteristic 2. So <em>F</em> could be the reals, the rationals, the complex numbers, etc. <em>F</em> could even be a finite field as long as the number of elements in <em>F</em> is not a power of 2.</p>The post <a href="https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/">A unified view of poles and polars</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/11/01/projective-poles-and-polars/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>The Unbalanced Group Theorem</title>
		<link>https://www.johndcook.com/blog/2026/10/28/the-unbalanced-group-theorem/</link>
					<comments>https://www.johndcook.com/blog/2026/10/28/the-unbalanced-group-theorem/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 28 Oct 2026 11:51:51 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Group theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248136</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/28/the-unbalanced-group-theorem/">The Unbalanced Group Theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>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.</p>
<p>Two days ago <a href="https://cfsg.axiommath.ai/">Axiom</a> 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&#8217;ll find that the title of the paper is <strong>The Unbalanced Group Theorem</strong>, not The Classification of Finite Simple Groups. Why is that?</p>
<p>The unbalanced group theorem (UGT) is a key component of the CFSG. In the course of their effort to formalize CFSG Axiom found counterexamples to an assertion that the 1986 proof of UGT depends on. The UGT, and the CFSG that depends on it, is correct, but the proof was flawed. Axiom formalized the entire CFSG but focused their paper on their new proof of the UGT.</p>
<p style="text-align: center;">***</p>
<p>What exactly does the UGT say? For that matter, what is a finite simple group?</p>
<p>A short post like this can only go into so much detail, but I&#8217;ll see what I can do.</p>
<p>A group represents some kind of symmetry. Groups can be built out of simple groups sorta like the way integers can be built out of primes. See more on the comparison between simple groups and prime numbers <a href="https://www.johndcook.com/blog/2023/09/26/prime-numbers-simple-groups/">here</a>.</p>
<p>The CFSG says that every finite simple group is cyclic, alternating, of Lie type, or sporadic. The UGT is a technical result used in proving that nothing is missing from this list of possibilities.</p>
<p>What does it mean for a group to be &#8220;unbalanced&#8221;? This depends on a few preliminary definitions.</p>
<ul>
<li>Define <em>O</em>(<em>G</em>) to be the largest normal subgroup of <em>G</em> with an odd number of elements.</li>
<li>An element <em>t</em> in <em>G</em> is called an involution if it has order 2: <em>t</em> is not the identity but <em>t</em>² is.</li>
<li>The centralizer of an element <em>t</em> of a group <em>G</em>, written <em>C</em><sub><em>G</em></sub>(<em>t</em>), is the set of elements of G that commute with <em>t</em>.</li>
</ul>
<p>A group <em>G</em> is <strong>unbalanced</strong> if <em>O</em>(<em>C</em><sub><em>G</em></sub>(<em>t</em>)) is a not a subgroup of <em>O</em>(<em>G</em>) for some involution <em>t</em>.</p>
<p>The UGT is a classification theorem for unbalanced groups.</p>
<h2>Related posts</h2>
<ul>
<li class='link'><a href='https://www.johndcook.com/blog/2020/08/27/how-big-is-the-monster/'>How big is the monster?</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2018/09/02/orders-of-finite-simple-groups/'>Orders of finite simple groups</a></li>
<li class='link'><a href='https://www.johndcook.com/blog/2018/09/09/duplication-in-cfsg/'>Overlaps in the CFSG</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/10/28/the-unbalanced-group-theorem/">The Unbalanced Group Theorem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/28/the-unbalanced-group-theorem/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>The Exponential Time Hypothesis is False</title>
		<link>https://www.johndcook.com/blog/2026/10/27/eth-false/</link>
					<comments>https://www.johndcook.com/blog/2026/10/27/eth-false/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 27 Oct 2026 12:13:21 +0000</pubDate>
				<category><![CDATA[Computational Complexity]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[SAT solvers]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248129</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/27/eth-false/">The Exponential Time Hypothesis is False</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>If you have an expression in <em>n</em> 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 2<sup><em>n</em></sup> steps by exhaustive search, trying all possible ways of setting each variable to true or false.</p>
<p>You can often do better than exhaustive search for a particular problem, but can you <em>always</em> do better, even in the worst case? The Monien–Speckenmeyer branching algorithm, published in 1985, is more efficient than exhaustive search, but it still takes exponential time.</p>
<h2>3-SAT</h2>
<p>The Boolean satisfiability problem (SAT) asks whether a Boolean expression in conjunctive normal form (<a href="https://www.johndcook.com/blog/seven-normal-forms-in-logic/">CNF</a>) can be satisfied by some assignment of values to the variables. The <em>k</em>-SAT problem is the special case of SAT in which no clause contains more than <em>k</em> variables. The 2-SAT problem can be solved in polynomial time, but the case of the 3-SAT problem is unknown.</p>
<p>The 3-SAT problem is NP-complete, and so if there is a polynomial-time algorithm for solving 3-SAT, every NP problem, including the full SAT problem, can be solved in polynomial time, i.e. P = NP.</p>
<p>The Monien–Speckenmeyer algorithm mentioned above can solve a 3-SAT problem in</p>
<p style="padding-left: 40px;"><em>O</em>( |<em>F</em>| φ<sup><em>n</em></sup> )</p>
<p>time, where |<em>F</em>| is the length of the input formula and φ is the golden ratio. Now φ &lt; 2, and so this is better than exhaustive search, but the run time is still exponential in the number of variables <em>n</em>.</p>
<h2>ETH</h2>
<p>The exponential time hypothesis (ETH) claims that 3-SAT requires exponential time, which would imply P ≠ NP. <a href="https://hexagonmath.org/2610.00577v1">Anthropic</a> and <a href="https://github.com/openai/math/blob/main/preprints/The-Exponential-Time-Hypothesis-is-False-October-25-2026/paper.pdf">OpenAI</a> have both published proofs that ETH is false. The status of P = NP is still unknown: while 3-SAT does not take exponential time, it still takes more than polynomial time as far as anyone knows.</p>
<p>Yesterday Shiva Kintali posted <a href="https://shivakintali.github.io/papers/ETH.pdf">A simplified proof of ETH is false</a>. The abstract of the paper says</p>
<p style="padding-left: 40px;">For every fixed ε &gt; 0, we give a deterministic 3-SAT algorithm on <i>n</i> variables and <i>m</i> clauses using</p>
<p style="padding-left: 80px;"><i>C</i><sub><i>ε</i></sub>(<i>n</i> + <i>m</i> + 1)<sup><i>c</i><sub><i>ε</i></sub></sup> 2<sup><i>εn</i></sup></p>
<p style="padding-left: 40px;">bit operations, refuting ETH. Our simplified exposition of OpenAI’s proof combines sparsification, bounded occurrences, spectral replacement, and rational interpolation.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2025/07/31/machine-learning-by-satisfiability-solving/">Machine learning by satisfiability solving</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/05/11/one-hot-sat/">Formulating the eight queens problem as a SAT problem</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/03/17/lessons-learned-with-the-z3-sat-smt-solver/">Lessons learned using the Z3 SAT/SMT solver</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/10/27/eth-false/">The Exponential Time Hypothesis is False</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/27/eth-false/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Inversion in an ellipse</title>
		<link>https://www.johndcook.com/blog/2026/10/26/inversion-in-an-ellipse/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 26 Oct 2026 18:39:32 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248125</guid>

					<description><![CDATA[<p>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 &#8220;pole&#8221; makes sense. It was then extended to the [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/26/inversion-in-an-ellipse/">Inversion in an ellipse</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The previous three post have been part of a series on geometric duality. The traditional but somewhat mysterious terminology is the <em>pole</em> of a line and the <em>polar</em> of a point. As explained <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">here</a>, the terminology was first coined in the context of spherical geometry where the term &#8220;pole&#8221; makes sense. It was then extended to the plane where the meaning is less obvious.</p>
<p>The use of poles and polars is that they preserve certain geometric information, and so they can transform one problem into a dual problem. This was illustrated in the <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">first post</a> in the series. Equations in spherical trigonometry have a buy-one-get-one-free property: applying an identity to the dual of a triangle gives another identity.</p>
<p><a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">This post</a> discussed how to define the pole of a line and the polar of a point with respect to a circle in the plane. The post stated that more generally you can do this in the projective plane. Since there&#8217;s no difference between conic sections in the projective plane, anything you can do for a circle you can do for an ellipse or hyperbola.</p>
<p>Given a point <em>P</em>, we can define its polar line geometrically or algebraically.</p>
<h2>Algebraic approach</h2>
<p>Given an ellipse with equation</p>
<p style="padding-left: 40px;"><em>x</em>²/<em>a</em>² + <em>y</em>²/<em>b</em>² = 1</p>
<p>where <em>a</em> &gt; <em>b</em>, the foci are at ± <em>c</em> where <em>c</em> = √(<em>a</em>² − <em>b</em>²).</p>
<p>For a point <em>P</em> = (<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>), its polar with respect to the ellipse is the line</p>
<p style="padding-left: 40px;">(<em>x</em><sub>0</sub>/<em>a</em>²) <em>x</em> + (<em>y</em><sub>0</sub>/<em>b</em>²) <em>y</em> = 1.</p>
<h2>Geometric approach</h2>
<p>To find the polar of a point <em>P</em>, we start by inverting <em>P</em> in the ellipse. Draw any line through <em>P</em> that meets the ellipse at two points <em>A</em> and <em>B</em>. On that line there is exactly one point Q that divides <em>AB</em> harmonically with <em>P</em>:</p>
<p style="padding-left: 40px;">QA/QB = PA/PB</p>
<p dir="ltr">with <em>Q</em> on the opposite side of <em>AB</em> from <em>P</em> if <em>P</em> is inside the ellipse, or between <em>A</em> and <em>B</em> if <em>P</em> is outside. The polar is the line through <em>Q</em> parallel to the tangent at <em>R</em>, where <em>R</em> is the point where the ray <em>OP</em> meets the ellipse.</p>
<h2>Focus and directrix</h2>
<p>Plane and projective geometry are very mature and so some of the terminology sounds quaint. One such term is the <em>directrix</em> of a conic section, explained <a href="https://www.johndcook.com/blog/2022/10/20/directrix-of-a-conic/">here</a>. The polar of a focus is a directrix, and the pole of a directrix is a focus.</p>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">Polar triangles and linear algebra</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2022/04/25/projective-duality/">Projective duality</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2022/11/21/ellipses-and-elliptic-integrals/">Posts on ellipses</a></li>
</ul>The post <a href="https://www.johndcook.com/blog/2026/10/26/inversion-in-an-ellipse/">Inversion in an ellipse</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Where else to find me</title>
		<link>https://www.johndcook.com/blog/2026/10/26/where-to-find-me/</link>
					<comments>https://www.johndcook.com/blog/2026/10/26/where-to-find-me/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 26 Oct 2026 12:04:54 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248119</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/26/where-to-find-me/">Where else to find me</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>This blog is the main place I write, but I also use other platforms, either to write new content or to announce blog posts.</p>
<h2>X (née Twitter)</h2>
<p>I have a <a href="https://www.johndcook.com/blog/twitter_page/">several X accounts</a>, one personal account (@JohnDCook) and several specialized accounts (@CompSciFact, @AlgebraFact, @DataSciFact, etc.). I announce new blog posts on the most relevant account.</p>
<h2>RSS</h2>
<p>You can subscribe to the blog via <a href="https://www.johndcook.com/blog/rss-feed/">RSS</a> and find out about each post as it&#8217;s published.</p>
<p>RSS was very popular before Google killed its RSS reader, but it still works just fine. I use RSS to subscribe to the blogs I read.</p>
<p>The hard part of using RSS is finding a reader you like. I use Inoreader. I&#8217;m sure an LLM could help you find an RSS reader for your preferences and help you get started using it.</p>
<h2>Mathstodon &amp; Bluesky</h2>
<p>I announce my math-related posts on Mathstodon at <a href="https://mathstodon.xyz/@johndcook">mathstodon.xyz/@johndcook</a>. I also use a service that repeats my Mathstodon posts to Bluesky at <a href="https://bsky.app/profile/johndcook.mathstodon.xyz.ap.brid.gy">johndcook.mathstodon.xyz.ap.brid.gy</a>.</p>
<p>I don&#8217;t know why, but more people have started following me on Mathstodon over the last couple weeks.</p>
<h2>Substack</h2>
<p>Some people like to get email notifications of posts. I used two or three services that sent out such emails and they all stopped working. I tried out Substack and it has worked smoothly ever since.</p>
<p>My Substack <a href="https://www.johndcook.com/blog/newsletter/">newsletter</a> has evolved into a bit more than just blog post announcements. I give a little intro to each post and some additional info such as how a sequence of posts are related or ideas that occurred to me after writing the post.</p>
<h2>LinkedIn</h2>
<p>Once in a while I post something to <a href="https://www.linkedin.com/in/johndcook/">LinkedIn</a>. If you&#8217;d like to know more about my background, you can see my profile there.</p>The post <a href="https://www.johndcook.com/blog/2026/10/26/where-to-find-me/">Where else to find me</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/26/where-to-find-me/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Poles and polars</title>
		<link>https://www.johndcook.com/blog/2026/10/25/poles-and-polars/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 25 Oct 2026 19:45:05 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248115</guid>

					<description><![CDATA[<p>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&#8217;s start with a sphere S and a [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">Poles and polars</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The previous two posts have been about polar triangles. The first <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">used</a> a polar triangle to derive a theorem, and the second showed how to <a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">compute</a> polars using linear algebra. But what exactly <em>is</em> a polar triangle and why is it called that?</p>
<h2>Poles and polars on a sphere</h2>
<p>Let&#8217;s start with a sphere <em>S</em> and a great circle <em>G</em>. Then <em>G</em> is the intersection of <em>S</em> with a plane through the center of <em>S</em>. The circle <em>G</em> has two <strong>poles</strong>, two points on opposite sides of <em>S</em> that are as far as possible (i.e. π/2 radians) from <em>G</em>. If you rotate the sphere so that <em>G</em> is the equator, the poles are the north and south pole.</p>
<p>Conversely, if you start with a point <em>P</em> on the sphere <em>S</em>, the <strong>polar</strong> of <em>P</em> is the great circle for which <em>P</em> is a pole. So if you think of <em>P</em> as the north pole, the polar of <em>P</em> is the equator. The term <em>equator</em> would have been more intuitive than <em>polar</em>, but the terminology was established a couple centuries ago.</p>
<p>In my opinion it would be clearer to call poles and polars both <strong>duals</strong>. The dual of a great circle is a point, and the dual of a point is a great circle.</p>
<p>Now let&#8217;s look at a spherical triangle <em>ABC</em> sides <em>a</em>, <em>b</em>, and <em>c</em>. The vertices of the <strong>polar triangle</strong> of <em>ABC</em> are the poles of the sides <em>a</em>, <em>b</em>, and <em>c</em>. This definition is essentially correct, but it needs a little refinement.</p>
<p>The pole <em>A</em>′ of the side <em>a</em> is one of the two poles of the great circle containing <em>a</em>, the one that that lies in the same hemisphere as <em>A</em>. Define <em>B</em>′ and <em>C</em>′ similarly, and the polar triangle is the spherical triangle with vertices <em>A</em>′<em>B</em>′<em>C</em>′.</p>
<h2>Poles and polars in the plane</h2>
<p>The terms <em>pole</em> and <em>polar</em> were coined for spherical geometry, then generalized to plane (projective) geometry. If you think of great circles as the lines of spherical geometry, then you can carry the idea of poles and polars over to plane geometry where the pole (dual) of a line is a point, and the polar (dual) of a point is a line.</p>
<p>However, in the plane you can&#8217;t define the pole of a line without more context. You have to start with a circle (or more generally a conic section) and define the pole of a line <em>with respect to the circle</em> and the define the polar of a point <em>with respect to the same circle</em>.</p>
<p>Given a circle <em>S</em> with center <em>O</em>, to find the polar of a point <em>P</em> ≠ <em>O</em>, let <em>Q</em> be the <a href="https://www.johndcook.com/blog/2022/04/19/inversion-in-a-circle/">inversion</a> of <em>P</em> in <em>S</em>, and let ℓ be the line through <em>Q</em> perpendicular to the line <em>OP</em>.</p>
<p>Conversely, the pole of a line ℓ with respect to a circle <em>S</em> is the inversion of <em>Q</em> in <em>S</em> where <em>Q</em> is the intersection of ℓ with <em>OQ</em>. Here we assume the line ℓ does not pass through the center of the circle <em>O</em> because otherwise <em>O</em> = <em>Q</em> and it doesn&#8217;t make sense to speak of the line <em>OQ</em>.</p>
<h2>Projective geometry</h2>
<p>The definitions above have a couple holes that can be filled in by extending the Euclidean plane to the projective plane.</p>
<p>We defined the pole of a line ℓ except when ℓ passes through the center of the circle. If ℓ passes through <em>O</em> then the pole of ℓ is the point at infinity in the direction of ℓ. Similarly, we defined the polar of all points except <em>O</em>. In projective geometry, we can define the polar of <em>O</em> to the be the line at infinity, the line containing all the points at infinity.</p>The post <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">Poles and polars</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Computing polar triangles with linear algebra</title>
		<link>https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 25 Oct 2026 01:01:55 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Geometry]]></category>
		<category><![CDATA[Linear algebra]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248109</guid>

					<description><![CDATA[<p>The previous post defined the polar triangle of a spherical triangle in terms of its sides and angles, but it doesn&#8217;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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">Computing polar triangles with linear algebra</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">previous post</a> defined the polar triangle of a spherical triangle in terms of its sides and angles, but it doesn&#8217;t construct the triangle. It only specifies one of a family of triangles located anywhere on the sphere.</p>
<p>How do we know that polar triangles exist? There is a <a href="https://www.johndcook.com/blog/2026/10/25/poles-and-polars/">geometric construction</a> 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.</p>
<p>There is also a linear algebraic construction of polar triangles, and that&#8217;s the topic of this post. In a nutshell, take your sphere to be the unit sphere in 3D. Write the coordinates of each vertex as the columns of a matrix. Invert that matrix and normalize each row. Then the rows are the coordinates of the polar vertices.</p>
<p>This process is an involution: the polar of the polar of a triangle is the original triangle.</p>
<p>The following Python code illustrates the process described above. It begins with a triangle on the globe with vertices <em>A</em>, <em>B</em>, and <em>C</em> at Chicago, Quito, and Paris respectively. It computes the polar triangle, then computes the polar of that, and shows that the result is the original triangle.</p>
<pre>import numpy as np

def latlon_to_cartesian(lat_deg, lon_deg):
    lat = np.radians(lat_deg)
    lon = np.radians(lon_deg)
    x = np.cos(lat) * np.cos(lon)
    y = np.cos(lat) * np.sin(lon)
    z = np.sin(lat)
    return np.array([x, y, z])

def cartesian_to_latlon(v):
    v = v / np.linalg.norm(v)
    lat = np.degrees(np.arcsin(np.clip(v[2], -1, 1)))
    lon = np.degrees(np.arctan2(v[1], v[0]))
    return lat, lon

def polar_triangle(M):
    """
    Polar triangle via matrix inversion.
    M: 3×3 matrix with columns = unit vectors of the original vertices.
    Returns 3×3 matrix whose columns are the polar unit vectors.
    """
    Minv = np.linalg.inv(M)
    # Normalize each row of the inverse (rows are parallel to the polar directions)
    polar_rows = Minv / np.linalg.norm(Minv, axis=1, keepdims=True)
    return polar_rows.T          # columns = polar vertices

# Original vertices (Chicago, Quito, Paris)
A = latlon_to_cartesian(41.85003, -87.65005)
B = latlon_to_cartesian(-0.22985, -78.52495)
C = latlon_to_cartesian(48.85341,  2.3488)

M = np.column_stack([A, B, C])
print("M (columns = original vertices):\n", M)
print("det(M) =", np.linalg.det(M))

# Polar triangle
M_prime = polar_triangle(M)
print("\nM' (columns = polar vertices):\n", M_prime)

print("\nPolar geographic coordinates (lat, lon):")
for name, col in zip(["A'", "B'", "C'"], range(3)):
    print(name, cartesian_to_latlon(M_prime[:, col]))

# Polar of the polar
M_double = polar_triangle(M_prime)
print("\nPolar-of-polar matrix:\n", M_double)
print("max |difference from original M| =",
      np.max(np.abs(M_double - M)))
</pre>The post <a href="https://www.johndcook.com/blog/2026/10/24/computing-polar-triangles/">Computing polar triangles with linear algebra</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Duality in spherical trigonometry</title>
		<link>https://www.johndcook.com/blog/2026/10/24/polar-triangle/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 25 Oct 2026 00:28:20 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Differential geometry]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248107</guid>

					<description><![CDATA[<p>I&#8217;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&#8217;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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">Duality in spherical trigonometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve written before about the <a href="https://www.johndcook.com/blog/2022/08/24/law-of-cosines-on-a-sphere/">law of cosines on a sphere</a>:</p>
<p style="padding-left: 40px;">cos(<em>c</em>) = cos(<em>a</em>) cos(<em>b</em>) + sin(<em>a</em>) sin(<em>b</em>) cos(<em>C</em>).</p>
<p>But that&#8217;s just one of two laws of cosines on a sphere. The equation above is the law of cosines <strong>for sides</strong>. The law of cosines <strong>for angles</strong> is typographically very similar, just inverting the case of the letters used as arguments.</p>
<p style="padding-left: 40px;">cos(<em>C</em>) = cos(<em>A</em>) cos(<em>B</em>) + sin(<em>A</em>) sin(<em>B</em>) cos(<em>c</em>).</p>
<p>Incidentally, the law of cosines for sides shows how the sides of a spherical triangle determine the angles. The law of cosines for angles shows how, unlike in the case of plane geometry, angles determine the sides.</p>
<h2>Two kinds of angles</h2>
<p>Let&#8217;s back up and say what the letters refer to. As is conventional in plane geometry, the sides of a triangle are <em>a</em>, <em>b</em>, and <em>c</em>, and the angles are <em>A</em>, <em>B</em>, and <em>C</em>, with <em>a</em> being the side opposite the angle <em>A</em>, and similarly for the other letters.</p>
<p>However, unlike plane geometry, the sides are also angles, but of a different sort. The sides <em>a</em>, <em>b</em>, and <em>c</em> are <strong>central angles</strong>, and the &#8220;angles&#8221; <em>A</em>, <em>B</em>, and <em>C</em> are <strong>dihedral angles</strong>.</p>
<p>The sides are arcs of a great circle. The side <em>a</em>, for example, is a portion of a great circle, running between the vertices at <em>B</em> and <em>C</em> [1]. Think of a plane that contains the center of the sphere <em>O</em> and the vertices <em>B</em> and <em>C</em>. The length of <em>a</em> is the angle at <em>O</em>.</p>
<p>The angles <em>A</em>, <em>B</em>, and <em>C</em> are the angles at which great circles meet. In the formalism of differential geometry, these angles exist in the tangent plane at the vertices. These angles are <strong>intrinsic</strong>, measured along the (tangent plane of) the surface of the sphere. The central angles are <strong>extrinsic</strong>, measured in a plane that cuts through the sphere to its center.</p>
<h2>Polar triangles</h2>
<p>Now because sides are angles and vertices are angles, we can interchange the two kinds of angles to form the <strong>polar triangle</strong> of the original triangle. This is a new triangle whose central angles are the complements of the original dihedral angles, and whose dihedral angles are the complements of the original central angles. In symbols,</p>
<p style="padding-left: 40px;"><em>a</em>′ = π − <em>A</em><br />
<em>b</em>′ = π − <em>B</em><br />
<em>c</em>′ = π − <em>C</em><br />
<em>A</em>′ = π − <em>a</em><br />
<em>B</em>′ = π − <em>b</em><br />
<em>C</em>′ = π − <em>c</em></p>
<p>Now we return to the laws of cosines at the top of the post: the law of cosines for angles is the law of cosines for sides applied to the polar triangle. Every equation in spherical trigonometry has a polar counterpart.</p>
<p>&nbsp;</p>
<p>[1] There&#8217;s some overloaded terminology here, just as in plane geometry. The symbol <em>a</em> is used to denote a side of a triangle and also the length of that side. The symbol <em>A</em> is used to denote both a vertex and the dihedral angle at that vertex.</p>The post <a href="https://www.johndcook.com/blog/2026/10/24/polar-triangle/">Duality in spherical trigonometry</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Working around a strange Python problem</title>
		<link>https://www.johndcook.com/blog/2026/10/22/pep-723/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 15:12:10 +0000</pubDate>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248104</guid>

					<description><![CDATA[<p>A Python script that worked a few days ago wouldn&#8217;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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/pep-723/">Working around a strange Python problem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>A Python script that worked a few days ago wouldn&#8217;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.</p>
<p>I got an error message that said</p>
<pre>error: The script contains multiple PEP 723 metadata blocks</pre>
<p>I searched on what that means, then took out the blank line in my header</p>
<pre>#!/usr/bin/env -S uv run --script

# /// script
# dependencies = ["pyperclip"]
# ///
</pre>
<p>but I still got the same error message.</p>
<p>The script in question copies miscellaneous snippets of text to the clipboard for me. One of those snippets is the header block that uv requires. The script contains the header block marker <code># ///</code>, and that was the source of the problem.</p>
<p>According to Grok</p>
<blockquote><p>The PEP 723 parser is purely textual (it uses a regex that scans the whole file). It does not understand Python syntax, so the <code># ///</code> sequences inside your triple-quoted string are treated as a second metadata block.</p></blockquote>
<p>It suggested changing my quoted string to use <code># / / /</code> and then take out the extra spaces:</p>
<pre>"""#!/usr/bin/env -S uv run --script
# / / / script
# dependencies = ["numpy", "matplotlib"]
# / / /
import numpy as np
import matplotlib.pyplot as plt
""".replace("# / / /", "# ///")
</pre>
<p>This is a dirty hack, but it works.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/pep-723/">Working around a strange Python problem</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How the eMudrha certificate debacle might have happened</title>
		<link>https://www.johndcook.com/blog/2026/10/22/certificate-debacle/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 14:01:55 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Cryptography]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248100</guid>

					<description><![CDATA[<p>You may have seen references to a password being the number 4. There are countless allusions to this online, but they don&#8217;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&#8217;t seen details of how this [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/certificate-debacle/">How the eMudrha certificate debacle might have happened</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>You may have seen references to a password being the number 4. There are countless allusions to this online, but they don&#8217;t give the context.</p>
<p>As I mentioned in an <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">earlier post</a>, eMudrha was using the numbers 4, 56, 115, 155, 156, 230, and 237 as secret keys. I haven&#8217;t seen details of how this happened, but in this post I&#8217;ll give a plausible account of how it <strong>might</strong> have happened, what someone could have done to produce those results. I&#8217;m not trying to do forensic analysis on this specific incident, just exploring what someone might do.</p>
<p>eMudrha was using the NIST elliptic curve P-384, and a secret key should be a random number chosen between 1 and 2<sup>384</sup>. That upper bound isn&#8217;t exactly correct, but it&#8217;s close. See <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">this post</a> if you want to know the exact number.</p>
<p>Someone might have chosen numbers up to 384 rather than 2<sup>384</sup> out of ignorance. Or they might done so by a typo. Maybe they generated a random value that might have been larger than 2<sup>384</sup> and then intended to reduce the number mod 2<sup>384</sup>, but instead of typing </p>
<pre>% 2**384</pre>
<p>they typed </p>
<pre>% 384</pre>
<p>It seems more likely, however, that somehow someone took one byte of a random value because all the keys are less than 2<sup>8</sup> = 256.</p>
<p>The probability of choosing seven numbers from 1 to 384 and all being less than or equal to 237 is around 0.034. But the same probability for numbers chosen between 1 and 256 is about 0.60.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/certificate-debacle/">How the eMudrha certificate debacle might have happened</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The number of points on an elliptic curve</title>
		<link>https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 11:08:51 +0000</pubDate>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Elliptic curves]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248094</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">The number of points on an elliptic curve</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>An elliptic curve <em>E</em> over a finite field <em>F</em> consists of the set of points (<em>x</em>, <em>y</em>) satisfying the equation</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em>³ + <em>ax</em> + <em>b</em></p>
<p>with <em>x</em> and <em>y</em> in <em>F</em>. Typically in cryptography the field <em>F</em> is the integers mod <em>p</em> where <em>p</em> is a very large prime number.</p>
<p>The number of points on <em>E</em> is roughly the number of elements in <em>F</em>. So for a curve over the integers mod <em>p</em>, the curve has roughly <em>p</em> points.</p>
<p>The next section will give an intuitive argument for why the number of points on <em>E</em> should be roughly the number of elements in <em>F</em>. Then the next section will give a rigorous bound. Then after that we&#8217;ll work through an example.</p>
<h2>Hand-wavy estimate</h2>
<p>For a prime <em>p</em>, half the non-zero integers mod <em>p</em> have a square root and half do not. The ones that do have a square root have two square roots. For example, look at the integers mod 7. The numbers 1, 2, and 4 have square roots but the numbers 3, 5, and 6 do not. Here&#8217;s a little bit of Python to verify this.</p>
<pre>&gt;&gt;&gt; [x**2 % 7 for x in range(1,7)]
[1, 4, 2, 2, 4, 1]
</pre>
<p>Now if we wanted to count the number of solutions to</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em> (mod <em>p</em>)</p>
<p>we&#8217;d find it equals <em>p</em>. That&#8217;s because (0, 0) is a point on the curve, and for (<em>p</em> − 1)/2 values of <em>x</em> there are two values of <em>y</em>, and for the remaining values of <em>x</em> there are no values of <em>y</em>.</p>
<p>To put it another way, if we pick a value of <em>x</em> at random, it will have two square roots or no square roots with roughly equal probability.</p>
<p>Now suppose we pick an <em>x</em> at random and compute <em>x</em>³ + <em>ax</em> + <em>b</em>. We might guess that this process scatters <em>x</em> values in an unbiased way, being no more likely to produce a square than a non-square. Our guess turns out to be approximately correct, though there may be a small bias in favor of squares or non-squares.</p>
<h2>Precise bound</h2>
<p>Hasse&#8217;s theorem gives a precise bound on the number of points on an elliptic curve <em>E</em>. It says</p>
<p style="padding-left: 40px;">#<em>E</em> = <em>p</em> + 1 − <em>t</em></p>
<p>where</p>
<p style="padding-left: 40px;">|<em>t</em>| ≤ 2√<em>p</em>.</p>
<p>So if <em>p</em> is on the order of 2<sup><em>n</em></sup>, the number of points on <em>E</em> is also on the order of 2<sup><em>n</em></sup> because √<em>p</em> is far smaller than <em>p</em>. That&#8217;s all you need to know at a high level. The rest of this post will look at a particular example in full detail.</p>
<h2>Detailed example</h2>
<p>The NIST curve <a href="https://www.johndcook.com/blog/2019/05/11/elliptic-curve-p-384/">P-384</a> has been <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">in the news</a> lately. For this curve, the based field is integers modulo a 384-bit prime <em>p</em> and so the number of points on the curve is also 384-bit number. Specifically</p>
<p style="padding-left: 40px;"><em>p</em> = 2<sup>384</sup> − 2<sup>128</sup> − 2<sup>96</sup> + 2<sup>32</sup> − 1,</p>
<p>and so we know <em>a priori</em> that the number of points on the curve equals 2<sup>384</sup> plus or minus a factor less than 2<sup>193</sup>.</p>
<p>The number of points on the elliptic curve P-384 is known to be</p>
<p style="padding-left: 40px;"> <em>n</em> = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643</p>
<p>See NIST SP 800-186, §3.2.1.4⁠.</p>
<p>We can calculate <em>t</em> at a Python REPL.</p>
<pre>&gt;&gt;&gt; n = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643
&gt;&gt;&gt;  p = 2**384 - 2**128 - 2**96 + 2**32 - 1
&gt;&gt;&gt; t = p + 1 - n
&gt;&gt;&gt; t
1388124618062372383606759648309780106643088307173319169677</pre>
<p>The fact that <em>t</em> is positive means the number of points <em>n</em> on our curve is slightly less than <em>p</em>. Here &#8220;slightly&#8221; is relative. The value of <em>p</em> − <em>n</em> is a huge number, but it&#8217;s small relative to <em>p</em>.</p>
<p>We can verify that |<em>t</em>| is less than our <em>a priori</em> bound of 2√<em>p</em>.</p>
<pre>&gt;&gt;&gt; from math import sqrt
&gt;&gt;&gt; t/(2*sqrt(p))
0.11057050503394951
</pre>
<p>So the actual value of <em>t</em> is about nine times smaller than its bound.</p>The post <a href="https://www.johndcook.com/blog/2026/10/22/the-number-of-points-on-an-elliptic-curve/">The number of points on an elliptic curve</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Backdoors, Incompetence, and Elliptic Curves</title>
		<link>https://www.johndcook.com/blog/2026/10/21/emudhra/</link>
					<comments>https://www.johndcook.com/blog/2026/10/21/emudhra/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 15:16:51 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Elliptic curves]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248087</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">Backdoors, Incompetence, and Elliptic Curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>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 <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">here</a>. Now the curves are in the news again, this time over broken certificates.</p>
<p>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&#8217;t the case. The NSA had not been able to defend how the curve seeds were chosen because they forgot, but researchers from Anthropic were able to reverse engineer the source of the seeds.</p>
<p>So apparently the NIST curves do not have a backdoor, but as with all encryption, the Achilles heel is human error. eMudrha was using the NIST curve <a href="https://www.johndcook.com/blog/2019/05/11/elliptic-curve-p-384/">P-384</a>  with extremely small keys: 4, 56, 115, 155, 156, 230, and 237. To understand why this is a problem, I&#8217;ll briefly describe how elliptic curve cryptography works.</p>
<p>P-384 is an elliptic curve designed by NIST, with input from the NSA, for use in cryptography. The curve has on the order of 2<sup>384</sup> points because the base field is the integers mod</p>
<p style="padding-left: 40px;"><em>p</em> = 2<sup>384</sup> − 2<sup>128</sup> − 2<sup>96</sup> + 2<sup>32</sup> − 1,</p>
<p>a 384-bit prime number. Given a basepoint <em>b</em> on the curve and an exponent <em>e</em>, it is practically impossible to recover <em>e</em> from <em>b</em><sup><em>e</em></sup>. That&#8217;s the discrete logarithm problem [1], the basis for the security of elliptic curve cryptography. If and when cryptographically relevant quantum computers arrive, the discrete logarithm problem will be solvable and elliptic curve cryptography will be broken.</p>
<p>Until the advent of quantum computing, elliptic curve cryptography is presumably safe, unless someone does something negligent, such as using a tiny value of <em>e</em> like 4.</p>
<p>If <em>e</em> is chosen at random from a group with on the order of 2<sup>384</sup> elements, you cannot recover <em>e</em> from <em>b</em><sup><em>e</em></sup> without brute force. But apparently someone said</p>
<p style="padding-left: 40px;">Let&#8217;s see. Is <em>e</em> = 1? Is it 2? Is it 3? Is it 4? Why yes: <em>e</em> = 4.</p>
<p>Ordinarily this would be hopeless. You can&#8217;t just try 2<sup>384</sup> exponents. But someone thought to test whether the keys were horrifically bad, and they were right.</p>
<p>&nbsp;</p>
<p>[1] The exponentiation here is not over the integers, or over the integers mod <em>p</em>. It&#8217;s over the group structure of the elliptic curve, and that is what makes it hard to compute the discrete logarithm.</p>The post <a href="https://www.johndcook.com/blog/2026/10/21/emudhra/">Backdoors, Incompetence, and Elliptic Curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/21/emudhra/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Deliberate imperfection</title>
		<link>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/</link>
					<comments>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 12:04:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248082</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/">Deliberate imperfection</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>I was watching a <a href="https://www.youtube.com/watch?v=Nlj5P-uJu-k">video</a> by John Higgins this morning about the poem in Ecclesiastes 3, one of the most famous passages in the Bible.</p>
<blockquote><p>There is a time for everything,<br />
and a season for every activity under the heavens:</p>
<p>a time to be born and a time to die,<br />
a time to plant and a time to uproot,<br />
a time to kill and a time to heal,<br />
a time to tear down and a time to build,<br />
a time to weep and a time to laugh,<br />
a time to mourn and a time to dance,<br />
a time to scatter stones and a time to gather them,<br />
a time to embrace and a time to refrain from embracing,<br />
a time to search and a time to give up,<br />
a time to keep and a time to throw away,<br />
a time to tear and a time to mend,<br />
a time to be silent and a time to speak,<br />
a time to love and a time to hate,<br />
a time for war and a time for peace.</p></blockquote>
<p>The poem has a great deal of symmetry, from birth and death to war and peace. It has seven couplets, and the number seven in the Bible is symbolic of perfection. </p>
<p>There is a repeated pattern of groups of four words: a time for X, a time for Y. The rhythm reminds me of Beethoven&#8217;s fifth symphony, especially the third movement [1]. </p>
<p>Higgins points out that there&#8217;s something odd in the middle couplet:</p>
<blockquote><p>a time to scatter stones and a time to gather them,<br />
a time to embrace and a time to refrain from embracing,</p></blockquote>
<p>It breaks the rhythm, at least in English translation, and presumably in the original language. The poem goes from intransitive adjectival infinitives &mdash;to plant, to uproot, etc.&mdash;to transitive&mdash;to gather <em>stones</em>. Also, the two parts of the couplet do not obviously fit together. There&#8217;s a similarity between birth and planting, between killing and tearing down, etc. But what&#8217;s the connection between casting stones and embracing?</p>
<p>Higgins explains that this deliberate symmetry breaking fits the theme of the Ecclesiastes as a whole. There is order to the world, and yet we don&#8217;t have it all figured out. Even when everything mostly makes sense, there&#8217;s something we don&#8217;t understand, like the middle couplet.</p>
<p>[1] This has been called the fate motif. There is an apocryphal story that Beethoven described it as such to his secretary and biographer Anton Schindler. Regardless of whether the story is true, the name stuck. Here&#8217;s the particular part I had in mind.</p>
<p><img loading="lazy" decoding="async" src="https://www.johndcook.com/fate_motif_horns.svg" width="506" height="61" alt="Sheet music for Beethoven: Symphony No. 5, Op. 67. Third Movement Horn Theme" class="aligncenter size-medium" /></p>The post <a href="https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/">Deliberate imperfection</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/21/deliberate-imperfection/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Refactoring factorials</title>
		<link>https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 19 Oct 2026 14:55:22 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Number theory]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248079</guid>

					<description><![CDATA[<p>Splitting N! into N factors is trivial. It&#8217;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&#8217;t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors ≥ 2: 4! [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/">Refactoring factorials</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>Splitting <em>N</em>! into <em>N</em> factors is trivial. It&#8217;s <em>defined</em> as the product of <em>N</em> integers, the integers 1 through <em>N</em>.</p>
<p>Can you still split <em>N</em>! into <em>N</em> factors if you put a minimum size requirement on the factors?</p>
<p>You can&#8217;t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors ≥ 2:</p>
<p style="padding-left: 40px;">4! = 24 = 2 × 2 × 2 × 3</p>
<p>Define <em>t</em>(<em>N</em>) as the largest number such that <em>N</em>! can be expressed as the product of integers greater than or equal to <em>t</em>(<em>N</em>). So based on the discussion above, <em>t</em>(<em>N</em>) ≥ 1 for all <em>N</em>, <em>t</em>(3) = 1 and <em>t</em>(4) = 2. The <em>t</em>(<em>N</em>) are given in OEIS sequence <a href="https://oeis.org/A034258">A034258</a>.</p>
<p>Last Thursday an <a href="https://pubs.ams.org/MCOM/0000-000-00/S0025-5718-2026-04249-8">article</a> came out proving an asymptotic estimate for <em>t</em>(<em>N</em>). You can find a <a href="https://arxiv.org/abs/2503.20170v4">preprint</a> on arXiv.</p>
<p>An upper bound on <em>t</em>(<em>N</em>) would be the <em>N</em>th root of <em>N</em>! because that would correspond to splitting <em>N</em>! into <em>N</em> factors of equal size. But the <em>N</em>th root of <em>N</em>! will not be an integer for <em>N</em> &gt; 1, so the bound would not be tight.</p>
<p>If we apply Stirling&#8217;s approximation for factorial we get</p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ≤ 1/<em>e</em> + <em>O</em>(log(<em>N</em>) / <em>N</em>).</p>
<p>It was conjectured that for large <em>N</em></p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ∼ 1/<em>e</em> − <em>c</em><sub>0</sub> / log(<em>N</em>)</p>
<p>and the new paper proves</p>
<p style="padding-left: 40px;"><em>t</em>(<em>N</em>) / <em>N</em> ∼ 1/<em>e</em> − <em>c</em><sub>0</sub> / log(<em>N</em>) + <em>O</em>(1 / log<sup>1 + <em>c</em></sup> <em>N</em>).</p>
<p>.</p>The post <a href="https://www.johndcook.com/blog/2026/10/19/refactoring-factorials/">Refactoring factorials</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A frivolous problem with a deeper lesson</title>
		<link>https://www.johndcook.com/blog/2026/10/19/regex-backtracking/</link>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 19 Oct 2026 12:00:43 +0000</pubDate>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Regular expressions]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248073</guid>

					<description><![CDATA[<p>About 14% of English 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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/19/regex-backtracking/">A frivolous problem with a deeper lesson</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>About 14% of English words can be spelled by stringing together chemical symbols. For example, <em>sarcasm</em> can be written</p>
<p style="padding-left: 40px;">S Ar Ca Sm</p>
<p>using the symbols for sulfur, argon, calcium, and samarium.</p>
<p>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&#8217;t a practical problem, but it illustrates a practical problem.</p>
<p>You could solve the problem with a regular expression:</p>
<pre>(h|he|li|be|b|c|n|o|f|ne|na|mg|al|si| … |og)+</pre>
<p>This solution could either be very efficient or very inefficient, depending on the inner workings of the software used to match the regular expression.</p>
<p>A DFA (deterministic finite automata) regular expression engine would find a match, or report failure, linear time, i.e. the execution time would be proportional to the length of the string being matched. An engine that uses backtracking (informally called an “NFA engine”) could take exponential time. (The classical Thompson simulation of an NFA itself runs in <em>O</em>(<em>mn</em>) time; the exponential behavior comes from the backtracking search strategy.)</p>
<p>The root of the problem is the ambiguity in dividing words into single letters or pairs of letters.</p>
<p>Many two-letter chemical symbols are made of letters that are themselves chemical symbols. For example, the symbol for cobalt, Co, consists of the symbols for carbon, C, and oxygen, O. A traditional NFA regular expression engine uses backtracking and could take exponentially long to test whether the word</p>
<pre>cococo…j</pre>
<p>matches a regular expression for concatenated chemical symbols. If there are <em>n</em> copies of <code>co</code>, the engine would try all 2<sup><em>n</em></sup> possibilities of treating each pair as either <code>co</code> (cobalt) or <code>c o</code> (carbon oxygen).</p>
<p>A DFA regular expression engine always runs in <em>O</em>(<em>n</em>) time, while a traditional backtracking engine can take exponential time. So why ever use a backtracking engine? Because such an engine can match more advanced patterns such as Perl regular expressions (which are not &#8220;regular&#8221; expressions in the original meaning of the term). Newer engines have added safeguards to eliminate or at least reduce the chance of running into catastrophic backtracking.</p>The post <a href="https://www.johndcook.com/blog/2026/10/19/regex-backtracking/">A frivolous problem with a deeper lesson</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Cloud of suspicion lifted from NIST curves</title>
		<link>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/</link>
					<comments>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/#comments</comments>
		
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sat, 17 Oct 2026 15:39:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cryptography]]></category>
		<guid isPermaLink="false">https://www.johndcook.com/blog/?p=248067</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
The post <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">Cloud of suspicion lifted from NIST curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></description>
										<content:encoded><![CDATA[<p>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.</p>
<p>Two days ago researchers at <a href="https://www.anthropic.com/research/ecdsa-curve-origins">Anthropic</a> [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.</p>
<hr />
<p>The security of elliptic curve cryptography depends on the difficult of solving the discrete logarithm problem. In the context of elliptic curve arithmetic, the analog of exponentiation is easy but the analog of taking logarithms is hard.</p>
<p><strong>In general</strong> it&#8217;s not practical to compute discrete logarithms over large elliptic curves. But it could be easy for someone with inside information to compute discrete logarithms if something about the curve was not &#8220;general.&#8221;</p>
<p>Specifically, the NIST curves have the form</p>
<p style="padding-left: 40px;"><em>y</em>² = <em>x</em>³ − 3<em>x</em> + <em>b</em> (mod <em>p</em>)</p>
<p>for various values of <em>p</em> [2], and the suspicion regards the choice of <em>b</em>. For nearly all values of <em>b</em> encryption over the elliptic curve should be secure, as far as we know, but in principle someone could engineer values of <em>b</em> to weaken the encryption.</p>
<p>So where did the <em>b</em>&#8216;s come from? Were they chosen in <a href="https://www.johndcook.com/blog/2019/08/14/good-faith/">good faith</a>?</p>
<p>Concern over the choice of seeds, the <em>b</em>&#8216;s, grew following the Snowden revelations. Daniel J. Bernstein emailed Jerry Solinas of the NSA on September 6, 2014 asking where the seeds had come from. Solinas replied in subsequent emails. He said the seeds were generated by hashing the ASCII representation of a humorous English message, but he could no longer remember the exact message or the precise hashing procedure.</p>
<p>On October 5, 2023 Philippo Valsorda announced a <a href="https://words.filippo.io/seeds-bounty/">bounty</a> for reverse engineering the origin of the NIST elliptic curve seeds. Two days ago researchers from Anthropic claimed the bounty. Valsorda verified the results and awarded the prize. It turns out Solinas found the curve seeds in good faith, but his memory had faded over the years since the curves were published. We now know he used a date, not a phrase, as part of the process of constructing the seeds.</p>
<p>The NIST curves have some nice properties, such as enabling some <a href="https://www.johndcook.com/blog/2019/05/12/nist-primes/">clever tricks</a> for arithmetic in their base fields. But adoption of the curves has been held back over suspicion regarding their origin. Now the curves have been exonerated. As Valdorda notes</p>
<blockquote><p>… this nicely completes the “rehabilitation arc” of NIST elliptic curve cryptography, which I would now personally recommend over Curve25519/Ed25519/X25519. Just in time for them to be retired in favor of post-quantum signatures.</p></blockquote>
<h2>Related posts</h2>
<ul>
<li class="link"><a href="https://www.johndcook.com/blog/2019/02/21/what-is-an-elliptic-curve/">What is an elliptic curve?</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/07/27/moneros-elliptic-curve/">Monero&#8217;s elliptic curve</a></li>
<li class="link"><a href="https://www.johndcook.com/blog/2025/08/01/jubjub/">Lewis Carroll and zero knowledge proofs</a></li>
</ul>
<p>[1] This does not imply that LLMs are necessarily a threat to encryption. The search for the NIST seeds required a lot of brute force. Some cleverness was required in order to come up with possibilities to check by brute force, but even that is sorta brute force at a higher level of abstraction. There has been speculation that labs are looking for weaknesses in cryptographic primitives and protocols, but that&#8217;s a different matter than searching for seeds.</p>
<p>[2] The curves P-192, P-224, P-256, P-384, and P-521 are built over the field of integers mod <em>p</em>, where the number of bits in <em>p</em> corresponds to the number in the name. The P-192 curve, for example, has as its base field the integers mod 2<sup>192</sup> − 2<sup>64</sup> − 1, a 192-bit prime.</p>The post <a href="https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/">Cloud of suspicion lifted from NIST curves</a> first appeared on <a href="https://www.johndcook.com/blog">John D. Cook</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.johndcook.com/blog/2026/10/17/nist-curves-exonorated/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
