0

I have been working on the following problem:

How many integer solutions are there to the equation:

$$x_1+x_2+x_3+x_4=11$$

where each $x_i$ satisfies the constraint $0 ≤ x_i ≤ 3$ for each $i$.

I found the answer to be number of solutions = $4$, since the only way to get a result $= 11$ would be by adding $3+3+3+2$, meaning there must be three $3$s and one $2$ added together in any order.

However, I am curious to know of a better way of approaching such a problem.

I know that the stars and bars method can be used to count the number of non-negative integer solutions without constraints, but I'm unsure how to apply inclusion-exclusion to account for the upper limit of $3$ on each $x_i$​. Could someone walk me through the steps to apply inclusion-exclusion to this problem and calculate the number of valid solutions?

RobPratt
  • 50,938

1 Answers1

3

You can use stars and bars for this problem, avoiding inclusion-exclusion by a slight twist.

First fill all the bins with the maximum permissible $3$, giving a total of $12$

Now instead of putting balls into bins, apply stars and bars taking out balls from bins, to get

$x_1 + x_2 + x_3 + x_4 = 1,\;\; x_i \geq 0$ to get

$$\binom{1+4-1}{4-1} = \binom43 = 4$$

This twist can profitably be used in many (but not all) such problems to either eliminate inclusion-exclusion altogether, or reduce it to a shorter version.

RobPratt
  • 50,938