# Count number of possible combinations of $\sum_{i=1}^{n} a_i \leq 10$

• If I have $$a_1+a_2 \leq 10$$, with $$a_1, a_2 \in \{0, \, 1, \, 2, \, \cdots, \, 10 \}$$:

To count the number of possible combinations for $$a_1$$ and $$a_2$$ such that $$a_1+a_2 \leq 10\quad\mbox{and}\quad a_1, a_2 \in \{0, \, 1, \, 2, \, \cdots, \,10 \}$$ we need the formula $$\sum_{a_1=0}^{10}\sum_{a_2=0}^{10-a_1}\, 1$$.

Note that I need that the result of each combination to be of the form $$e^{a_1 u + a_2 d}$$ with a fixed $$u>0$$ and $$d<0$$.

• If I have $$\sum_{i=1}^{n} a_i \leq 10$$, with $$n>1$$ and $$a_1, a_2, \, \cdots, a_n \in \{0, \, 1, \, 2, \, \cdots, \, 10 \}$$.

Is there a mathematical method or a reference to modify the aforementioned formula?

Any help will be very appreciated !.

• Can you see why the inner sum is just $10-a_i$? Commented May 15 at 12:32
• Consider stars and bars method: en.wikipedia.org/wiki/Stars_and_bars_(combinatorics) Commented May 15 at 12:34
• @preferred_anon Thank you for your comment. Because I need all the result combinations to be of the form $e^{a_1 u + a_2 d}$ with a fixed $u>0$ and $d<0$. Commented May 15 at 12:41

To explain this in a simpler way let us look at an example problem: $$x+y+z \geqslant 150$$ such that $$0 \leqslant x,y,z \leqslant 60$$.
To solve this question we could firstly notice that the sum $$x+y+z$$ can be $$180$$ at maximum. So let us simply assume that $$x+y+z-p=150$$ ($$p$$ will take values such that this sum is always $$150$$). Now we could write $$x=60-x_1$$, $$y=60-y_1$$ ,$$z=60-z_1$$ (This necessarily doesnt change how $$x$$,$$y$$ and $$z$$ are choosen, it just helps all the varibales get the same sign). Substituting in our original equation we get $$30=x_1+y_1+z_1+p$$. Now this is the same as distributing $$30$$ identical chocolates among $$4$$ kids( with no restriction on how many chocolates an individual child recieves). This is simply just 33C3. But if we had been given a restriction that $$x$$ and $$y$$ must be $$\geqslant 1$$ and $$z \geqslant 0$$. Then we would simply use a previous equation $$30=x_1+y_1+z_1+p$$ and forcefully give $$1$$ chocolate to $$x$$ and $$1$$ chocolate to y (which means $$x=59-x_1$$ as we already gave it a chocolate). So our new equation would be $$28=x_1+y_1+z_1+p$$. This would just equate to 31C3.
In your example question of $$a_1+a_2 \leqslant 10$$, we could simply introduce a new variable p again such that $$a_1+a_2+p=10$$. Now this is the same as distributing $$10$$ identical chocolates to $$3$$ children with no resitions on how many chocolates an individual child recieves. Similarly for the case where you asked $$a_1+a_2+ \dots +a_n \leqslant 10$$, you can just introduce a new variable $$p$$ such that $$a_1+a_2+\dots+a_n+p=10$$ and similarly distribute chocolates among children. Hope this helps you.