How to find the number of solutions to $x_1+x_2+x_3+x_4+y_1+y_2=6$ if $0\le x_i \le 2$ and $y_i$ is divisible by $3$?

91 Views Asked by At

How to find the number of solutions to $x_1+x_2+x_3+x_4+y_1+y_2=6$ if for $0\le i\le 4$ $0\le x_i \le 2$ and $y_1, y_2$ is divisible by $3$ without using generating functions? $x_i, y_k$ are non-negative integers.

I'm having trouble with manual counting of solutions. I tried using inclusion/exclusion principle: for $0\le i\le 4$ let $A_i$ be the solutions set when $x_i\ge 3$. There are $4$ such sets like $A_i$. Then we have two sets $B_1, B_2$ when $y_{1,2}$ is not divided by $3$, hence $y_{1,2}$ can be $1,2,4,5$. Therefore $|B_{1,2}|=4, |A_i|={6-2-1+6-3\choose 6-3}$ (because we have only $6-2$ bins for $x_i$ and in each bin there can be at most $6-3$ numbers.

Then we can find all intersections of two sets from $A_i$ and $B_j$. There are ${4\choose 2}$ intersections of $A_i\cap A_j$ and $|A_i\cap A_j|={6-2-1+6-3-3\choose 6-3-3}$, there's one intersection $|B_1\cap B_2|=4\cdot 4$ and there're ${4\choose 1}{2\choose 1}$ intersections of $|A_i\cap B_k|={6-2-1+3\choose 3}\cdot 4$.

There's a total of $U={6-1+6\choose 6}$ solutions to the equation.

Then to find the solutions under the given constraints the answer would be: $$ U-\biggl(\sum_{i=0}^4 A_i\biggr)-B_1-B_2+{4\choose 2}A_i\cap A_j+B_1\cap B_2+{4\choose 1}{2\choose 1}A_i\cap B_k=1036 $$ which I'm pretty sure is not the correct answer. I did try to solve this using generating functions in order to check if my solutions is correct and I got $54$ which I find to be much more reasonable.


EDIT: I decided to add the calculation using generating functions as a reference for searching the correct answer.

The generating function for this problem is: $$ f(x)=(1+x+x^2)^4(1+x^3+x^6+\dots)^2 $$ The closed form is: $$ \bigg(\frac{1-x^3}{1-x}\bigg)^4\cdot \bigg(\frac{1}{1-x^3}\bigg)^2=\frac{(1-x^3)^2}{(1-x)^4} $$ and to find the coefficient of $x^6$: $$ \sum_{k=0}^2{2\choose k} (-1)^kx^{3k}\cdot \sum_{i=0}^{\infty}{4-1+i\choose i}x^i $$ Finally the coefficient is: $$ {2\choose 0}{4-1+6\choose 6}-{2\choose 1}{4-1+3\choose 3}+{2\choose 2}{4-1+0\choose 0}=45 $$

2

There are 2 best solutions below

4
On BEST ANSWER

Case by case (definitely somewhat error prone):

The $y_i's$ can be $0,3,6$.

Case I: one of them is $6$. Then all the others are $0$. $\boxed 2$

Case II: Two of them are $3$. Then all the others are $0$. $\boxed 1$.

Case III: one of them is $3$. Two places to put that $3$. the $x_i$ must then sum to $3$.

IIIa: No $2's$. Then we have three $1's$ and a $0$. $\underline 4$.

IIIb: One $2$. Then we have four places to put the $2$ and three to put the $1$ so $\underline {12}$.

In total $$2\times (4+12)=\boxed {32}$$

Case IV: No $3's$. Then the $x_i$ must sum to $6$. To do that we need at least two $2's$.

IVa: two $2's$ and two $1's$. Then $\binom 42=\underline 6$

IVb: Three $2's$ and one $0$. $\underline 4$

In total $$6+4=\boxed {10}$$

Combining we get $$2+1+32+10=\boxed {45}$$

Note: In a comment I had said I got to $56$ but that was a blunder. I did warn that this method is somewhat error prone.

0
On

Let's organize the count according to the number of odd numbers in the sum. For the $x$'s, the only odd option is $1$; the the $y$'s, it's $3$.

Since $6$ is even, there must be an even number of odd numbers in the sum. You clearly can't have all six numbers be odd, since then the sum would be $10$, not $6$. It's also easy to see that the only way four of the numbers can be odd is if three of them are $1$'s and one is $3$, which requires the fourth $x$ and the other $y$ to be $0$. So the number of ways to have a sum of $6$ with four odd numbers is

$$4\cdot2=8$$

If there are exactly two odd numbers in the sum, either both are $3$'s, in which case the $x$'s are all $0$, or one is a $3$ and $1$ is a one, in which case the other $y$ is a $0$ and exactly one of the $x$'s is a $2$, or both are $x$'s, in which case both $y$'s are $0$'s and both of the other $x$'s are $2$'s. So the number of ways to have a sum of $6$ with two odd numbers is

$$1+2\cdot4\cdot3+6=31$$

Finally, if none of the numbers is odd, then either one $y$ is a $6$ and everything else is $0$ or both $y$'s are $0$'s and three $x$'s are $2$'s with the fourth $x$ a $0$. So the number of ways to have a sum of $6$ with no odd numbers is

$$2+4=6$$

The total number of ways to have a sum of $6$ is thus $$0+8+31+6=45$$