2

Similar questions have been asked before and from there I have learn that the number of solutions to the equation $$\sum_i a_i\cdot x_i = n \ \ \ \ \ x_i \in Z_{\geq 0}$$

is the coefficient of $y^n$ in $$\prod_i \frac{1}{1-y^{a_i}}$$

We can then expand the partial term of the product knowing $\frac{1}{1-y} = 1 + y + y^2\dots$.

However I have not found any way to calculate efficiently by hand the coefficient of $y^n$ for this product would contain several such sequences multiplied with each other, usually with different indices of $y$, making it tough to compute. Asymptotic expansions like Schur’s theorem aren’t precise enough for me.

For example, consider the following problem I was asked in a test:

number of non negative solutions to $4x + 3y + 3w + z = 30$

Is there a general approach to find the number of solutions in such problems? The coefficients are rather “simple” for the type of equations I’m dealing with.

Sahaj
  • 2,516
  • I think you cannot have more than this answer and links there. Also, your question is a duplicate of another question of yours. – Fabius Wiesner Dec 06 '23 at 16:40
  • My question focuses on efficient approaches by hand, ideally which could be used in something like an exam; that link does not answer it. As far as the other question is concerned, it was more general than this and ill framed. I shall delete that question. – Sahaj Dec 06 '23 at 17:37
  • Regarding the example, it can be solved summing for $0\le n \le 10$ the product of the number of solutions of $4x+z=3n$ and $y+w=10-n$ i.e. $\sum_{n=0}^{10} (\lfloor 3n/4 \rfloor + 1)(11-n)$ which can be fairly easily evaluated by hand to $207$. – Fabius Wiesner Dec 06 '23 at 22:01
  • Can you elaborate how you obtained that summation ? – Sahaj Dec 07 '23 at 00:37
  • $4x+z$ must be divisible by $3$ and range from $0$ to $30$. The rest of the equation is $3y+3w=30-3n$. Divide it by $3$. $(x,z)$ and $(y,w)$ are independent, so we can multiply. Once you have chosen $x$, $z$ is determined by it. $x$ can be chosen from $0$ to $\lfloor 3n/4 \rfloor$. A similar reasoning can be applied to $y,w$. – Fabius Wiesner Dec 07 '23 at 07:31
  • Thanks, that does help a lot for this particular problem. – Sahaj Dec 07 '23 at 07:45

1 Answers1

2

Here is a method which works, by hand, for small values of $n$. Let me illustrate, via an example.

How many solutions are there to the equation $2x+3y+6z=10$?

My method involves filling out a table with dimensions $11\times 3$. In general, to count solutions to $a_1x_1+\dots+a_kx_k=n$, the table will have size $(n+1)\times k$. Specifically, for each $n\ge 0$, define the following numbers:

  • $a_n$ is the number of nonnegative integer solutions to $2x=n$.

  • $b_n$ is the number of nonnegative integer solutions to $2x+3y=n$.

  • $c_n$ is the number of nonnegative integer solutions to $2x+3y+6z=n$.

We only care about $c_{10}$, but we will use $a_n$, $b_n$, and $c_1,\dots,c_9$ as intermediate calculations to make the overall calculation of $c_{10}$ easier.

Let us start with the simplest term, $a_n$. It should be clear that $$ a_n=\begin{cases}1 & \text{$n$ is even} \\ 0 & \text{$n$ is odd}\end{cases}\tag1 $$ The first column of our table will be the values of $a_n$, which we can fill in immediately using the above rule. The next row of the table is $b_n$. It turns out that $b_n$ satisfied this recurrence. For all $n\ge 3$: $$ b_n=a_n+b_{n-3}\tag2 $$ If $n<3$, then $b_n=a_n$.

Why? There are two types of solution to the equation $2x+3y=n$; ones where $y=0$, and ones where $y>0$. The solutions where $y=0$ correspond exactly to solutions of $2x\color{gray}{+3\cdot 0}=n$, which is counted by $a_n$. If $y>0$, then letting $y'=y-1$, you have that $2x+3y'=n-3$, where $y'$ is nonnegative, so solutions like this are counted by $b_{n-3}$.

Using $(2)$, you can fill out the second column of the table. Finally, using the following similar recurrence, you can deduce $c_n$ for $n \in \{0,1,\dots,10\}$, and use that to fill out the final column, and therefore answer your question.

$$\begin{align} n\ge 6\quad &\implies\quad c_n=b_n+c_{n-6}\\ n<6\quad &\implies \quad c_n=b_n. \end{align}\tag3$$ Here is the fully filled out table:

$n$ $a_n$ $b_n$ $c_n$
0 1 1 1
1 0 0 0
2 1 1 1
3 0 1 0
4 1 1 1
5 0 1 0
6 1 2 3
7 0 1 1
8 1 2 3
9 0 3 3
10 1 2 3

We conclude that $c_{10}=3$. Indeed, the only solutions are $(x,y,z)=(5,0,0),(2,2,0)$ and $(2,0,1)$.

Mike Earnest
  • 75,930