{"id":2771,"date":"2026-07-01T07:16:05","date_gmt":"2026-07-01T11:16:05","guid":{"rendered":"https:\/\/mathvoices.ams.org\/featurecolumn\/?p=2771"},"modified":"2026-07-21T09:48:05","modified_gmt":"2026-07-21T13:48:05","slug":"another-look-at-circles-and-squares","status":"publish","type":"post","link":"https:\/\/mathvoices.ams.org\/featurecolumn\/2026\/07\/01\/another-look-at-circles-and-squares\/","title":{"rendered":"Another Look at Circles and Squares"},"content":{"rendered":"<p><span id=\"pullQuote\"><em>This is not obviously a difficult problem. But in over two hundred years since Carl Friedrich Gauss first posed it, there has been remarkably little progress&#8230;<\/em><\/span><\/p>\n<h1 class=\"headlineText\">Another Look at Circles and Squares<\/h1>\n<p><b>Bill Casselman<br \/>\nUniversity of British Columbia<\/b><\/p>\n<h1>Another look at circles and squares<\/h1>\n<p>One of the most intriguing unsolved problems in<br \/>\nmathematics is very simple to explain.<\/p>\n<p>A lattice point in the plane is a point $(a,b)$<br \/>\nin which both $a$ and $b$ are integers. An <a href=\"https:\/\/www.ams.org\/publicoutreach\/feature-column\/fc-2015-11\">earlier Feature Column<\/a><br \/>\nwas concerned with the function<\/p>\n<p>$$ r_{2}(n) = \\hbox{ the number of lattice points $(a,b)$ such that<br \/>\n$a^{2} + b^{2} = n$.} $$<\/p>\n<p>Or, in other words, the number of lattice points<br \/>\nlying on the circle of radius $\\sqrt{n}$ centred at the origin.<br \/>\nIn this column, let<\/p>\n<p>$$ R_{2}(n) = {\\sum}_{m \\le n} r_{2}(m) \\, . $$<\/p>\n<p>This is the number of lattice points<br \/>\ninside the closed disk of radius $\\sqrt{n}$.<br \/>\nFor example, $R_{2}(10) = 37$, as this diagram shows:<\/p>\n<figure>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles2.png?resize=238%2C238&#038;ssl=1\" alt=\"Lattice points inside a circle, outside the circle, and on the boundary.\" width=\"238\" height=\"238\" class=\"aligncenter size-full wp-image-2777\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles2.png?w=238&amp;ssl=1 238w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles2.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 238px) 100vw, 238px\" \/><br \/>\n<\/figure>\n<p>For large $n$, the number $R_{2}(n)$ is approximately<br \/>\nequal to the area $\\pi n$ of the disk of radius $\\sqrt{n}$.<br \/>\nThe problem I have in mind is this:<\/p>\n<table align=\"center\" width=\"500\">\n<tr>\n<td>\n<em>$\\bullet$ What is a good estimate of the<br \/>\nerror $|\\Delta(n)| = |R_{2}(n) &#8211; \\pi n|$ in approximating<br \/>\n$R_{2}(n)$ by the area?<\/em>\n<\/td>\n<\/tr>\n<\/table>\n<p>This is not obviously a difficult problem.<br \/>\nBut in over two hundred years since<br \/>\nCarl Friedrich Gauss<br \/>\nfirst posed it, there has been remarkably<br \/>\nlittle progress.  Gauss proved that<br \/>\n$\\Delta(n)$ is bounded by a small<br \/>\nmultiple of the length $2 \\pi \\sqrt{n}$ of<br \/>\nthe circumference, by an elementary argument.<br \/>\nNothing elementary is to be found in any<br \/>\nsubsequent work.<br \/>\nMathematicians in the early twentieth century<br \/>\nshowed in various ways that $\\Delta(n)$ was of order at most $n^{1\/3}$.<br \/>\nSince then, improvements have been technical and modest.<br \/>\nI think it is fair to say that we have<br \/>\nessentially no idea of what&#8217;s going on.<\/p>\n<p>That earlier column derived a formula for $r_{2}(n)$<br \/>\ndue to the nineteenth century mathematician Carl Gustav Jacob Jacobi:<\/p>\n<p>$$ r_{2}(n) = 4(d_{1}(n) &#8211; d_{3}(n)) \\qquad \\hbox{( $n \\ge 1$ ) } $$<\/p>\n<p>where $d_{i}(n)$ is the number of positive divisors of $n$<br \/>\ncongruent to $i$ modulo $4$.  For example, if $n$ is<br \/>\na prime congruent to $1$ modulo $4$ then $r_{2}(n) = 8$,<br \/>\nand if it is a prime congruent to $3$ then $r_{2}(n) = 0$.<\/p>\n<figure>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/r2graph01.png?resize=599%2C124&#038;ssl=1\" alt=\"A bar graph showing the number of lattice points lying on circles of specified radius. The values jump up and down.\" width=\"599\" height=\"124\" class=\"aligncenter size-full wp-image-2778\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/r2graph01.png?w=599&amp;ssl=1 599w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/r2graph01.png?resize=300%2C62&amp;ssl=1 300w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/r2graph01.png?resize=465%2C96&amp;ssl=1 465w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><figcaption>Graph of $r_{2}(n)$<\/figcaption><\/figure>\n<p>\nAs its graph illustrates, the<br \/>\nfunction $r_{2}(n)$ behaves erratically as $n$ grows,<br \/>\nbut for us the most important thing about it is that<br \/>\nit is known<br \/>\nthat $r_{2}(n)$ remains rather small<br \/>\nas $n$ grows.  A well known result is<br \/>\nthat it grows more slowly than any<br \/>\nfunction $n^{s}$ with $s &gt; 0$.  (This is<br \/>\nfound, for example, at the beginning<br \/>\nof Chapter XIII of the<br \/>\n<a href=\"#hardy-wright\">classic text by Hardy and Wright<\/a>.)<\/p>\n<h2>Some details<\/h2>\n<p>Gauss&#8217; result is that the difference between $R_{2}(n)$ and the area<br \/>\nof the disk is bounded by a small multiple of its circumference:<\/p>\n<p>\n<b>Theorem<\/b>.  <em>If  $n \\ge 2$ then<br \/>\n$| \\pi n &#8211; R_{2}(n) | \\le \\sqrt{2} \\cdot 2 \\pi \\sqrt{n}$.<\/em><\/p>\n<p>\n<em>Proof.<\/em>  Each lattice point $\\lambda$ is the center of<br \/>\na square $S_{\\lambda}$ of side $1$. These squares tile the plane.  Let<br \/>\n$R_{in}(n)$ be the number of those squares fully contained in the disk<br \/>\nof radius $\\sqrt{n}$, $R_{out}(n)$ the number of those<br \/>\nhaving a point in common with it.  As the following figures<br \/>\nshow, the squares inside the disk cover<br \/>\nthe disk of radius $\\sqrt{n} &#8211; \\sqrt{2}$, while those in the second group<br \/>\nare contained in the disk of radius $\\sqrt{n} + \\sqrt{2}$.  <\/p>\n<figure>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles0.png?resize=238%2C238&#038;ssl=1\" alt=\"Highlights squares inside a disk.\" width=\"238\" height=\"238\" class=\"aligncenter size-full wp-image-2775\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles0.png?w=238&amp;ssl=1 238w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles0.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 238px) 100vw, 238px\" \/><br \/>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles1.png?resize=238%2C238&#038;ssl=1\" alt=\"Highlights squares touching a disk.\" width=\"238\" height=\"238\" class=\"aligncenter size-full wp-image-2776\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles1.png?w=238&amp;ssl=1 238w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/circles1.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 238px) 100vw, 238px\" \/><br \/>\n<\/figure>\n<td>\n<p>\nTherefore<\/p>\n<p>$$ \\pi(\\sqrt{n} &#8211; \\sqrt{2})^{2} \\le R_{in}(n)<br \/>\n\t\\le R_{2}(n) \\le R_{out}(n) \\le \\pi(\\sqrt{n} + \\sqrt{2})^{2} $$<\/p>\n<p>\nor<\/p>\n<p>$$ | R_{in}(n) &#8211; \\pi n | \\le 2 \\pi (\\sqrt{2} \\sqrt{n} + 1) \\, . $$<\/p>\n<p>\nThis was apparently first observed by the<br \/>\n nineteenth mathematician Carl Friedrich Gauss, who constructed the<br \/>\ntable below.<\/p>\n<table align=\"center\" width=\"400\">\n<tr>\n<td>$R^{2}$<\/td>\n<td>$N(R) $<\/td>\n<td>$R^{2}$<\/td>\n<td>$N(R)$<\/td>\n<td>$R^{2}$<\/td>\n<td>$N(R)$<\/td>\n<\/tr>\n<tr>\n<td> 100 <\/td>\n<td> 317 <\/td>\n<td> 1000 <\/td>\n<td> 3149 <\/td>\n<td> 10000 <\/td>\n<td> 31417 <\/td>\n<\/tr>\n<tr>\n<td> 200 <\/td>\n<td> 633 <\/td>\n<td> 2000 <\/td>\n<td> 6293 <\/td>\n<td> 20000 <\/td>\n<td> 62845 <\/td>\n<\/tr>\n<tr>\n<td> 300 <\/td>\n<td> 949 <\/td>\n<td> 3000 <\/td>\n<td> 9425 <\/td>\n<td> 30000 <\/td>\n<td> 94237 <\/td>\n<\/tr>\n<tr>\n<td> 400 <\/td>\n<td> 1257 <\/td>\n<td> 4000 <\/td>\n<td> 12581 <\/td>\n<td> 40000 <\/td>\n<td> 125629 <\/td>\n<\/tr>\n<tr>\n<td> 500 <\/td>\n<td> 1581 <\/td>\n<td> 5000 <\/td>\n<td> 15705 <\/td>\n<td> 50000 <\/td>\n<td> 157093 <\/td>\n<\/tr>\n<tr>\n<td> 600 <\/td>\n<td> 1885 <\/td>\n<td> 6000 <\/td>\n<td> 18853 <\/td>\n<td> 60000 <\/td>\n<td> 188453 <\/td>\n<\/tr>\n<tr>\n<td> 700 <\/td>\n<td> 2209 <\/td>\n<td> 7000 <\/td>\n<td> 21993 <\/td>\n<td> 70000 <\/td>\n<td> 219901 <\/td>\n<\/tr>\n<tr>\n<td> 800 <\/td>\n<td> 2521 <\/td>\n<td> 8000 <\/td>\n<td> 25137 <\/td>\n<td> 80000 <\/td>\n<td> 251305 <\/td>\n<\/tr>\n<tr>\n<td> 900 <\/td>\n<td> 2821 <\/td>\n<td> 9000 <\/td>\n<td> 28269 <\/td>\n<td> 90000 <\/td>\n<td> 282697 <\/td>\n<\/tr>\n<tr>\n<td> 1000 <\/td>\n<td> 3149 <\/td>\n<td> 10000 <\/td>\n<td> 31417 <\/td>\n<td> 100000 <\/td>\n<td> 314197 <\/td>\n<\/tr>\n<\/table>\n<p>\nIncidentally, Gauss told us what formula he used for these calculations.<br \/>\nRecall that $\\lfloor x \\rfloor$ is the largest integer<br \/>\nbelow or equal to $x$.<br \/>\nBecause of symmetry properties of the circle,<br \/>\nthe number of lattice points in the disk is<br \/>\n$1$ plus $4$ times the number in the region<br \/>\n$b \\ge 1$, $0 \\le a^{2} \\le n-b^{2}$.  So<\/p>\n<p>$$ R_{2}(n) = 1 + 4 \\, {\\sum}_{b^{2} \\le n}<br \/>\n\t\\Big(  1 + \\big \\lfloor \\sqrt{n &#8211; b^{2}} \\big \\rfloor \\Big) \\, . $$<\/p>\n<p>The amount of work is proportional to $\\sqrt{n}$, and Gauss&#8217; table<br \/>\nrepresents an impressive amount of effort.<\/p>\n<p>\nGauss&#8217; result is that the discrepancy is of order at most $\\sqrt{n}$.<br \/>\nHow good is this estimate?<\/p>\n<p>\nThe number $R_{2}(n)$ is the same as the number of those unit<br \/>\nsquares centred at lattice<br \/>\npoints inside the disk of radius $\\sqrt{n}$.  But the relation between<br \/>\nthe location of a lattice point and how its unit square<br \/>\nintersects the disk is a bit complicated.  In the following figure<br \/>\nthe blue areas represent those pieces of squares centred at<br \/>\nlattice points inside the disk that are not themselves in the disk.<\/p>\n<figure>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=332%2C332&#038;ssl=1\" alt=\"Portions of squares that are inside the disk but whose central lattice point is outside are shaded in blue.\" width=\"332\" height=\"332\" class=\"aligncenter size-full wp-image-2774\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?w=332&amp;ssl=1 332w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><br \/>\n<\/figure>\n<p>\nThe blue regions represent how lattice points<br \/>\noverestimate the area of the disk.<br \/>\nBut they are complemented by the pink areas,<br \/>\nwhich are in squares centred outside the disk<br \/>\nbut still touch it.  They contribute to<br \/>\nan underestimate of the area.  At least visually, the two colored regions<br \/>\nroughly cancel out.  This means that Gauss&#8217; bound on $\\Delta$ is pessimistic.<br \/>\nHow far off is it?  With computers we can look at larger numbers than Gauss.<br \/>\nHere are some more values:<\/p>\n<table align=\"center\" width=\"400\">\n<tr>\n<th>$n$<\/th>\n<th>$R_{2}(n)$<\/th>\n<th>$\\Delta(n)$<\/th>\n<\/tr>\n<tr>\n<td>$10^{1}$<\/td>\n<td>37<\/td>\n<td>-6<\/td>\n<\/tr>\n<tr>\n<td>$10^{2}$<\/td>\n<td>317<\/td>\n<td>-3<\/td>\n<\/tr>\n<tr>\n<td>$10^{3}$<\/td>\n<td>3149<\/td>\n<td>-7<\/td>\n<\/tr>\n<tr>\n<td>$10^{4}$<\/td>\n<td>31417<\/td>\n<td>-1<\/td>\n<\/tr>\n<tr>\n<td>$10^{5}$<\/td>\n<td>314197<\/td>\n<td>-38<\/td>\n<\/tr>\n<tr>\n<td>$10^{6}$<\/td>\n<td>3141549<\/td>\n<td>44<\/td>\n<\/tr>\n<tr>\n<td>$10^{7}$<\/td>\n<td>31416025<\/td>\n<td>-98<\/td>\n<\/tr>\n<tr>\n<td>$10^{8}$<\/td>\n<td>314159053<\/td>\n<td>212<\/td>\n<\/tr>\n<tr>\n<td>$10^{9}$<\/td>\n<td>3141592409<\/td>\n<td>245<\/td>\n<\/tr>\n<tr>\n<td>$10^{10}$<\/td>\n<td>31415925457<\/td>\n<td>1079<\/td>\n<\/tr>\n<tr>\n<td>$10^{11}$<\/td>\n<td>314159264029<\/td>\n<td>1330<\/td>\n<\/tr>\n<tr>\n<td>$10^{12}$<\/td>\n<td>3141592649641<\/td>\n<td>3949<\/td>\n<\/tr>\n<tr>\n<td>$10^{13}$<\/td>\n<td>31415926532017<\/td>\n<td>3881<\/td>\n<\/tr>\n<tr>\n<td>$10^{14}$<\/td>\n<td>314159265350589<\/td>\n<td>8390<\/td>\n<\/tr>\n<tr>\n<td>$10^{15}$<\/td>\n<td>3141592653588541<\/td>\n<td>1252<\/td>\n<\/tr>\n<tr>\n<td>$10^{16}$<\/td>\n<td>31415926535867977<\/td>\n<td>29955<\/td>\n<\/tr>\n<tr>\n<td>$10^{17}$<\/td>\n<td>314159265358987341<\/td>\n<td>-8017<\/td>\n<\/tr>\n<tr>\n<td>$10^{19}$<\/td>\n<td>31415926535897744689<\/td>\n<td>187696<\/td>\n<\/tr>\n<tr>\n<td>$10^{20}$<\/td>\n<td>314159265358978759705<\/td>\n<td>564141<\/td>\n<\/tr>\n<\/table>\n<p>\nBased on what this list shows,<br \/>\none would guess that $\\Delta(n)$ is of order<br \/>\n$n^{1\/4}$.  It is this guess that mathematicians, in<br \/>\ntwo hundred years of work, have neither confirmed nor contradicted.<\/p>\n<h2>A short history<\/h1>\n<p>At the beginning of the twentieth century<br \/>\nthe Polish mathematician<br \/>\n Wac\u0142aw Sierpinski, just beginning an extremely productive career,<br \/>\n proved that the discrepancy is of order at most<br \/>\n$n^{1\/3}$.  His methods followed very closely<br \/>\nearlier work by the Ukrainian mathematician<br \/>\nGeorgy Voronoi on a related problem<br \/>\nabout hyperbolas rather than circles.<br \/>\n(Voronoi had been his advisor in Warsaw.)<br \/>\n The English mathematician<br \/>\nG. H. Hardy proved that<br \/>\n$n^{1\/4}$ is a lower bound for the order of the discrepancy,<br \/>\nand conjectured that this is in fact the true upper bound as well.<\/p>\n<p>\nMuch work has been spent on this conjecture in the past century,<br \/>\nbut in spite of much talented effort there has been<br \/>\nlittle reward.  The sophistication of the mathematics involved is impressive.<br \/>\nI am not sure what the best current<br \/>\nproven estimate is, but a typical value is<br \/>\norder $n^{r}$ for $r = 131\/416 \\sim 0.3149$,<br \/>\npublished in 2003 by Martin Huxley.<\/p>\n<h2>An exact formula<\/h2>\n<p>There is actually an exact formula for $R_{2}(n)$.<br \/>\nIt was  conjectured by<br \/>\nVoronoi in 1905 and, after a few false starts,<br \/>\n proved by Hardy and Edmund Landau around 1923.<br \/>\nIt has some peculiar features,<br \/>\nand in some ways is more of a tease than a<br \/>\nmagic key.<br \/>\nBut it has played a role in many of the known estimates of $\\Delta(n)$.<br \/>\nThis formula is not at all elementary,<br \/>\nand involves some higher mathematics.<br \/>\nI&#8217;ll first state it, then look at a simple model<br \/>\nthat illustrates nicely some of its difficulties.<\/p>\n<p>\nThe <b>Bessel function<\/b> $J_{n}(x)$ is defined by its Taylor series at $x = 0$:<\/p>\n<p>$$ J_{n}(x) = {\\sum}_{i} { (-1)^{i} \\over i! (n + i)! }<br \/>\n\t\\left ( { x \\over 2 } \\right)^{2i + n} \\, ,<br \/>\n$$<\/p>\n<p>\nThis series converges for all $x$, although there are practical problems in<br \/>\nusing it for computation, because of cancellation effects.<br \/>\nHowever, it will give you absolutely no idea<br \/>\nof their important properties, or why they are interesting.<br \/>\nThe Taylor series tells us how to calculate Bessel functions for $|x|$ small;<br \/>\n we also have a good idea of what they look like in the opposite case&mdash;when $|x|$ is large $J_{n}(x)$ differs very little from<\/p>\n<p>$$ \\sqrt{ \\left ( {2 \\over \\pi x} \\right )}<br \/>\n\t\\cos \\left ( x &#8211; { (2n+1) \\pi \\over 4 } \\right ) \\, . $$<\/p>\n<p>\nIt is oscillating and slowly decreasing<br \/>\nwhen $|x|$ is large.<\/p>\n<p>\nLet $\\Lambda$ be the set of lattice points $(a, b)$ in ${\\Bbb R}^{2}$.<br \/>\nLet $\\overline{R}_{2}(n)$ be a slight modification of $R_{2}(n)$:<\/p>\n<p>$$ \\overline{R}_{2}(n) = {\\sum}_{\\lambda} \\chi_{n}(\\lambda)  $$<\/p>\n<p>\nwhere<\/p>\n<p>$$ \\chi_{n}(x,y) = \\cases {<br \/>\n\t\\kern3pt 1 &amp; if $x^{2} + y^{2} &lt; n$ \\cr<br \/>\n\t1\/2 &amp; if $x^{2} + y^{2} = n$ \\cr<br \/>\n\t\\kern3pt 0 &amp; otherwise. \\cr<br \/>\n} $$<\/p>\n<p>\nThat is to say, lattice points on the<br \/>\ncircle $|v|^{2} = n$ are counted as $1\/2$.<br \/>\nThe quantity  $\\overline{R}_{2}$<br \/>\n differs little<br \/>\nfrom $R_{2}$, but has some useful properties.<br \/>\nThe formula of Hardy and Wright is that<\/p>\n<p>$$ \\eqalign {<br \/>\n\\overline{R}_{2}(n) &amp;= \\pi n<br \/>\n+ \\sqrt{n} \\, {\\sum}_{\\lambda \\ne 0}<br \/>\n\t{ J_{1}(2 \\pi |\\lambda| \\sqrt{n}) \\over |\\lambda| } \\cr<br \/>\n\t&amp;= \\pi n<br \/>\n+ \\sqrt{n} \\, {\\sum}_{m \\ne 0} r_{2}(m)<br \/>\n\t{ J_{1}(2 \\pi \\sqrt{mn}) \\over \\sqrt{m} } \\, . \\cr<br \/>\n} $$ <\/p>\n<p>\nWell &#8230; this looks promising.  Especially if one<br \/>\nkeeps in mind the asymptotic behaviour of $J_{1}$. This tells us that each individual term is of order $n^{1\/4}$.<br \/>\nBut that is an illusion.  The series does not converge<br \/>\nuniformly, but only conditionally, and<br \/>\none can derive from it no really good<br \/>\nestimate of $\\overline{R}_{2}(n)$.<br \/>\nIt has turned out not to be useless,<br \/>\nbut it is not easy to apply.<\/p>\n<p>\nI&#8217;ll not say more about this formula, but try to<br \/>\ngive you some idea of the problems that arise<br \/>\nby looking at a simple model that we can<br \/>\nunderstand thoroughly.<\/p>\n<p>\nIt involves a one-dimensional analogue of $R_{2}(n)$.<br \/>\nFor the moment, suppose $f$ to<br \/>\nbe a function on ${\\Bbb R}$ of bounded support and twice differentiable.<br \/>\nThe function<\/p>\n<p>$$ F(x) = {\\sum}_{m} f(x + m) $$<\/p>\n<p>\nwill be invariant under translations by integers,<br \/>\nand can be expressed in terms of its Fourier series:<\/p>\n<p>\n$$ F(x) = {\\sum}_{m} \\widehat{F}(m) e^{2 \\pi i mx } $$<\/p>\n<p>\nwhere<\/p>\n<p>$$ \\widehat{F}(m)<br \/>\n\t= \\int_{0}^{1} F(x) e^{-2 \\pi i mx} \\, dx<br \/>\n\t= \\int_{{\\Bbb R}} f(x) e^{-2 \\pi i m x} \\, dx \\, .<br \/>\n$$<\/p>\n<p>\nIn particular,<\/p>\n<p>$$ {\\sum}_{i} f(i)<br \/>\n\t= {\\sum}_{j} \\widehat{F}(j) \\, . $$<\/p>\n<p>This is the <b>summation<\/b> formula.<\/p>\n<p>\nUnfortunately, we want to use a formula<br \/>\nlike this when $f$ is of bounded support, but not necessarily continuous.<br \/>\nLet<\/p>\n<p>$$ \\chi_{\\nu}(x) = \\cases {<br \/>\n\t\\kern 3 pt 1 &amp; if $|x| &lt; \\nu$ \\cr<br \/>\n\t1\/2 &amp; if $|x| = \\nu$ \\cr<br \/>\n\t\\kern 4 pt 0 &amp; otherwise. \\cr<br \/>\n} $$<\/p>\n<p>\nIt is discontinous at $\\pm \\nu$.<br \/>\nIs the summation formula valid for $\\chi_{\\nu}$?<br \/>\nIf $k$ is an integer then\n<\/p>\n<p>$$ \\overline{\\chi}_{\\nu}(k) = \\cases {<br \/>\n\t2k &amp; if $|k| = \\nu$ \\cr<br \/>\n\t2k+1 &amp; if $k &lt; x &lt; k+1$ \\cr<br \/>\n}<br \/>\n$$<\/p>\n<p>$$ \\widehat{\\chi}_{\\nu}(m) =<br \/>\n\\int_{-\\nu}^{\\nu} \\, e^{-2 \\pi m x} \\, dx<br \/>\n$$<\/p>\n<p>If $m=0$ this is $2\\nu$, and<br \/>\notherwise:<\/p>\n<p>$$<br \/>\n\\eqalign {<br \/>\n\\left[ { e^{-2\\pi i m x} \\over -2 \\pi i m } \\right ]^{\\nu}_{-\\nu}<br \/>\n\t&amp; = { e^{-2\\pi i m\\nu} \\over -2 \\pi i m }<br \/>\n\t&#8211; { e^{2\\pi i m \\nu} \\over -2 \\pi i m \\nu} \\cr<br \/>\n\t&amp;=  { \\alpha^{m} &#8211; \\alpha^{-m} \\over -2 \\pi i m} \\cr<br \/>\n} $$<\/p>\n<p>if $\\alpha = e^{-2\\pi i \\nu}$.<br \/>\nThe terms are the same for $\\pm m$, so the sum is<\/p>\n<p>$$ \\eqalign {<br \/>\n{- 1 \\over \\pi i } {\\sum}_{m &gt; 0}<br \/>\n\t{ \\alpha^{m} \\over m }<br \/>\n\t&#8211; {-1 \\over \\pi i } {\\sum}_{m &gt; 0} { \\alpha^{-m} \\over m }<br \/>\n\t&amp; = {-1 \\over \\pi i } \\left ( \\log(1 + \\alpha) &#8211; \\log(1 + \\alpha^{-1}) \\right) \\cr<br \/>\n\t&amp; = {-1 \\over \\pi i } \\log\\left ( { 1 + \\alpha\\phantom{^{-1}} \\over 1 + \\alpha^{-1} } \\right ) \\, . \\cr<br \/>\n} $$<\/p>\n<p>\nas long as $\\alpha \\ne 1$.<br \/>\nBut<\/p>\n<p>$$ { 1 + \\alpha \\over 1 + \\alpha^{-1} } = \\alpha $$<\/p>\n<p>so that this becomes<\/p>\n<p>$$ {1 \\over \\pi i } \\log \\alpha $$<\/p>\n<p>but $\\alpha = e^{2 \\pi i \\nu}$, $\\log \\alpha$ is $2 \\pi i \\nu$.<\/p>\n<p>Well, almost.<br \/>\nThe peculiar feature is that the series for $\\log (1 &#8211; z)$<br \/>\nconverges only for $|z| &lt; 1$, whereas for us $|z|=1$.<br \/>\nAs $n$ varies, we keep crossing the line $[, \\infty)$,<br \/>\nand we have to change the branch of $\\log$.<\/p>\n<p>\nIncidentally the series we are dealing with does converge,<br \/>\nbut it is not so easy to verify this directly.<br \/>\nThe point is that as $\\nu$ approaches an integer,<br \/>\nthe convergence slows up.  Of course it has to,<br \/>\nsince $\\chi_{\\nu}$ is not continuous. I do not have a<br \/>\nclear picture of how the series in the Hardy-Landau formula works.<br \/>\nAs far as I know,<br \/>\nthere is no really simple proof of their result.<br \/>\nModern mathematicians work with modifications of it.<\/p>\n<h2>Loose ends<\/h2>\n<h3>Curvature?<\/h3>\n<p>I find the picture<\/p>\n<figure>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=332%2C332&#038;ssl=1\" alt=\"Portions of squares that are inside the disk but whose central lattice point is outside are shaded in blue.\" width=\"332\" height=\"332\" class=\"aligncenter size-full wp-image-2774\" srcset=\"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?w=332&amp;ssl=1 332w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2026\/07\/blurbcircle.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><br \/>\n<\/figure>\n<p>fascinating.  It suggests that<br \/>\nthe basic problem is one of probability&mdash;how the location of a<br \/>\nlattice point and the orientation of its<br \/>\nattached square interact with the circle<br \/>\n$x^{2} + y^{2} = n$.<br \/>\nThe fact that the circle is curved also plays a role.<br \/>\nThis is a well known observation&mdash;see<br \/>\n<a href=\"#iosevich\">an article by Alex Iosevich<\/a>.<\/p>\n<h3>Computation<\/h3>\n<p>Gauss&#8217; formula for $R_{2}(n)$ is easy to implement,<br \/>\nbecause there is a well known simple<br \/>\nalgorithm to compute integral square roots<br \/>\nwithout calling on real numbers.<br \/>\nBut it becomes very slow<br \/>\nfor large numbers.  A faster one has been<br \/>\nproposed on the anonymous web site<br \/>\n<a href=\"http:\/\/am-just-a-nobody.blogspot.com\/2018\/02\/python-code-gausss-circle-problem.html\">I write, therefore I am<\/a>.<br \/>\nUnfortunately, the code found there uses<br \/>\nstandard floating point numbers of low precision and does not work<br \/>\nfor even reasonably large $n$.  There are references to<br \/>\nfaster and more efficient code in comments, but none explicit.<br \/>\nThey are claimed to have run time<br \/>\nproportional to $n^{1\/3$.  The main difference from Gauss&#8217; method is that<br \/>\neach pass counts points in triangles instead of line segments.<br \/>\nIt would be nice to see a rigorous analysis.<\/p>\n<p>\nI have myself written a program that<br \/>\nfollows the suggestion of the anonymous site;<br \/>\nit computes $R_{2}(n)$<br \/>\nfor $n$ up to $10^{20}$, and <a href=\"https:\/\/personal.math.ubc.ca\/~cass\/fc\/r2.html\">I have posted it<\/a>.<br \/>\nIt does not take $n^{1\/3}$ run time,<br \/>\nbut is much faster than Gauss&#8217; algorithm.<\/p>\n<h3>Dirichlet&#8217;s problem<\/h3>\n<p>There has been much wotk on the analogue of Gauss&#8217;<br \/>\nproblem for hyperbolas $xy=n$, which the number of divisors of<br \/>\na positive integer replaces $r_{2}$.  It was for this<br \/>\nproblem that Voronoi proved the $n^{1\/3}$ bound in his<br \/>\n1903 paper.  Sierpinski followed his argument closely.<br \/>\nThe anonymous algorithm discussed above<br \/>\nfor the circle problem was first written by Richard Sladkey to<br \/>\ndeal with the hyperbolic case, and the basic idea<br \/>\nis derived from one of Voronoi&#8217;s ideas.<\/p>\n<h2>Reading further<\/h2>\n<ul>\n<li>\n<a href=\"https:\/\/eudml.org\/doc\/215228\">Sierpinski&#8217;s 1906 paper<\/a> <\/p>\n<p>\nIt is written in Polish, but with a brief summary in French at the end.<br \/>\nThe title in French is<br \/>\nexactly the same as that of Voronoi&#8217;s paper on the<br \/>\nDirichlet&#8217;s divisor problem.<\/p>\n<li>\nLink to <a href=\"https:\/\/personal.math.ubc.ca\/~cass\/fc\/r2.html\"><br \/>\na python program of mine<\/a><\/p>\n<li id=\"hardy-wright\">\nG. H. Hardy and E. Wright,<br \/>\n<b>Introduction to the Theory of Numbers<\/b>,<br \/>\nOxford University Press.<\/p>\n<li>\n<a href=\"http:\/\/dml.mathdoc.fr\/item\/GDZPPN002165481\/\">Voronoi&#8217;s 1903 paper<\/a>,<br \/>\nin <em>Journal f\u00fcr die reine und angewandte Mathematik<\/em>,<br \/>\nvolume 126 (2003),<br \/>\npages 241&#8211;282<\/p>\n<li>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Baudot_code\">&Uuml;ber den Zusammenhang<br \/>\nzwischen der Anzahl der Klassen, in welche die bin&auml;ren Formen<br \/>\nzweiten Grades zerfallen, und ihrer Determinante<\/a><\/p>\n<p>\nTranslated from Gauss&#8217; Latin.<\/p>\n<li>\nMIT course notes on Gauss&#8217; problem<br \/>\nare available.  Search for Lectures 20 and 21<br \/>\nof 18.156.  The lecturer is Larry Guth.<br \/>\nOne of many places where the $n^{1\/3}$ bound is proved.<\/p>\n<li id=\"iosevich\"><em>Curvature, Combinatorics, and the Fourier Transform<\/em><br \/>\nin the <a href=\"https:\/\/www.ams.org\/home\/searchresults?cx=433170aa8883642d1&amp;q=iosevich#gsc.tab=0&amp;gsc.q=iosevich&amp;gsc.page=1\">July 2001 issue<\/a><br \/>\nof the Notices of the<br \/>\nAmerican Mathematical Society<\/p>\n<ul>\n","protected":false},"excerpt":{"rendered":"<p>This is not obviously a difficult problem. But in over two hundred years since Carl Friedrich Gauss first posed it, there has been remarkably little progress&#8230; Another Look at Circles and Squares Bill Casselman University of British Columbia Another look at circles and squares One of the most intriguing unsolved<span class=\"more-link\"><a href=\"https:\/\/mathvoices.ams.org\/featurecolumn\/2026\/07\/01\/another-look-at-circles-and-squares\/\">Read More &rarr;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":1599,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[213,6,8,15],"tags":[236,235,97],"class_list":["entry","author-uwhitcher","post-2771","post","type-post","status-publish","format-standard","has-post-thumbnail","category-213","category-algebra-and-number-theory","category-bill-casselman","category-history-of-mathematics","tag-approximation","tag-carl-friedrich-gauss","tag-lattices-groups"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/mathvoices.ams.org\/featurecolumn\/wp-content\/uploads\/sites\/2\/2023\/03\/mathvoices-banner-feat-col.png?fit=2760%2C580&ssl=1","_links":{"self":[{"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/posts\/2771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/comments?post=2771"}],"version-history":[{"count":17,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/posts\/2771\/revisions"}],"predecessor-version":[{"id":2804,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/posts\/2771\/revisions\/2804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/media\/1599"}],"wp:attachment":[{"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/media?parent=2771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/categories?post=2771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathvoices.ams.org\/featurecolumn\/wp-json\/wp\/v2\/tags?post=2771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}