0

Number of integer solutions to the equation $x_1+x_2+x_3+x_4=30$ with ranges $x_1\geq 0, 4\leq x_2\leq 7, 2\leq x_3\leq 6, x_4\geq 0$

I tried the method by @N. F. Taussig: Number of integer solutions to the equation $x_1 + x_2 + x_3 = 28$ with ranges

My attempt:

The question reduces to $x_1'+x_2'+x_3'+x_4'=24$ where $x_1'=x_1\geq 0$, $0\leq x_2'=x_2-4\leq 3$, $0\leq x_3'=x_3-2\leq 4$, $x_4'=x_4\geq 0$

Let $3-x_2'=y_2$, $4-x_3'=y_3$ given $x_1'-y_2-y_3+x_4'=17$, $x_i',y_i\geq 0$.

How to proceed further.

Edited my question

user1942348
  • 4,256
  • See this answer for a blueprint of how to combine Inclusion-Exclusion with Stars-And-Bars to attack this generic type of problem. – user2661923 Oct 21 '24 at 11:51
  • 1
    A key difference between this problem and the one to which you linked is that in the linked problem all of the variables have upper bounds. Therefore, I was able to avoid using the Inclusion-Exclusion Principle by introducing the $z$ variables. In this case, only two of the four variables are bounded, so applying the Inclusion-Exclusion Principle (or using generating functions together with the negative binomial theorem, which amounts to doing the same thing with fancier machinery) becomes necessary. – N. F. Taussig Oct 21 '24 at 23:03

4 Answers4

2

I think the most versatile way would be to use a generating-function approach. Your answer is $$[x^{30}](1+x+x^2+…)^2(x^4+x^5+x^6+x^7)(x^2+x^3+x^4+x^5+x^6)\\=[x^{24}]\frac{(1+x+x^2+x^3)(1+x+x^2+x^3+x^4)}{(1-x)^2},$$

where $[x^k]$ means the coefficient of $x^k$. I would then procede to use a software to find the coefficient. E.g., in Sage, you would write

f(x)=(1+x+x^2+x^3)*(1+x+x^2+x^3+x^4)/(1-x)^2
g(x)=f.taylor(x,0,24)
g.coefficient(x^24)

You can try Sage here.

  • You can also write the geometric sums with formula and get $\frac{(1-x^4)(1-x^5)}{(1-x)^4}$. And use binomial theorem for negative power. – ploosu2 Oct 21 '24 at 14:19
  • Yes I guess in principle this can be done entirely by hand. –  Oct 21 '24 at 14:24
2

You may consider proceeding directly from

$x_1'+x_2'+x_3'+x_4'=24$ over non -negative integers s.t. $x_2'\leq 3, x_4' \leq 4$ and just apply the familiar stars and bars with PIE to get

$$\small{\binom{27}3 - \binom{23}3 -\binom{22}3 + \binom{18}3 = 430}$$

1

Here's another method. Introduce $x_2 = 2+a$ and $x_3=4+b$ to shift to start from $0$ and iterate over all allowed $a,b$. The number of solutions when $a$ and $b$ are given values is equal to the number of solutions of $x_1+x_4 = 24-a-b$, which is given by the usual stars and bars. We get

$$ \sum_{a=0}^3 \sum_{b=0}^4 \binom{24-a-b+2-1}{1} = 25 \cdot 4 \cdot 5 - 5\cdot \frac{3 \cdot 4}{2} - 4\cdot \frac{4 \cdot 5}{2} = 430 $$

Summing was easy because we we're left with just two variables. If there were more, we'd get higher power sums and need to use those formulas (and foiling the binomial coefficient would also be kind of messy).

ploosu2
  • 12,367
0

No solutions possible.

The largest the sum $x_2 + x_3$ is 13. Adding $x_1$, as required cannot obtain 30.

It is worse for smaller sums of $x_2 + x_3$.


Once the problem has been edited/fixed:

Mathematica:

Solve[x1 + x2 + x3 + x4 == 30 
      \[And] (x1 > -1) 
      \[And] (4 <= x2 <= 7) 
      \[And] (2 <= x3 <= 6) 
      \[And] (x4 >= 0), {x1, x2, x3, x4}, Integers] // Length

430

  • 1
    ? I thought that $x_1$ could be any positive number, so $x_1=17$ should surely yield a solution, don't you think? (I admit that writing $\le$ for $x_2$ and $x_3$ and $\ge$ for $x_1$ is confusing indeed. – Dominique Oct 21 '24 at 11:34
  • @DavidG.Stork Edited. $x_1 \geq 0$. Solution is possible: $x_1=23, x_2=3,x_3=3, x_4=1$ – user1942348 Oct 21 '24 at 11:35
  • $x_2=4, \space x_3=6$ and $x_1+x_4=20$ give many solutions. – Ataulfo Oct 21 '24 at 13:05