1

As titled, I need to find number of solutions to the equation $a+b+c=0$, where $a,b,c$ are integers in the range $[-k,k]$.($k$ is a positive integer) and $a$ doesn't equal to $0$.

My attempt: let $$x=a+k, y=b+k, z=c+k$$ we need to find non-negative solutions to the equation $$x+y+z=3k$$ with $$0\leq x,y,z\leq 2k.$$ Using the formula, there are $\left(\frac{3k+3-1}{3-1}\right)$=$\left(\frac{3k+2}{2}\right)$ solutions.

We then erase the cases where one of them is $>2k$ (only one of them can be $>2k$).

Let $$x'= x-(2k+1)$$ then x' is non-negative, number of solutions to the equation: $$x'+y+z=k-1$$ is:

$$\left(\frac{k+3-1}{3-1}\right)$$

But this gives a total of $3k^2-2$ solutions if we calculate $\left(\frac{3k+2}{2}\right)$-$3 \cdot \left(\frac{k+2}{2}\right)$,which is not the desired answer. And I haven't delete the case where $a=0$

What did I do wrong? Any help will be appreciated.

vitamin d
  • 5,783
Alex
  • 65
  • 4

1 Answers1

2

Your first binomial coefficient, $\binom{3k+2}2$, is correct, but your second, counting the solutions in non-negative integers to $x_1'+x_2+x_3=k-1$, is not: it should be

$$\binom{(k-1)+3-1}{3-1}=\binom{k+1}2\,,$$

giving you a total of

$$\begin{align*} \binom{3k+2}2-3\binom{k+1}2&=\frac12\big((3k+2)(3k+1)-3k(k+1)\big)\\ &=3k^2+3k+1 \end{align*}$$

solutions in non-negative integers to $x+y+z=3k$. Now you just have to subtract the solutions for which $x=k$, i.e., the solutions in non-negative integers to $y+z=2k$. I’ll leave that to you: these are straightforward to count.

Brian M. Scott
  • 616,228