0

If we have $3$ positive integers given as \begin{align*} 0 & \leq a \leq 3\\ 0 & \leq b \leq 3\\ 0 & \leq c \leq 2 \end{align*} and given the sum $$ a+b+c = 5$$

how many ways we can distribute these integers ?

Note: I asked a relatively close question to this but I was unsuccessful at applying that solution. Please do enlighten me.

Is this page a good exploration point ?

N. F. Taussig
  • 79,074
  • You can obtain $\leq$ and $\geq$ by typing, respectively, \leq and \geq when you are in math mode. – N. F. Taussig Feb 14 '16 at 13:40
  • Do you understand how to solve the equation $a + b + c = 5$ in the non-negative integers when there were no restrictions? – N. F. Taussig Feb 14 '16 at 13:41
  • 1
    Thanks Taussig, and I know how to solve without restrictions. I want to know how to rule out over-counts given to this restrictions.(I guess that's how it is done ?) – Rockybilly Feb 14 '16 at 13:45
  • The page you referenced is a good reference for the problem of solving the equation $a + b + c = 5$ in the non-negative integers. Read about weak compositions. – N. F. Taussig Feb 14 '16 at 13:48

3 Answers3

2

A generatingfunctionologist would say that the generating function for the number of solutions in non-negative integers of $$x_1 + x_2 + x_3 = r$$ subject to $x_1 \le 2$, $x_2 \le 3$, $x_3 \le 3$ is $$\begin{align}f(x) &= (1+x+x^2) \cdot (1+x+x^2+x^3)^2\\ &= x^8+3 x^7+6 x^6+9 x^5+10 x^4+9 x^3+6 x^2+3 x+1 \end{align}$$ The answer to the problem is the coefficient of $x^5$ when $f(x)$ is expanded, i.e. $9$.

Reference: Wilf, generatingfunctionology

https://www.math.upenn.edu/~wilf/DownldGF.html

awkward
  • 15,626
  • Thank you, I am giving you +1 because you gave a nice answer for the question asked, however I didn't mention before but I am building a computer program, and this solution requires much memory, moreover the multiplication process with more than 3 integers(like 80-100) is very consuming indeed. – Rockybilly Feb 14 '16 at 15:42
1

A particular solution of the equation $$a + b + c = 5 \tag{1}$$ in the non-negative integers corresponds to the placement of two addition signs in a row of five ones. For instance, $$1 1 1 + 1 1 +$$ corresponds to the solution $a = 3$, $b = 2$, and $c = 0$. Thus, the number of solutions of equation 1 in the non-negative integers is $$\binom{5 + 2}{2} = \binom{7}{2}$$ since we must select which two of the seven symbols (five ones and two addition signs) will be addition signs.

From these, we must exclude those solutions in which $a > 3$, $b > 3$, or $c > 2$. Since $a, b, c$ are integers, this means we must exclude those solutions in which $a \geq 4$, $b \geq 4$, and $c \geq 3$. Since $4 + 3 = 7 > 5$, no two of these restrictions can hold simultaneously.

Suppose $a \geq 4$. Let $a' = a - 4$. Then $a'$ is a non-negative integer. Substituting $a' + 4$ for $a$ in equation 1 yields \begin{align*} a' + 4 + b + c & = 5\\ a' + b + c & = 1 \tag{2} \end{align*} Equation 2 is an equation in the non-negative integers with $$\binom{1 + 2}{2} = \binom{3}{2}$$ solutions.

By similar argument, there are $\binom{3}{2}$ solutions if $b \geq 4$.

Suppose $c \geq 3$. Let $c' = c - 3$. Then $c'$ is a non-negative integer. Substituting $c' + 3$ for $c$ in equation 1 yields \begin{align*} a + b + c' + 3 & = 5\\ a + b + c' & = 2 \tag{3} \end{align*} Equation 3 is an equation in the non-negative integers with $$\binom{2 + 2}{2} = \binom{4}{2}$$ solutions.

Hence, the number of solutions of equation 1 in the non-negative integers subject to the restrictions $a \leq 3$, $b \leq 3$, and $c \leq 2$ is $$\binom{7}{2} - 2\binom{3}{2} - \binom{4}{2}$$

N. F. Taussig
  • 79,074
  • What if this was a problem that, two of the restrictions can hold simultaneously. Because these values was just exemplary, I am actually going to deal with much harder ones. – Rockybilly Feb 14 '16 at 14:27
  • Therefore I am looking for a more general solution. – Rockybilly Feb 14 '16 at 14:40
  • @Rockybilly Would you like me to write an example in which two or more restrictions hold simultaneously? You can handle those situations by using the Inclusion-Exclusion Principle or generating functions. – N. F. Taussig Feb 14 '16 at 15:17
  • Thank you, I was indeed trying to generate a function to find the number of all possibilites, that works for all cases given in this form. The actual problem I am dealing with has like 80 integers, each having their restrictions.(I managed to get all restrictions to start from 0 as minimum point, because I thought it would make the problem easier) – Rockybilly Feb 14 '16 at 15:20
0
  • Given the minimal number $2$, for each value of $c$ and $b$, thee exists immidiatly a value of $a$ satisying the sum. so

$S=3*4$

EDIT: there is cases where no element $a$ exists which follows:

(0,0) and (0,1) considering permutations those are 3 cases so

$S=3*4-3$

Abr001am
  • 766