# How many points $(x, y)$ with integer coordinates satisfy the inequality $x^2+y^2 \leq 25$?

I had this questions from a previous exam that I couldn't answer, I am apologizing for any English mistakes or for any stupid questions, I tried to solve them and I searched the internet and I couldn't find answers or at least ones with explanations.

1-if $$x^2 + y^2 \leq 25$$ How many INTEGER pairs of $x,y$ satisfy the inequality?
*I tried to think of combinatorics but I didn't know how it can help me, I had to use brute force in the end.

Thanks for taking the time to read the question, if anyone has tips for my exam or know any challenging problems I would be really thankful if he/she could tell me about them!
Thanks!

• Break up into separate questions. For (2), hint - find xyz first. – Macavity Jul 17 '17 at 22:52
• One question per post; since you've put far too many questions in one post, it's too broad of a question. – Namaste Jul 17 '17 at 22:54
• Presumably, all variables here are integers? – Shuri2060 Jul 17 '17 at 22:55
• in the first and the third and the fourth questions all variables are integers, I am not sure about the second and the fifth but they are probably integers! I will try to break the questions. – user3289743 Jul 17 '17 at 23:12
• Possible duplicate of 'math.stackexchange.com/questions/606002/…'. You are looking for the number of unit-squares in a circle of radius 5. – user1952500 Jul 17 '17 at 23:33

In the closed disc of radius $5$ there are $$\bigl\lfloor\sqrt{25}\bigr\rfloor+\bigl\lfloor\sqrt{24}\bigr\rfloor+\bigl\lfloor\sqrt{21}\bigr\rfloor+\bigl\lfloor\sqrt{16}\bigr\rfloor+\bigl\lfloor\sqrt{9}\bigr\rfloor=20$$ lattice points satisfying $x\geq0$, $y>0$. The total number of lattice points in this disc therefore is $1+4\cdot20=81$.

