Number of non-negative integral solutions of $2x+3y+z=19$

The question is to find the number of solutions of $2x+3y+z=19$.

There are posts like this with answers arrived by counting the possibilities. But I decided to approach it in a different way.

My Approach:

I learnt a theorem stating that

The number of integral solutions of $$a_1x_1+a_2x_2+a_3x_3...+a_nx_n=r$$ is the coefficient of $x^r$ in $$(1+{x}^{a_1}+{x}^{2\cdot{a_1}}+...+{x}^{\left \lfloor{\frac{r}{a_1}}\right \rfloor\cdot{a_1}})\cdot(1+{x}^{a_2}+{x}^{2\cdot{a_2}}+...+{x}^{\left \lfloor{\frac{r}{a_2}}\right \rfloor\cdot{a_2}})...(1+{x}^{a_n}+{x}^{2\cdot{a_n}}+...+{x}^{\left \lfloor{\frac{r}{a_n}}\right \rfloor\cdot{a_n}})$$ (I don't know the name of this theorem)

Substituting and reducing the equation, I landed up with finding coefficient of $x^{19}$ in $${\frac{1-x^{20}}{1-x^2}}\cdot{\frac{1-x^{21}}{1-x^3}}\cdot{\frac{1-x^{20}}{1-x}}$$

But, I had no clue of finding that.

My doubts:

• Is there any other relatively elegant way of finding it? (Other than counting or stars and bars - as in here)
• If no, how to solve further to get the answer?

• Your approach is correct, but sometimes the generating function is not a great help in actually finding the answer to the original problem. Sometimes you can use a computer algebra system to do the crank-turning. Commented Jan 25, 2018 at 15:40

You can try directly. We see that $0\leq y\leq 6$

case 1: $y=6$ then we have $2x+z=1$, so $z=1$ and $x=0$;

case 2: $y=5$ then we have $2x+z=4$, so $x=2,z=0$ or $x=1,z=2$ or $x=0, z=4$;

case 3: $y=4$ then we have $2x+z=7$, so $0\leq x\leq 3$ so we have 4 solution

case 4: $y=3$ then we have $2x+z=10$, so $0\leq x\leq 5$ so we have 6 solution

case 5: $y=2$ then we have $2x+z=13$, so $0\leq x\leq 6$ so we have 7 solution

case 6: $y=1$ then we have $2x+z=16$, so $0\leq x\leq 8$ so we have 9 solution

case 7: $y=0$ then we have $2x+z=19$, so $0\leq x\leq 9$ so we have 10 solution

Thus we have total $1+3+4+6+7+9+10 = 40$ solutions.

• It is true. But, is there any purely algebraic way to arrive at that? Commented Jan 25, 2018 at 12:29

Let $a = y + x$ and $b = y+x+z$, then we want to find the number of solutions of $y + a + b = 19$, s.t. $y \le a \le b$. In other words we want to find the number of partitions of $19$ in three terms. We have three cases to consider

Case I: All terms are same

As $3 \not \mid 19$ this case is impossible

Case II: Exactly two terms are same

The number of such possibilities are uniquely determined by the different term, which runs through the odd integers less than $19$. So we have $10$ ways from this case

Case III: All terms are different

This case is the hardest one, but we can invoke a bit of Stars and Bars. Note that in Stars and Bars the combinations from Case I are counted once, from Case II are counted three times and from the last one are counted $6$ times. So the wanted numbers is:

$$\frac 16 \left(\binom{21}{2} - 3\cdot10\right) = 30$$

Hence the number of non-negative solutions of $2x + 3y + z = 19$ is $10 + 30 = 40$

Finally, I figured it out.

From this:

The number of integral solutions of $$a_1x_1+a_2x_2+a_3x_3...+a_nx_n=r$$ is the coefficient of $x^r$ in $$(1+{x}^{a_1}+{x}^{2\cdot{a_1}}+...+{x}^{\left \lfloor{\frac{r}{a_1}}\right \rfloor\cdot{a_1}})\cdot(1+{x}^{a_2}+{x}^{2\cdot{a_2}}+...+{x}^{\left \lfloor{\frac{r}{a_2}}\right \rfloor\cdot{a_2}})...(1+{x}^{a_n}+{x}^{2\cdot{a_n}}+...+{x}^{\left \lfloor{\frac{r}{a_n}}\right \rfloor\cdot{a_n}})$$

We substitute and get to find coefficient of $x^{19}$ in $${\frac{1-x^{20}}{1-x^2}}\cdot{\frac{1-x^{21}}{1-x^3}}\cdot{\frac{1-x^{20}}{1-x}}$$

But, any term other than $1$ cannot give $x^{19}$ on multiplying with$\frac{1}{(1-x^2)(1-x^3)(1-x)}$

So, take the numerator as $1$

Now, we multiply and divide the function by $(1+x^3)(1+x^2+x^4)^2(1+x)$ to get$$\frac{(1+x^3)(1+x^2+x^4)^2(1+x)}{(1-x^6)^3}$$

This results in $$\frac{(1+x^3)(1+x^4+x^8+2x^2+2x^4+2x^6)(1+x)}{(1-x^6)^3}$$

Now, we have the following constraints:

• The maximum power of numerator is $12$
• Powers in expansion of $(1-x^6)^{-3}$ are $1, 6, 12, 18, 24...$
• For multiplication of $(1-x^6)^{-3}$ to numerator to yield $x^{19}$, there must be $x$ raised to $18, 13, 7,$ or $1$
• But, $x$ raised to $18$ and $13$ are not possible

Manipulating the numerator, we get the coefficients of $x$ and $x^7$ to be $1$ and $5$ respectively

Now we represent the expression as $$(x+x^7+P)(1-x^6)^{-3}$$

So, $x^{12}$ and $x^{18}$ terms of $(1-x^6)^{-3}$ are required to get $x^{19}$

So, we express the expression as $$5\cdot{4\choose2}(x^{12})(x^7)-{5\choose3}(x)(x^{18}) + Q$$ $$=40x^{19}+Q$$

So, coefficient of $x^{19}$ is $40$

$\therefore$ No. of non- negative integral solutions of $2x+3y+z=19$ is $40$