[Math] Combination problem with constraints

binomial-coefficientscombinatoricsgenerating-functionsgroup-theorypermutations

You have four containers and one pitcher of water that holds 100L. Each container has different capacities with maximums of, say…70L, 45L, 33L and 11L levels respectively.

What is the formula that can be used to solve the number of all possible combinations that a total (in this case, 100L of water) can be poured among a number of containers (70L, 45L, 33L 11L), each having a different maximum level?

I have looked into the binomial coefficient, $\displaystyle \frac {n!}{r!(n-r)!}$, but this would solve for the number of combinations if the containers have the same maximums, not varying maximums.

Generating functions can solve for combinations with constraints, but what about a formula that could be plugged in straight away so that you can find just the answer to the single coefficient and total that you are looking for; not all the possible coefficients and all the possible totals for those sets. I am having trouble understanding how this can be achieved using generating functions or any other method.

Can you draw a formula to solve the number of combinations by knowing the following: the number of sets and their maximums, and the total number that can be divided among them?

Here is another example: ${[0-5] + [0-15] + [0-24] + [0-35] + [0-51]}$. The total must be 60.

Best Answer

So you're asking for an easy way to find the number of solutions in non-negative integers to $a+b+c+d=100$, $a\le70$, $b\le45$, $c\le33$, $d\le11$. Let's do it the hard way and then see what the answer tells us. What we want is the coefficient of $x^{100}$ in $$(1+x+\cdots+x^{70})(1+x+\cdots+x^{45})(1+x+\cdots+x^{33})(1+x+\cdots+x^{11})$$ which is $$(x^{71}-1)(x^{46}-1)(x^{34}-1)(x^{12}-1)(1-x)^{-4}$$ which is $$(1-x^{12}-x^{34}+x^{58}-x^{71}+x^{80}+x^{83}-x^{92}+\dots)(1+4x+10x^2+20x^3+\dots)$$ where the coefficients in the second bracket are the binomial coefficients $n$-choose-3. So the answer is going to be a sum/difference of 8 of these binomial coefficients. I can't think of any reason to expect there to be a simpler form for the answer, nor a simpler way to get to the answer. Can you?

Related Question