Number of all Solutions to Linear Equations Combinatorics

500 Views Asked by At

How would I go about solving this question. How many solutions are there to:

$$x_1 + x_2 + x_3+...+ x_7 =18$$

in the case where $x_i \in \left\{2,3 \right\}, i =1,2,3,4,5,6,7$.

I understand this is a bars and stars problem. However I have only done ones where the total is equal to highest number of the set and that just uses combination by repetition. Any guidance on where to go would be greatly appreciated.

2

There are 2 best solutions below

3
On

Hint:

Since every $x_i$ must be either a $2$ or a $3$, we can figure out exactly how many $2$'s are needed and exactly how many $3$'s are needed. The only missing information then is which of the $x_i$ are specifically the twos and which are the threes.


You could do this by stars-and-bars modified with a change of variables and inclusion-exclusion, however this seems incredibly overkill and tedious. You could also choose to do this by generating functions (which will highlight the same property you are being led to above if you remember your binomial theorem).

More detail on generating function approach:

As the first value is either $2$ or $3$, we begin building the generating function with the piece $(x^2+x^3)$. Similarly as the second follows the same, we multiply this again by $(x^2+x^3)$. Continuing in this fashion, we get the generating function $(x^2+x^3)^7$. If we factor out a common factor of $x^2$, this leaves us with $x^{14}(1+x)^7$. The question is then "What is the coefficient of $x^{18}$ in the expansion of $x^{14}(1+x)^7$?" which can be recognized via the binomial theorem.

0
On

Note that it suffices to count only the number of solutions where $x_1 \leq x_2 \leq \ldots \leq x_7$.

Then the solutions to $x_1 +x_2 + \ldots + x_7=18$ will just be the permutations corresponding to each solution found in the previous line.

Since $2 \cdot 4+ 3 \times 3=17 < 18$ , we must have at least $4$ threes.

Also, $2 \cdot 2+ 3 \times 5=19 > 18$ , so we must have at most $4$ threes.

It follows that we exactly $4$ threes and thus exactly $3$ twos (i.e. $x_1=x_2=x_3=2$ and $x_4=x_5=x_6=x_7=3$).

Now, to generate a permutation, we may choose any of the $4$ variables to take the value three and the other variables are automatically fixed to take the value two.

Note that this can be done in $\binom{7}{4}$ ways.