This is an instance of Gauss' circle problem about lattice points in a circle.
If we set $r_2(n)=\left|\{(a,b)\in\mathbb{Z}\times\mathbb{Z}: a^2+b^2=n\}\right|$ and $$\chi(n)=\left\{\begin{array}{rcl}1&\text{if}& n\equiv 1\pmod{4}\\ -1&\text{if}& n\equiv 3\pmod{4}\\ 0&\text{if}& n\equiv 0\pmod{2}\end{array}\right.$$ Lagrange's identity and the UFD property of $\mathbb{Z}[i]$ allow us to state that $$r_2(n) = 4\sum_{d\mid n}\chi(d)$$ so the number of lattice points inside a circle depends on the average value of $r_2(n)$.
In our case we have:

$$\begin{eqnarray*}\left|\left\{(a,b)\in\mathbb{Z}\times\mathbb{Z}:a^2+b^2\leq 25\right\}\right|&=&1+4\sum_{n=1}^{25}\sum_{d\mid n}\chi(d)\\&=&21+4\sum_{k=1}^{3}\left\lfloor\sqrt{25-k^2}\right\rfloor=\color{red}{81}.\end{eqnarray*}$$

It is reasonable to expect that the number of lattice points in $x^2+y^2\leq 25$ is pretty close to the enclosed area, namely $25\pi\approx 78.54$. Gauss' circle problem is indeed about estimating the difference between these objects. There place were grid-lines of the graph cross "lattice points."

$x^2 + y^2 = 5$ cuts through 16 of the lattice points $(\pm 5,0), (0,\pm 5), (\pm3,\pm4)$

If we construct an irregular octagon connecting these 8 points. It would have an area slightly less than the area of the circle.

The area of the circle is $25\pi$

Pick's theorem says that the number of lattice point on the interior (I) $+ \frac 12$ the number of lattice points on the perimeter(E) $- 1$ equals the area of any enclosed polygon.

$I+ 8 - 1 < 25\pi\\ I < 71$

Next, there a symmetry to the grid-line. The center is stationary. For every other point on the lattice, if we rotate 90 degree we will find another point on the lattice.

$I-1$ is divisible by $4$

$I=69$ is the largest number that meet the two constraints we have.

A brute force approach abusing symmetries. Notice that if $(x,y)$ is a solution then so is $(y,x)$ and if $(x,y)$ is a solution then so is $(\pm x,\pm y)$.

Solutions including zero are $(1,0),(2,0),(3,0),(4,0),(5,0)$ and each of the pairs has $4$ symmetries hence $5\cdot 4=20$ and plus $(0,0)$ so $21$ solutions with $0$.

Now solutions where $x=y\neq 0$ also have $4$ symmetries $(1,1),(2,2),(3,3)$ so $3\cdot 4=12$ solutions and the rest solutions have $8$ symmetries and thoose are $(4,3),(4,2),(4,1),(3,2),(3,1),(2,1)$ so $6\cdot 8=48$ so in total there are $48+12+21=81$ solutions.

This is not an answer but a comment or a hint (so please don't down-vote it).

Consider this figure: • Is the only way to count the points that are inside the circle ? which makes the answer 81 but isn't there a formula of some sort ? – user3289743 Jul 17 '17 at 23:49
• Think about the area of the disk. – David G. Stork Jul 17 '17 at 23:53
• wouldn't that give me only an approximation ? is the approximation good enough ? – user3289743 Jul 18 '17 at 0:15
• @user3289743 Why would you think there is an exact formula? Doesn't the fact that they chose a very small number like $25$ suggest that some brute force is reasonable? That being said, there are certainly many ways to efficiently perform the counting: for instance, aside from the four "poles" at $(0,\pm 5)$ and $(\pm 5,0)$ the only points in the square $[-4,4] \times [-4,4]$ that don't fit in the circle are the four corners $(\pm 4, \pm 4)$. That gives $81$ with almost no counting effort. – Erick Wong Jul 18 '17 at 9:44

$\newcommand{\bbx}{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}{\mathcal{#1}} \newcommand{\mrm}{\mathrm{#1}} \newcommand{\pars}{\left(\,{#1}\,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}{\left\vert\,{#1}\,\right\vert}$

How many points $\ds{\pars{x, y}}$ with integer coordinates satisfy the inequality $\ds{x^{2} + y^{2} \leq 25}$ ?.

• The number of points $\ds{\pars{x, y}}$ with integer coordinates that satisfy $\ds{x^{2} + y^{2} = n}$ for a given integer $\ds{n \geq 0}$ is given by $$\mc{N}_{n} \equiv \sum_{x = -\infty}^{\infty} \sum_{y = -\infty}^{\infty}\bracks{q^{n}}q^{x^{2} + y^{2}} = \bracks{q^{n}} \pars{\sum_{x = -\infty}^{\infty}q^{x^{2}}}^{2} = \bracks{q^{n}} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2}$$
• Therefore, the answer $\ds{\mc{N}_{\leq\ 25}}$ of the question at the top is given by $$\mc{N}_{\leq\ 25} \equiv \sum_{n = 0}^{25}\mc{N}_{n} = \sum_{n = 0}^{25}\bracks{q^{n}} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2}$$
Then, \begin{align} \mc{N}_{\leq\ 25} & = \bracks{q^{0}}\sum_{n = 0}^{25}\pars{1 \over q}^{n} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2} = \bracks{q^{0}}{\pars{1/q}^{26} - 1 \over 1/q - 1} \pars{1 + 2\sum_{x = 0}^{\infty}q^{x^{2}}}^{2} \\[5mm] & = \bracks{q^{25}}{1 - q^{26} \over 1 - q} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2} = \bracks{q^{25}}\sum_{k = 0}^{25}q^{k} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2} \\[5mm] & = \sum_{k = 0}^{25}\bracks{q^{25 - k}} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2} = \sum_{k = 0}^{25}\bracks{q^{k}} \pars{1 + 2\sum_{x = 1}^{\infty}q^{x^{2}}}^{2} \\[5mm] & = \sum_{k = 0}^{25}\bracks{q^{k}} \pars{1 + 2q + 2q^{4} + 2q^{9} + 2q^{16} + 2q^{25}}^{2} = \bbx{81} \end{align}