How to count number of integer solutions of this inequality $(x - 1)^2 + (y - 2)^2 + (z - 3)^2\leqslant 81$?

69 Views Asked by At

I have inequality $$(x - 1)^2 + (y - 2)^2 + (z - 3)^2 \leqslant 81$$ and want to count all number of integer solutions. I tried $$(x - 1)^2 \leqslant 81 \Leftrightarrow -8\leqslant x\leqslant 10,$$ $$(y - 2)^2 \leqslant 81 \Leftrightarrow -7\leqslant y\leqslant 11,$$ $$(z - 3)^2 \leqslant 81 \Leftrightarrow -6\leqslant y\leqslant 12.$$ Therefore, there are $19 \cdot 19 \cdot 19 = 6859 $. This result is not correct. The correct answer is 3071.

I found 102 triples $(a,b,c)$ so that $a^2 + b^2 + c^2 = 81 $ are: $(-9, 0, 0)$, $(-8, -4, -1)$, $(-8, -4, 1)$, $(-8, -1, -4)$, $(-8, -1, 4)$, $(-8, 1, -4)$, $(-8, 1, 4)$, $(-8, 4, -1)$, $(-8, 4, 1)$, $(-7, -4, -4)$, $(-7, -4, 4)$, $(-7, 4, -4)$, $(-7, 4, 4)$, $(-6, -6, -3)$, $(-6, -6, 3)$, $(-6, -3, -6)$, $(-6, -3, 6)$, $(-6, 3, -6)$, $(-6, 3, 6)$, $(-6, 6, -3)$, $(-6, 6, 3)$, $(-4, -8, -1)$, $(-4, -8, 1)$, $(-4, -7, -4)$, $(-4, -7, 4)$, $(-4, -4, -7)$, $(-4, -4, 7)$, $(-4, -1, -8)$, $(-4, -1, 8)$, $(-4, 1, -8)$, $(-4, 1, 8)$, $(-4, 4, -7)$, $(-4, 4, 7)$, $(-4, 7, -4)$, $(-4, 7, 4)$, $(-4, 8, -1)$, $(-4, 8, 1)$, $(-3, -6, -6)$, $(-3, -6, 6)$, $(-3, 6, -6)$, $(-3, 6, 6)$, $(-1, -8, -4)$, $(-1, -8, 4)$, $(-1, -4, -8)$, $(-1, -4, 8)$, $(-1, 4, -8)$, $(-1, 4, 8)$, $(-1, 8, -4)$, $(-1, 8, 4)$, $(0, -9, 0)$, $(0, 0, -9)$, $(0, 0, 9)$, $(0, 9, 0)$, $(1, -8, -4)$, $(1, -8, 4)$, $(1, -4, -8)$, $(1, -4, 8)$, $(1, 4, -8)$, $(1, 4, 8)$, $(1, 8, -4)$, $(1, 8, 4)$, $(3, -6, -6)$, $(3, -6, 6)$, $(3, 6, -6)$, $(3, 6, 6)$, $(4, -8, -1)$, $(4, -8, 1)$, $(4, -7, -4)$, $(4, -7, 4)$, $(4, -4, -7)$, $(4, -4, 7)$, $(4, -1, -8)$, $(4, -1, 8)$, $(4, 1, -8)$, $(4, 1, 8)$, $(4, 4, -7)$, $(4, 4, 7)$, $(4, 7, -4)$, $(4, 7, 4)$, $(4,8, -1)$, $(4, 8, 1)$, $(6, -6, -3)$, $(6, -6, 3)$, $(6, -3, -6)$, $(6, -3, 6)$, $(6, 3, -6)$, $(6, 3, 6)$, $(6, 6, -3)$, $(6, 6, 3)$, $(7, -4, -4)$, $(7, -4, 4)$, $(7, 4, -4)$, $(7, 4, 4)$, $(8, -4, -1)$, $(8, -4, 1)$, $(8, -1, -4)$, $(8, -1, 4)$, $(8, 1, -4)$, $(8, 1, 4)$, $(8, 4, -1)$, $(8, 4, 1)$, $(9, 0, 0)$.

How to count number of integer solutions of that inequality?

1

There are 1 best solutions below

0
On BEST ANSWER

You over-count because e.g. $x=10$, $y=11$, $z=12$ makes the left hand side $243$.

First, note that all $u,v,w$ with $|u|,|v|,|w|\le 5$ lead to $u^2+v^2+w^2\le 75\le 81$. This gives us $11^3=1331$ solutions so far.

  • If the largest square is $9^2$, the others must be $0^2$. That's $6$ solutions as we can pick sign and position for $9^2$.
  • If the largest square is $8^2$, we need to count the solutions for $u^2+v^2\le17$. If $\max\{u^2,v^2\}=4^2$, the other square can be $0^2$ or $1^2$ ($3\cdot 2\cdot 2 $ choices). If $\max\{u^2,v^2\}=3^2$, the other square can be $0^2$ or $1^2$ or $2^2$ ($5\cdot 2\cdot 2$ choices). or both squares are $\le 2^2$ ($5\cdot 5$ choices). That's $57$, times $6$ for signing and positioning the $8^2$, so $342$ solutions.
  • If the largest square is $7^2$, we need to count the solutions for $u^2+v^2\le32$. As above, the max can be $5^2$, the other $0^2,1^2,2^2$, so $5\cdot 2\cdot 2$ choices. Or both are $\le 4^2$, so $9\cdot 9$ choices. In total $606$ solutions.
  • If the largest square is $6^2$, we need to count the solutions for $u^2+v^2\le45$. If $\max\{u^2,v^2\}=6^2$, the other can be $0^2,1^2,2^2,3^2$. This leads to $7\cdot 3\cdot 2\cdot 2=84$ solutoins. If the max is $5^2$, the other can be up to $4^2$, leading to $216$ solutions. or both are $\le 4^2$, leading to another $9\cdot 9\cdot 6= 486$ solutions

In summary, $$ 1331+6+342+606+84+216+486=3071$$