1

I used the following technique for calculating the number of integral solutions of the following equation $$\sum_{i=1}^n x_i=m,\ 0\le x_i\le k,\ k,m \in \mathbb{Z}_+ $$

The method is the following:

The number of solutions is given by the coefficient of $x^m$ in the expansion of $(1+x+x^2+\cdots+x^k)^n$ which is the coefficient of $x^m$ in the expansion of $(1-x^{k+1})^{n}(1-x)^{-n}$ and thus is given by $$\sum_{l=0}^{\lfloor m/(k+1)\rfloor}(-1)^l\binom{n}{l}\binom{n+m-(k+1)l-1}{n-1}$$

But when I tried to solve an exercise problem using this method it did not work out, though I could not find a problem in this method. I came up with this method (though I do not know if it is already there in the literature) drawing analogy to the method we use to solve similar equations with unrestricted solutions, only with positivity condition. I checked that this method also correctly gives the required no. of solutions in that case which is the well known expression $\binom{n+m-1}{n-1}$.

So it would be very kind if someone can check if the method is correct. Thanks in advance.

  • Assuming order matters - $x_1 = 2, x_2 = 3$ counts as different from $x_1 = 3, x_2 = 2$ - and I haven't made a calculation error (didn't take out the paper), it is correct. Can you post the exercise where it didn't work out? Maybe that demanded distinct $x_i$, or the order didn't matter there, such constraints would of course change the number. – Daniel Fischer Sep 17 '15 at 12:54
  • @DanielFischer It is this exercise at Brilliant.org. The solution they have posted is elegant, but I thought my method would also work. It will be very nice if you can once try this using this method. Should I give the details in the question about how I approached solving the problem? – Samrat Mukhopadhyay Sep 17 '15 at 14:29
  • You can't directly apply your thing to that problem, you need some adaptions. I would first guess that you made some mistake in the adaptions. – Daniel Fischer Sep 17 '15 at 14:49
  • Yes, @DanielFischer, I think I found where I made the mistake and it seems to be in the adaptation part, still I am telling you the approach to be sure. – Samrat Mukhopadhyay Sep 17 '15 at 15:16
  • I let $a_i$ be the digits so that, as per the demand of the question, the necessary equation to solve becomes $$\sum_{i=1}^6 a_i=3k$$ and then defined integers $b_i=(a_i-1)/2$ so that they belong to the set ${0,1,2,3,4}$ and the overall equation reduces to $$\sum_{i=1}^6 b_i=m:=\frac{3k-6}{2}$$ – Samrat Mukhopadhyay Sep 17 '15 at 15:19
  • From there I deduced that $m\in {0,3,6,9,12,15,18,21,24}$ and found the number of solutions for the above equation for each case. – Samrat Mukhopadhyay Sep 17 '15 at 15:20
  • Now the error I think I made, (a serious one!) is that I took the summation on all $6$ variables restricting my solution set for $n$ in the set of $6$ digit numbers only! I should have varied the summation range to $5,4,3,2,1$ to get the correct answer right? But all that seems to produce an extremely tedious exercise, which already asks for abandonment of this approach, I guess. – Samrat Mukhopadhyay Sep 17 '15 at 15:24
  • Right, you only counted the six-digit numbers. Counting the numbers with fewer digits in that way is less work than the six-digit numbers, so it wouldn't be prohibitively tedious, but you can probably do it with less work. – Daniel Fischer Sep 17 '15 at 15:46
  • Yes, thanks @DanielFischer for going through all this. – Samrat Mukhopadhyay Sep 17 '15 at 15:47
  • See also http://math.stackexchange.com/questions/1429561 – user84413 Sep 17 '15 at 16:02
  • Great! Thanks @user84413 for the reference. – Samrat Mukhopadhyay Sep 17 '15 at 16:07
  • You're welcome - I'm glad that was helpful. – user84413 Sep 17 '15 at 16:46

0 Answers0