1. ## Combinations with constraint

Dear all,

I have a problem of combinatorial/permutation in the context of computer networks. To easy of explanation, suppose that you have vector with n=3 elements, say [1,3,4].
The summation of the n elements yields a total T = 8.

Now consider these constraints:
a) Each element in the vector may vary from 0 to 4.
b) The summation of the n elements MUST be equal to the total T = 8.

The question is, how many combination do we can do with that vector, considering the constraints?

Valid results include:

1, 3, 4
1, 4, 3
3, 1, 4
3, 4, 1
4, 1, 3
4, 3, 1
2, 2, 4
2, 3, 3
0, 4, 4

2. There are just four selections of three having the sum eight.
$\displaystyle [0,4,4],~[2,2,4]~ ,~[2,3,3]~\&~[1,3,4]$
The first three can be arranged is three ways, while the last has six rearrangements.

Or we can expand the expression $\displaystyle \left( {\sum\limits_{k = 0}^4 {x^k } } \right)^3$, the coefficient of $\displaystyle x^8$ is 15 that is the same answer.

3. Thank you for your reply. However, I still didn't get it!

In the real problem, I'll have vectors of up to 5k elements.

How did you get the number of selections having the sum eight?

Thanks.