3

Question:
Compute how many different integer solutions the following inequality has: $$ x_1 + x_2 + x_3 + x_4 < 50 $$
when we require that $-1 \leq x_1, -2 \leq x_2 \leq 2, -3 < x_3, -4 < x_4 < 4.$

My approach:
So I will start by making the inequality to equality. $$ x_1 + x_2 + x_3 + x_4 < 50 $$ $$ x_0 + x_1 + x_2 + x_3 + x_4 = 49 $$ $$x_0 \geq 0 $$ Then I would change $x_i$ for $y_i$:
$$y_1 - 1 = x_1$$ $$y_2 - 2 = x_2$$ $$y_3 - 2 = x_3$$ $$y_4 - 3 = x_4$$ So that would be: $$y_0 + y_1 - 1 + y_2 - 2 + y_3 - 2 + y_4 - 3 = 49 $$ $$y_0 + y_1 + y_2 + y_3 + y_4 = 57 $$ Since I have bounds on $x_2$ and $x_4$, I need to make condition for them: $$-2 \leq x_2 \leq 2$$ $$0 \leq x_2 \leq 4$$ $$x_2 \geq 5$$ $$and$$ $$-4 < x_4 < 4$$ $$0 < x_4 < 8$$ $$x_4 > 8$$ And finally to count it: $$\binom{57+5-1}{5-1}...$$
But I don't know how to get the final number (including those conditions). Is it possible to do it with inclusion–exclusion principle ?
Any help on what to do would be appreciated.

  • 1
    Not an equation, it is an inequality. Equations are equalities. – Thomas Andrews Feb 04 '24 at 21:15
  • "So I will start by making the inequality to equality. x1+x2+x3+x4<50 x0+x1+x2+x3+x4=49" Just because $SUM < 50$ doesn't mean $SUM =49$. We could have $SUM =48$ or $SUM= 47$ or $SUM = -579357849367493$ or .... – fleablood Feb 04 '24 at 21:18
  • Go through the exact same rigmarole, only this time, assume that $~x_4 \geq 4.~$ Count the number of solutions, and deduct this amount from your original computation. – user2661923 Feb 04 '24 at 21:27
  • I think you want to be expressing some of those inequality constraints on your $y_i$ variables .... – JimN Feb 04 '24 at 21:30
  • 2
    @fleablood He introduced another variable $x_0$ to represent the slack to 49, so $x_0$ is a non-negative integer variable and having the equation = 49 is an acceptable approach. – JimN Feb 04 '24 at 21:34
  • 1
    @JimN Agreed on the $x_0$, including the non-negative thing. The OP needs to either change $x_0\ge0$ or change the right side of the equation to 50. – Mike Feb 04 '24 at 21:49
  • You're correct - I didn't catch that he bound $x_0$ by 1 for whatever reason. Should be corrected to $x_0 >= 0$ – JimN Feb 04 '24 at 21:51
  • This may be related: https://math.stackexchange.com/questions/2679580/restricted-partition-of-integer-strictly-k-distinct-parts-from-a-set – NoChance Feb 04 '24 at 22:11

2 Answers2

4

You're on the right track.

Hint We're aiming to solve the inequality $$\phantom{(\ast)} \qquad y_1 + y_2 + y_3 + y_4 \leq N,$$ or just as well the equality $$\phantom{(\ast)} \qquad y_0 + y_1 + y_2 + y_3 + y_4 = N , \qquad (\ast)$$ in nonnegative integers.

As you suggest, we can use the Inclusion-Exclusion Principle: Let $S$ denote the set of solutions $(y_0, \ldots, y_4)$ of $(\ast)$, $S_2 \subset S$ the set of solutions satisfying $y_2 \geq a$, and $S_4 \subset S$ the set of solutions satisfying $y_4 \geq b$, so that our aim is to compute $|S| - |S_2 \cup S_4| = |S| - |S_2| - |S_4| + |S_2 \cap S_4|$.

The number of solutions of $(\ast)$ is $$|S| = {{N + 4} \choose 4}$$ (see this question for a derivation and OEIS 000332 for the sequence).

We now consider the number of solutions of $(\ast)$ in $S_2$, that is, that satisfy $y_2 \geq a$ (in particular not imposing the condition on $y_4$). If we set $\color{#ff0000}{z_2} := y_2 - a$, then we are just as well looking for the number of solutions in nonnegative integers to $$y_0 + y_1 + \color{#ff0000}{z_2} + y_3 + y_4 = N - a ,$$ which we know from the computation of $|S|$ is $$|S_2| = {{N - a + 4} \choose 4} .$$

By symmetry of notation, $$|S_4| = {{N - b + 4} \choose 4} .$$ For essentially the same reason, $$|S_2 \cap S_4| = {{N - (a + b) + 4} \choose 4} .$$ In the end, we find that the number of solutions to $(\ast)$ in nonnegative integers subject to our constraints on $y_2$, $y_4$ are $$|S| - |S_2 \cup S_4| = {N + 4 \choose 4} - {{N - a + 4} \choose 4} - {{N - b + 4} \choose 4} + {{N - (a + b) + 4} \choose 4} .$$ In our particular case, $N = 57$, $a = 5, b = 7$, giving $${61 \choose 4} - {56 \choose 4} - {54 \choose 4} + {49 \choose 4} = \boxed{50\,190} ,$$ which agrees the value produced by the script in Marco's answer.

Travis Willse
  • 99,363
0

You can simply brute force it.

For the bounds on $x_2,x_3,x_4$ we have to have $x_1<57$.

For the bounds on $x_1,x_2,x_4$ we have to have $x_3<56$

Now that all the numbers are on a finite interval of integers I have written a little Python script that check all the possible sums. The final result should be $$ 50190 $$

Marco
  • 2,357
  • 4
    Downvoting because it's a code answer for a mathematics problem on a mathematics forum that can be solved with only elementary combinatorics. Also, some never-nesters are having a fit looking at this code – acat3 Feb 05 '24 at 01:38
  • @RezhaAdrianTanuharja Fair point. But one can argue that, when the numbers are so little brute force is a viable strategy. I don't know if the OP needs this result for some reason or if it is interested in the combinatoric aspect of the problem, but the really specific bounds let me lean to the former – Marco Feb 05 '24 at 02:47