[{"id":248115,"date":"2026-10-25T14:45:05","date_gmt":"2026-10-25T19:45:05","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248115"},"modified":"2026-10-25T14:45:05","modified_gmt":"2026-10-25T19:45:05","slug":"poles-and-polars","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/","title":{"rendered":"Poles and polars"},"content":{"rendered":"<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\u00a0<em>is<\/em> a polar triangle and why is it called that?<\/p>\n<h2>Poles and polars on a sphere<\/h2>\n<p>Let&#8217;s start with a sphere\u00a0<em>S<\/em> and a great circle\u00a0<em>G<\/em>. Then\u00a0<em>G<\/em> is the intersection of\u00a0<em>S<\/em> with a plane through the center of\u00a0<em>S<\/em>. The circle\u00a0<em>G<\/em> has two <strong>poles<\/strong>, two points on opposite sides of\u00a0<em>S<\/em> that are as far as possible (i.e. \u03c0\/2 radians) from\u00a0<em>G<\/em>. If you rotate the sphere so that\u00a0<em>G<\/em> is the equator, the poles are the north and south pole.<\/p>\n<p>Conversely, if you start with a point\u00a0<em>P<\/em> on the sphere\u00a0<em>S<\/em>, the\u00a0<strong>polar<\/strong> of\u00a0<em>P<\/em> is the great circle for which\u00a0<em>P<\/em> is a pole. So if you think of\u00a0<em>P<\/em> as the north pole, the polar of\u00a0<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>\n<p>In my opinion it would be clearer to call poles and polars both\u00a0<strong>duals<\/strong>. The dual of a great circle is a point, and the dual of a point is a great circle.<\/p>\n<p>Now let&#8217;s look at a spherical triangle <em>ABC<\/em>\u00a0sides <em>a<\/em>,\u00a0<em>b<\/em>, and\u00a0<em>c<\/em>. The vertices of the <strong>polar triangle<\/strong> of <em>ABC<\/em> are the poles of the sides <em>a<\/em>,\u00a0<em>b<\/em>, and\u00a0<em>c<\/em>. This definition is essentially correct, but it needs a little refinement.<\/p>\n<p>The pole <em>A<\/em>\u2032 of the side <em>a<\/em> is one of the two poles of the great circle containing\u00a0<em>a<\/em>, the one that that lies in the same hemisphere as\u00a0<em>A<\/em>. Define <em>B<\/em>\u2032 and <em>C<\/em>\u2032 similarly, and the polar triangle is the spherical triangle with vertices <em>A<\/em>\u2032<em>B<\/em>\u2032<em>C<\/em>\u2032.<\/p>\n<h2>Poles and polars in the plane<\/h2>\n<p>The terms\u00a0<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>\n<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\u00a0<em>with respect to the circle<\/em> and the define the polar of a point\u00a0<em>with respect to the same circle<\/em>.<\/p>\n<p>Given a circle\u00a0<em>S<\/em> with center <em>O<\/em>, to find the polar of a point <em>P<\/em> \u2260 <em>O<\/em>, let\u00a0<em>Q<\/em> be the <a href=\"https:\/\/www.johndcook.com\/blog\/2022\/04\/19\/inversion-in-a-circle\/\">inversion<\/a> of\u00a0<em>P<\/em> in\u00a0<em>S<\/em>, and let \u2113 be the line through\u00a0<em>Q<\/em> perpendicular to the line\u00a0<em>OP<\/em>.<\/p>\n<p>Conversely, the pole of a line \u2113 with respect to a circle\u00a0<em>S<\/em> is the inversion of\u00a0<em>Q<\/em> in\u00a0<em>S<\/em> where\u00a0<em>Q<\/em> is the intersection of \u2113 with\u00a0<em>OQ<\/em>. Here we assume the line \u2113 does not pass through the center of the circle\u00a0<em>O<\/em> because otherwise\u00a0<em>O<\/em> =\u00a0<em>Q<\/em> and it doesn&#8217;t make sense to speak of the line\u00a0<em>OQ<\/em>.<\/p>\n<h2>Projective geometry<\/h2>\n<p>The definitions above have a couple holes that can be filled in by extending the Euclidean plane to the projective plane.<\/p>\n<p>We defined the pole of a line \u2113 except when \u2113 passes through the center of the circle. If \u2113 passes through\u00a0<em>O<\/em> then the pole of \u2113 is the point at infinity in the direction of \u2113. Similarly, we defined the polar of all points except\u00a0<em>O<\/em>. In projective geometry, we can define the polar of\u00a0<em>O<\/em> to the be line at infinity, the line containing all the points at infinity.<\/p>\n","protected":false},"excerpt":{"rendered":"<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\u00a0is a polar triangle and why is it called that? Poles and polars on a sphere Let&#8217;s start with a sphere\u00a0S and a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[224],"class_list":["post-248115","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Poles and polars in spherical, plane, and projective geometry\" \/>\n\t\t<meta property=\"og:description\" content=\"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-25T19:45:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-25T19:45:05+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Poles and polars in spherical, plane, and projective geometry\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Poles and polars in spherical, plane, and projective geometry","description":"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/","robots":"max-image-preview:large","keywords":"geometry","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Poles and polars in spherical, plane, and projective geometry","og:description":"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/","article:published_time":"2026-10-25T19:45:05+00:00","article:modified_time":"2026-10-25T19:45:05+00:00","twitter:card":"summary","twitter:title":"Poles and polars in spherical, plane, and projective geometry","twitter:description":"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248115","title":"Poles and polars in spherical, plane, and projective geometry","description":"Duality in spherical and plane geometry. The dual of a line is called a pole, and the dual of a point is called a polar. Extension to projective geometry.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-25 18:33:03","updated":"2026-10-25 19:45:05","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPoles and polars\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Poles and polars","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/25\/poles-and-polars\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248115"}],"version-history":[{"count":1,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248115\/revisions"}],"predecessor-version":[{"id":248116,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248115\/revisions\/248116"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248109,"date":"2026-10-24T20:01:55","date_gmt":"2026-10-25T01:01:55","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248109"},"modified":"2026-10-25T05:14:27","modified_gmt":"2026-10-25T10:14:27","slug":"computing-polar-triangles","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/","title":{"rendered":"Computing polar triangles with linear algebra"},"content":{"rendered":"<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>\n<p>How do we know that polar triangles exist? There is a geometric construction that starts with a spherical triangle and constructs a unique new spherical triangle, and one can show that this new triangle has the angles and sides described in the previous post.<\/p>\n<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>\n<p>This process is an involution: the polar of the polar of a triangle is the original triangle.<\/p>\n<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>\n<pre>import numpy as np\r\n\r\ndef latlon_to_cartesian(lat_deg, lon_deg):\r\n    lat = np.radians(lat_deg)\r\n    lon = np.radians(lon_deg)\r\n    x = np.cos(lat) * np.cos(lon)\r\n    y = np.cos(lat) * np.sin(lon)\r\n    z = np.sin(lat)\r\n    return np.array([x, y, z])\r\n\r\ndef cartesian_to_latlon(v):\r\n    v = v \/ np.linalg.norm(v)\r\n    lat = np.degrees(np.arcsin(np.clip(v[2], -1, 1)))\r\n    lon = np.degrees(np.arctan2(v[1], v[0]))\r\n    return lat, lon\r\n\r\ndef polar_triangle(M):\r\n    \"\"\"\r\n    Polar triangle via matrix inversion.\r\n    M: 3\u00d73 matrix with columns = unit vectors of the original vertices.\r\n    Returns 3\u00d73 matrix whose columns are the polar unit vectors.\r\n    \"\"\"\r\n    Minv = np.linalg.inv(M)\r\n    # Normalize each row of the inverse (rows are parallel to the polar directions)\r\n    polar_rows = Minv \/ np.linalg.norm(Minv, axis=1, keepdims=True)\r\n    return polar_rows.T          # columns = polar vertices\r\n\r\n# Original vertices (Chicago, Quito, Paris)\r\nA = latlon_to_cartesian(41.85003, -87.65005)\r\nB = latlon_to_cartesian(-0.22985, -78.52495)\r\nC = latlon_to_cartesian(48.85341,  2.3488)\r\n\r\nM = np.column_stack([A, B, C])\r\nprint(\"M (columns = original vertices):\\n\", M)\r\nprint(\"det(M) =\", np.linalg.det(M))\r\n\r\n# Polar triangle\r\nM_prime = polar_triangle(M)\r\nprint(\"\\nM' (columns = polar vertices):\\n\", M_prime)\r\n\r\nprint(\"\\nPolar geographic coordinates (lat, lon):\")\r\nfor name, col in zip([\"A'\", \"B'\", \"C'\"], range(3)):\r\n    print(name, cartesian_to_latlon(M_prime[:, col]))\r\n\r\n# Polar of the polar\r\nM_double = polar_triangle(M_prime)\r\nprint(\"\\nPolar-of-polar matrix:\\n\", M_double)\r\nprint(\"max |difference from original M| =\",\r\n      np.max(np.abs(M_double - M)))\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[224,198,169],"class_list":["post-248109","post","type-post","status-publish","format-standard","hentry","category-math","tag-geometry","tag-linear-algebra","tag-python"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"geometry,linear algebra,python\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Computing polar triangles with linear algebra\" \/>\n\t\t<meta property=\"og:description\" content=\"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-25T01:01:55+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-25T10:14:27+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Computing polar triangles with linear algebra\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Computing polar triangles with linear algebra","description":"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/","robots":"max-image-preview:large","keywords":"geometry,linear algebra,python","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Computing polar triangles with linear algebra","og:description":"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/","article:published_time":"2026-10-25T01:01:55+00:00","article:modified_time":"2026-10-25T10:14:27+00:00","twitter:card":"summary","twitter:title":"Computing polar triangles with linear algebra","twitter:description":"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248109","title":null,"description":"Computing the polar of a spherical triangle using linear algebra. Demonstration that taking the polar twice puts you back where you started.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-25 00:34:59","updated":"2026-10-25 10:15:07","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tComputing polar triangles with linear algebra\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Computing polar triangles with linear algebra","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/computing-polar-triangles\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248109"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248109\/revisions"}],"predecessor-version":[{"id":248113,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248109\/revisions\/248113"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248107,"date":"2026-10-24T19:28:20","date_gmt":"2026-10-25T00:28:20","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248107"},"modified":"2026-10-24T21:09:25","modified_gmt":"2026-10-25T02:09:25","slug":"polar-triangle","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/","title":{"rendered":"Duality in spherical trigonometry"},"content":{"rendered":"<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>\n<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>\n<p>But that&#8217;s just one of two laws of cosines on a sphere. The equation above is the law of cosines\u00a0<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>\n<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>\n<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>\n<h2>Two kinds of angles<\/h2>\n<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\u00a0<em>a<\/em>,\u00a0<em>b<\/em>, and\u00a0<em>c<\/em>, and the angles are\u00a0<em>A<\/em>,\u00a0<em>B<\/em>, and\u00a0<em>C<\/em>, with <em>a<\/em> being the side opposite the angle\u00a0<em>A<\/em>, and similarly for the other letters.<\/p>\n<p>However, unlike plane geometry, the sides are also angles, but of a different sort. The sides\u00a0<em>a<\/em>,\u00a0<em>b<\/em>, and\u00a0<em>c<\/em>\u00a0are <strong>central angles<\/strong>, and the &#8220;angles&#8221;\u00a0<em>A<\/em>,\u00a0<em>B<\/em>, and\u00a0<em>C<\/em> are\u00a0<strong>dihedral angles<\/strong>.<\/p>\n<p>The sides are arcs of a great circle. The side\u00a0<em>a<\/em>, for example, is a portion of a great circle, running between the vertices at\u00a0<em>B<\/em> and\u00a0<em>C<\/em> [1]. Think of a plane that contains the center of the sphere <em>O<\/em> and the vertices\u00a0<em>B<\/em> and\u00a0<em>C<\/em>. The length of\u00a0<em>a<\/em> is the angle at\u00a0<em>O<\/em>.<\/p>\n<p>The angles\u00a0<em>A<\/em>,\u00a0<em>B<\/em>, and\u00a0<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>\n<h2>Polar triangles<\/h2>\n<p>Now because sides are angles and vertices are angles, we can interchange the two kinds of angles to form the\u00a0<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>\n<p style=\"padding-left: 40px;\"><em>a<\/em>\u2032 = \u03c0 \u2212 <em>A<\/em><br \/>\n<em>b<\/em>\u2032 = \u03c0 \u2212 <em>B<\/em><br \/>\n<em>c<\/em>\u2032 = \u03c0 \u2212 <em>C<\/em><br \/>\n<em>A<\/em>\u2032 = \u03c0 \u2212 <em>a<\/em><br \/>\n<em>B<\/em>\u2032 = \u03c0 \u2212 <em>b<\/em><br \/>\n<em>C<\/em>\u2032 = \u03c0 \u2212 <em>c<\/em><\/p>\n<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>\n<p>&nbsp;<\/p>\n<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\u00a0<em>A<\/em> is used to denote both a vertex and the dihedral angle at that vertex.<\/p>\n","protected":false},"excerpt":{"rendered":"<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\u00a0for sides. The law of cosines for angles is typographically very similar, just inverting the case of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[48],"class_list":["post-248107","post","type-post","status-publish","format-standard","hentry","category-math","tag-differential-geometry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"differential geometry\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Duality in spherical trigonometry\" \/>\n\t\t<meta property=\"og:description\" content=\"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-25T00:28:20+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-25T02:09:25+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Duality in spherical trigonometry\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Duality in spherical trigonometry","description":"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/","robots":"max-image-preview:large","keywords":"differential geometry","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Duality in spherical trigonometry","og:description":"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/","article:published_time":"2026-10-25T00:28:20+00:00","article:modified_time":"2026-10-25T02:09:25+00:00","twitter:card":"summary","twitter:title":"Duality in spherical trigonometry","twitter:description":"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248107","title":null,"description":"Duality in spherical trigonometry. Why where are two laws of cosines, for example, and why every identity has a dual counterpart.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-24 23:45:22","updated":"2026-10-25 10:15:07","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDuality in spherical trigonometry\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Duality in spherical trigonometry","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/24\/polar-triangle\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248107"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248107\/revisions"}],"predecessor-version":[{"id":248112,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248107\/revisions\/248112"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248104,"date":"2026-10-22T10:12:10","date_gmt":"2026-10-22T15:12:10","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248104"},"modified":"2026-10-22T10:12:10","modified_gmt":"2026-10-22T15:12:10","slug":"pep-723","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/","title":{"rendered":"Working around a strange Python problem"},"content":{"rendered":"<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>\n<p>I got an error message that said<\/p>\n<pre>error: The script contains multiple PEP 723 metadata blocks<\/pre>\n<p>I searched on what that means, then took out the blank line in my header<\/p>\n<pre>#!\/usr\/bin\/env -S uv run --script\r\n\r\n# \/\/\/ script\r\n# dependencies = [\"pyperclip\"]\r\n# \/\/\/\r\n<\/pre>\n<p>but I still got the same error message.<\/p>\n<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>\n<p>According to Grok<\/p>\n<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>\n<p>It suggested changing my quoted string to use <code># \/ \/ \/<\/code> and then take out the extra spaces:<\/p>\n<pre>\"\"\"#!\/usr\/bin\/env -S uv run --script\r\n# \/ \/ \/ script\r\n# dependencies = [\"numpy\", \"matplotlib\"]\r\n# \/ \/ \/\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\"\"\".replace(\"# \/ \/ \/\", \"# \/\/\/\")\r\n<\/pre>\n<p>This is a dirty hack, but it works.<\/p>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[169],"class_list":["post-248104","post","type-post","status-publish","format-standard","hentry","category-computing","tag-python"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Working around a script failure caused by Python PEP 723 following an update\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"python\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Working around a strange Python problem | Python PEP 723\" \/>\n\t\t<meta property=\"og:description\" content=\"Working around a script failure caused by Python PEP 723 following an update\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-22T15:12:10+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-22T15:12:10+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Working around a strange Python problem | Python PEP 723\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Working around a script failure caused by Python PEP 723 following an update\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Working around a strange Python problem | Python PEP 723","description":"Working around a script failure caused by Python PEP 723 following an update","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/","robots":"max-image-preview:large","keywords":"python","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Working around a strange Python problem | Python PEP 723","og:description":"Working around a script failure caused by Python PEP 723 following an update","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/","article:published_time":"2026-10-22T15:12:10+00:00","article:modified_time":"2026-10-22T15:12:10+00:00","twitter:card":"summary","twitter:title":"Working around a strange Python problem | Python PEP 723","twitter:description":"Working around a script failure caused by Python PEP 723 following an update","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248104","title":"Working around a strange Python problem | Python PEP 723","description":"Working around a script failure caused by Python PEP 723 following an update","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-22 14:57:31","updated":"2026-10-23 01:50:05","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWorking around a strange Python problem\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"Working around a strange Python problem","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/pep-723\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248104"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248104\/revisions"}],"predecessor-version":[{"id":248106,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248104\/revisions\/248106"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248100,"date":"2026-10-22T09:01:55","date_gmt":"2026-10-22T14:01:55","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248100"},"modified":"2026-10-22T09:01:55","modified_gmt":"2026-10-22T14:01:55","slug":"certificate-debacle","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/","title":{"rendered":"How the eMudrha certificate debacle might have happened"},"content":{"rendered":"<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>\n<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\u00a0<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>\n<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>\n<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>\n<pre>% 2**384<\/pre>\n<p>they typed <\/p>\n<pre>% 384<\/pre>\n<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>\n<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>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[43],"class_list":["post-248100","post","type-post","status-publish","format-standard","hentry","category-math","tag-cryptography"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"How might eMudrha generated seven tiny ECC keys\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"cryptography\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How the eMudrha certificate debacle might have happened\" \/>\n\t\t<meta property=\"og:description\" content=\"How might eMudrha generated seven tiny ECC keys\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-22T14:01:55+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-22T14:01:55+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How the eMudrha certificate debacle might have happened\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How might eMudrha generated seven tiny ECC keys\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How the eMudrha certificate debacle might have happened","description":"How might eMudrha generated seven tiny ECC keys","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/","robots":"max-image-preview:large","keywords":"cryptography","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"How the eMudrha certificate debacle might have happened","og:description":"How might eMudrha generated seven tiny ECC keys","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/","article:published_time":"2026-10-22T14:01:55+00:00","article:modified_time":"2026-10-22T14:01:55+00:00","twitter:card":"summary","twitter:title":"How the eMudrha certificate debacle might have happened","twitter:description":"How might eMudrha generated seven tiny ECC keys","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248100","title":null,"description":"How might eMudrha generated seven tiny ECC keys","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-22 13:26:12","updated":"2026-10-22 14:58:07","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow the eMudrha certificate debacle might have happened\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"How the eMudrha certificate debacle might have happened","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/certificate-debacle\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248100"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248100\/revisions"}],"predecessor-version":[{"id":248103,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248100\/revisions\/248103"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248094,"date":"2026-10-22T06:08:51","date_gmt":"2026-10-22T11:08:51","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248094"},"modified":"2026-10-25T05:16:11","modified_gmt":"2026-10-25T10:16:11","slug":"the-number-of-points-on-an-elliptic-curve","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/","title":{"rendered":"The number of points on an elliptic curve"},"content":{"rendered":"<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>\n<p style=\"padding-left: 40px;\"><em>y<\/em>\u00b2 = <em>x<\/em>\u00b3 + <em>ax<\/em> + <em>b<\/em><\/p>\n<p>with\u00a0<em>x<\/em> and\u00a0<em>y<\/em> in\u00a0<em>F<\/em>. Typically in cryptography the field\u00a0<em>F<\/em> is the integers mod\u00a0<em>p<\/em> where\u00a0<em>p<\/em> is a very large prime number.<\/p>\n<p>The number of points on\u00a0<em>E<\/em> is roughly the number of elements in\u00a0<em>F<\/em>. So for a curve over the integers mod <em>p<\/em>, the curve has roughly <em>p<\/em> points.<\/p>\n<p>The next section will give an intuitive argument for why the number of points on\u00a0<em>E<\/em> should be roughly the number of elements in\u00a0<em>F<\/em>. Then the next section will give a rigorous bound. Then after that we&#8217;ll work through an example.<\/p>\n<h2>Hand-wavy estimate<\/h2>\n<p>For a prime\u00a0<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>\n<pre>&gt;&gt;&gt; [x**2 % 7 for x in range(1,7)]\r\n[1, 4, 2, 2, 4, 1]\r\n<\/pre>\n<p>Now if we wanted to count the number of solutions to<\/p>\n<p style=\"padding-left: 40px;\"><em>y<\/em>\u00b2 = <em>x<\/em>\u00a0(mod\u00a0<em>p<\/em>)<\/p>\n<p>we&#8217;d find it equals\u00a0<em>p<\/em>. That&#8217;s because (0, 0) is a point on the curve, and for (<em>p<\/em> \u2212 1)\/2 values of\u00a0<em>x<\/em> there are two values of\u00a0<em>y<\/em>, and for the remaining values of\u00a0<em>x<\/em> there are no values of\u00a0<em>y<\/em>.<\/p>\n<p>To put it another way, if we pick a value of\u00a0<em>x<\/em> at random, it will have two square roots or no square roots with roughly equal probability.<\/p>\n<p>Now suppose we pick an\u00a0<em>x<\/em> at random and compute <em>x<\/em>\u00b3 + <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>\n<h2>Precise bound<\/h2>\n<p>Hasse&#8217;s theorem gives a precise bound on the number of points on an elliptic curve\u00a0<em>E<\/em>. It says<\/p>\n<p style=\"padding-left: 40px;\">#<em>E<\/em> = <em>p<\/em> + 1 \u2212 <em>t<\/em><\/p>\n<p>where<\/p>\n<p style=\"padding-left: 40px;\">|<em>t<\/em>| \u2264 2\u221a<em>p<\/em>.<\/p>\n<p>So if\u00a0<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>\u00a0because \u221a<em>p<\/em> is far smaller than\u00a0<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>\n<h2>Detailed example<\/h2>\n<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>\n<p style=\"padding-left: 40px;\"><em>p<\/em>\u00a0= 2<sup>384<\/sup>\u00a0\u2212 2<sup>128<\/sup>\u00a0\u2212 2<sup>96<\/sup>\u00a0+ 2<sup>32<\/sup>\u00a0\u2212 1,<\/p>\n<p>and so we know\u00a0<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>\n<p>The number of points on the elliptic curve P-384 is known to be<\/p>\n<p style=\"padding-left: 40px;\">\u00a0<em>n<\/em> = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643<\/p>\n<p>See NIST SP 800-186, \u00a73.2.1.4\u2060.<\/p>\n<p>We can calculate <em>t<\/em> at a Python REPL.<\/p>\n<pre>&gt;&gt;&gt; n = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643\r\n&gt;&gt;&gt;  p = 2**384 - 2**128 - 2**96 + 2**32 - 1\r\n&gt;&gt;&gt; t = p + 1 - n\r\n&gt;&gt;&gt; t\r\n1388124618062372383606759648309780106643088307173319169677<\/pre>\n<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> \u2212 <em>n<\/em> is a huge number, but it&#8217;s small relative to <em>p<\/em>.<\/p>\n<p>We can verify that |<em>t<\/em>| is less than our <em>a priori<\/em> bound of\u00a02\u221a<em>p<\/em>.<\/p>\n<pre>&gt;&gt;&gt; from math import sqrt\r\n&gt;&gt;&gt; t\/(2*sqrt(p))\r\n0.11057050503394951\r\n<\/pre>\n<p>So the actual value of <em>t<\/em> is about nine times smaller than its bound.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An elliptic curve E over a finite field F consists of the set of points (x, y) satisfying the equation y\u00b2 = x\u00b3 + ax + b with\u00a0x and\u00a0y in\u00a0F. Typically in cryptography the field\u00a0F is the integers mod\u00a0p where\u00a0p is a very large prime number. The number of points on\u00a0E is roughly the number [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[203],"class_list":["post-248094","post","type-post","status-publish","format-standard","hentry","category-math","tag-elliptic-curves"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"elliptic curves\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"The number of points on an elliptic curve\" \/>\n\t\t<meta property=\"og:description\" content=\"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-22T11:08:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-25T10:16:11+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"The number of points on an elliptic curve\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"The number of points on an elliptic curve","description":"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/","robots":"max-image-preview:large","keywords":"elliptic curves","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"The number of points on an elliptic curve","og:description":"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/","article:published_time":"2026-10-22T11:08:51+00:00","article:modified_time":"2026-10-25T10:16:11+00:00","twitter:card":"summary","twitter:title":"The number of points on an elliptic curve","twitter:description":"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248094","title":null,"description":"In elliptic curve cryptography you need to know the number of points on a curve. This is easy to estimate but a little harder to calculate exactly.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-22 09:54:25","updated":"2026-10-25 18:33:01","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tThe number of points on an elliptic curve\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"The number of points on an elliptic curve","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/22\/the-number-of-points-on-an-elliptic-curve\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248094"}],"version-history":[{"count":5,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248094\/revisions"}],"predecessor-version":[{"id":248114,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248094\/revisions\/248114"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248087,"date":"2026-10-21T10:16:51","date_gmt":"2026-10-21T15:16:51","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248087"},"modified":"2026-10-22T04:55:08","modified_gmt":"2026-10-22T09:55:08","slug":"emudhra","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/","title":{"rendered":"Backdoors, Incompetence, and Elliptic Curves"},"content":{"rendered":"<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>\n<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>\n<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>\u00a0 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>\n<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>\n<p style=\"padding-left: 40px;\"><em>p<\/em>\u00a0= 2<sup>384<\/sup>\u00a0\u2212 2<sup>128<\/sup>\u00a0\u2212 2<sup>96<\/sup>\u00a0+ 2<sup>32<\/sup> \u2212 1,<\/p>\n<p>a 384-bit prime number. Given a basepoint\u00a0<em>b<\/em> on the curve and an exponent\u00a0<em>e<\/em>, it is practically impossible to recover\u00a0<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>\n<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>\n<p>If\u00a0<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>\n<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:\u00a0<em>e<\/em> = 4.<\/p>\n<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>\n<p>&nbsp;<\/p>\n<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>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[43,203],"class_list":["post-248087","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-cryptography","tag-elliptic-curves"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"cryptography,elliptic curves\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Backdoors, Incompetence, and Elliptic Curves\" \/>\n\t\t<meta property=\"og:description\" content=\"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-21T15:16:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-22T09:55:08+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Backdoors, Incompetence, and Elliptic Curves\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Backdoors, Incompetence, and Elliptic Curves","description":"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/","robots":"max-image-preview:large","keywords":"cryptography,elliptic curves","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Backdoors, Incompetence, and Elliptic Curves","og:description":"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/","article:published_time":"2026-10-21T15:16:51+00:00","article:modified_time":"2026-10-22T09:55:08+00:00","twitter:card":"summary","twitter:title":"Backdoors, Incompetence, and Elliptic Curves","twitter:description":"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248087","title":null,"description":"The NIST curve P-384 has been in the news twice lately, once for a result from Anthropic and once for incredibly bad key choices.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-21 14:23:31","updated":"2026-10-22 09:56:04","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/\" title=\"Uncategorized\">Uncategorized<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBackdoors, Incompetence, and Elliptic Curves\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Uncategorized","link":"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/"},{"label":"Backdoors, Incompetence, and Elliptic Curves","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/emudhra\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248087"}],"version-history":[{"count":6,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248087\/revisions"}],"predecessor-version":[{"id":248095,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248087\/revisions\/248095"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248082,"date":"2026-10-21T07:04:06","date_gmt":"2026-10-21T12:04:06","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248082"},"modified":"2026-10-21T08:22:03","modified_gmt":"2026-10-21T13:22:03","slug":"deliberate-imperfection","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/","title":{"rendered":"Deliberate imperfection"},"content":{"rendered":"<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>\n<blockquote><p>There is a time for everything,<br \/>\nand a season for every activity under the heavens:<\/p>\n<p>a time to be born and a time to die,<br \/>\na time to plant and a time to uproot,<br \/>\na time to kill and a time to heal,<br \/>\na time to tear down and a time to build,<br \/>\na time to weep and a time to laugh,<br \/>\na time to mourn and a time to dance,<br \/>\na time to scatter stones and a time to gather them,<br \/>\na time to embrace and a time to refrain from embracing,<br \/>\na time to search and a time to give up,<br \/>\na time to keep and a time to throw away,<br \/>\na time to tear and a time to mend,<br \/>\na time to be silent and a time to speak,<br \/>\na time to love and a time to hate,<br \/>\na time for war and a time for peace.<\/p><\/blockquote>\n<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>\n<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>\n<p>Higgins points out that there&#8217;s something odd in the middle couplet:<\/p>\n<blockquote><p>a time to scatter stones and a time to gather them,<br \/>\na time to embrace and a time to refrain from embracing,<\/p><\/blockquote>\n<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>\n<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>\n<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>\n<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>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-248082","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Deliberate imperfection\" \/>\n\t\t<meta property=\"og:description\" content=\"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-21T12:04:06+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-21T13:22:03+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Deliberate imperfection\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Deliberate imperfection","description":"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Deliberate imperfection","og:description":"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/","article:published_time":"2026-10-21T12:04:06+00:00","article:modified_time":"2026-10-21T13:22:03+00:00","twitter:card":"summary","twitter:title":"Deliberate imperfection","twitter:description":"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248082","title":null,"description":"Symmetry and a conspicuous break from symmetry in Ecclesiastes 3.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-21 10:28:44","updated":"2026-10-21 13:23:06","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/\" title=\"Uncategorized\">Uncategorized<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDeliberate imperfection\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Uncategorized","link":"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/"},{"label":"Deliberate imperfection","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/21\/deliberate-imperfection\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248082"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248082\/revisions"}],"predecessor-version":[{"id":248086,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248082\/revisions\/248086"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248079,"date":"2026-10-19T09:55:22","date_gmt":"2026-10-19T14:55:22","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248079"},"modified":"2026-10-21T12:30:42","modified_gmt":"2026-10-21T17:30:42","slug":"refactoring-factorials","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/","title":{"rendered":"Refactoring factorials"},"content":{"rendered":"<p>Splitting\u00a0<em>N<\/em>! into\u00a0<em>N<\/em> factors is trivial. It&#8217;s\u00a0<em>defined<\/em> as the product of\u00a0<em>N<\/em> integers, the integers 1 through\u00a0<em>N<\/em>.<\/p>\n<p>Can you still split\u00a0<em>N<\/em>! into\u00a0<em>N<\/em> factors if you put a minimum size requirement on the factors?<\/p>\n<p>You can&#8217;t split 3! into three factors unless one of the factors is 1, but you can split 4! into factors \u2265 2:<\/p>\n<p style=\"padding-left: 40px;\">4! = 24 = 2 \u00d7 2 \u00d7 2 \u00d7 3<\/p>\n<p>Define\u00a0<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,\u00a0<em>t<\/em>(<em>N<\/em>) \u2265 1 for all <em>N<\/em>,\u00a0<em>t<\/em>(3) = 1 and <em>t<\/em>(4) = 2. The\u00a0<em>t<\/em>(<em>N<\/em>) are given in OEIS sequence <a href=\"https:\/\/oeis.org\/A034258\">A034258<\/a>.<\/p>\n<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>\n<p>An upper bound on\u00a0<em>t<\/em>(<em>N<\/em>) would be the\u00a0<em>N<\/em>th root of\u00a0<em>N<\/em>! because that would correspond to splitting <em>N<\/em>! into\u00a0<em>N<\/em> factors of equal size. But the <em>N<\/em>th root of\u00a0<em>N<\/em>! will not be an integer for <em>N<\/em> &gt; 1, so the bound would not be tight.<\/p>\n<p>If we apply Stirling&#8217;s approximation for factorial we get<\/p>\n<p style=\"padding-left: 40px;\"><em>t<\/em>(<em>N<\/em>) \/\u00a0<em>N<\/em> \u2264 1\/<em>e<\/em> +\u00a0<em>O<\/em>(log(<em>N<\/em>) \/\u00a0<em>N<\/em>).<\/p>\n<p>It was conjectured that for large\u00a0<em>N<\/em><\/p>\n<p style=\"padding-left: 40px;\"><em>t<\/em>(<em>N<\/em>) \/\u00a0<em>N<\/em> \u223c 1\/<em>e<\/em> \u2212 <em>c<\/em><sub>0<\/sub> \/ log(<em>N<\/em>)<\/p>\n<p>and the new paper proves<\/p>\n<p style=\"padding-left: 40px;\"><em>t<\/em>(<em>N<\/em>) \/\u00a0<em>N<\/em> \u223c 1\/<em>e<\/em> \u2212 <em>c<\/em><sub>0<\/sub> \/ log(<em>N<\/em>) +\u00a0<em>O<\/em>(1 \/ log<sup>1 + <em>c<\/em><\/sup>\u00a0<em>N<\/em>).<\/p>\n<p>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Splitting\u00a0N! into\u00a0N factors is trivial. It&#8217;s\u00a0defined as the product of\u00a0N integers, the integers 1 through\u00a0N. Can you still split\u00a0N! into\u00a0N 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 \u2265 2: 4! [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[94],"class_list":["post-248079","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-number-theory"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction to the recent paper &quot;Decomposing a factorial into large factors&quot;.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"number theory\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Refactoring factorials\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction to the recent paper &quot;Decomposing a factorial into large factors&quot;.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-19T14:55:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-21T17:30:42+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Refactoring factorials\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Introduction to the recent paper &quot;Decomposing a factorial into large factors&quot;.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Refactoring factorials","description":"Introduction to the recent paper \"Decomposing a factorial into large factors\".","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/","robots":"max-image-preview:large","keywords":"number theory","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Refactoring factorials","og:description":"Introduction to the recent paper &quot;Decomposing a factorial into large factors&quot;.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/","article:published_time":"2026-10-19T14:55:22+00:00","article:modified_time":"2026-10-21T17:30:42+00:00","twitter:card":"summary","twitter:title":"Refactoring factorials","twitter:description":"Introduction to the recent paper &quot;Decomposing a factorial into large factors&quot;.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248079","title":null,"description":"Introduction to the recent paper \"Decomposing a factorial into large factors\".","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-19 13:27:24","updated":"2026-10-22 09:54:40","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/\" title=\"Uncategorized\">Uncategorized<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tRefactoring factorials\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Uncategorized","link":"https:\/\/www.johndcook.com\/blog\/category\/uncategorized\/"},{"label":"Refactoring factorials","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/refactoring-factorials\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248079"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248079\/revisions"}],"predecessor-version":[{"id":248093,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248079\/revisions\/248093"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":248073,"date":"2026-10-19T07:00:43","date_gmt":"2026-10-19T12:00:43","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=248073"},"modified":"2026-10-19T07:32:32","modified_gmt":"2026-10-19T12:32:32","slug":"regex-backtracking","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/","title":{"rendered":"A frivolous problem with a deeper lesson"},"content":{"rendered":"<p>About 14% of English words can be spelled by stringing together chemical symbols. For example, <em>sarcasm<\/em> can be written<\/p>\n<p style=\"padding-left: 40px;\">S Ar Ca Sm<\/p>\n<p>using the symbols for sulfur, argon, calcium, and samarium.<\/p>\n<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>\n<p>You could solve the problem with a regular expression:<\/p>\n<pre>(h|he|li|be|b|c|n|o|f|ne|na|mg|al|si| \u2026 |og)+<\/pre>\n<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>\n<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. A NFA (nondeterministic finite automata) engine that uses backtracking could take exponential time.<\/p>\n<p>The root of the problem is the ambiguity in dividing words into single letters or pairs of letters.<\/p>\n<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>\n<pre>cococo\u2026j<\/pre>\n<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>\n<p>A DFA regular expression engine always runs in <em>O<\/em>(<em>n<\/em>) time, but a (traditional) NFA can take exponential time. So why ever use an NFA engine? Because it 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 NFA engines have added safeguards to eliminate or at least reduce the chance of running into catastrophic backtracking.<\/p>\n","protected":false},"excerpt":{"rendered":"<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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[116],"class_list":["post-248073","post","type-post","status-publish","format-standard","hentry","category-computing","tag-regular-expressions"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"regular expressions\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"A frivolous problem with a deeper lesson\" \/>\n\t\t<meta property=\"og:description\" content=\"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-19T12:00:43+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-19T12:32:32+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"A frivolous problem with a deeper lesson\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"A frivolous problem with a deeper lesson","description":"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/","robots":"max-image-preview:large","keywords":"regular expressions","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"A frivolous problem with a deeper lesson","og:description":"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/","article:published_time":"2026-10-19T12:00:43+00:00","article:modified_time":"2026-10-19T12:32:32+00:00","twitter:card":"summary","twitter:title":"A frivolous problem with a deeper lesson","twitter:description":"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"248073","title":null,"description":"A regex to determine whether a word can be written using only chemical element symbols could run in linear time or exponential time, depending on the engine.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-10-19 07:07:12","updated":"2026-10-19 13:28:02","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tA frivolous problem with a deeper lesson\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog\/"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"A frivolous problem with a deeper lesson","link":"https:\/\/www.johndcook.com\/blog\/2026\/10\/19\/regex-backtracking\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=248073"}],"version-history":[{"count":5,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248073\/revisions"}],"predecessor-version":[{"id":248078,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/248073\/revisions\/248078"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=248073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=248073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=248073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}]