2
$\begingroup$

Question : I wanted to find out the number of ways all the 7 numbers below could be assigned positive integers which can sum up to 42.$$x_1+x_2+x_3+x_4+x_5+x_6+x_7=42$$

the catch in this problem is the constraint $$ 1\le x_i\le26$$ The Stars and bars method happen to only provide solution for, if the $x_i$ should be non-negative or only positive.

My Approach : Since i need only positive integers to be used here for $x_i$, so i have to use $${n - 1\choose k-1}.$$ but in using the formulae directly, definitely it would also count the ways where a certain $x_i>26$, so i thought i should use it this way, as $k=7=1+6=2+5=...=6+1$ and $n=42=26+16$, so i can select a few stars from 26 stars as well as 16 stars at the same time : $$({26-1\choose 1-1} + {16-1\choose 6-1}) + ({26-1\choose 2-1} + {26-1\choose 5-1}) + .......+ ({26-1\choose 6-1} + {16-1\choose 1-1})$$ so that highest value $x_i$ can achieve is 26.

My problem : I actually don't know if my way is correct or if any other such method exists to use stars and bars method where also constraints on number of stars are included. Thank you.

$\endgroup$
  • 1
    $\begingroup$ Count the solutions satisfying $1\leq x_i$ and subtract from that the number of solutions for which at least one $x_i\geq 26$. You need to do a bit of inclusion-exclusion. One step: To count the number of solutions in which $x_1\geq26$ apply stars and bars, to $y_1+x_2+...+x_7=42-26$. Here $y_1+26=x_1$. $\endgroup$ – user515219 Dec 21 '17 at 20:44
  • $\begingroup$ Well, correction. While in general you might need to use inclusion-exclusion, in this particular problem it is not going to be necessary. The reason is that it is not possible for two of the variables to be $>26$, because $26 + 26 = 52 > 46$. So, the work is easier. $\endgroup$ – user515219 Dec 21 '17 at 20:46
0
$\begingroup$

Well, it is not difficult to tweak the idea behind the analytic-combinatorics formulation of the stars and bars method. By denoting through $[x^n]\,f(x)$ the coefficient of $x^n$ in the Taylor series at the origin of $f(x)$, stars and bars tells us that the cardinality of the set $$E=\{(x_1,\ldots,x_7)\in\mathbb{N}^*\times\ldots\times\mathbb{N}^+: x_1+\ldots+x_7=42\}$$ equals $\binom{41}{6}$, which is $$[x^{42}]\left(x+x^2+x^3+\ldots\right)^{7} = [x^{42}]\frac{x^7}{(1-x)^7} = [x^{35}]\frac{1}{(1-x)^7}.$$ In a similar way, the cardinality of the set $$F=\{(x_1,\ldots,x_7)\in[1,26]^7: x_1+\ldots+x_7=42\}$$ equals $$[x^{42}](x+x^2+\ldots+x^{25}+x^{26})^7 = [x^{35}]\frac{(1-x^{26})^7}{(1-x)^7}$$ and by applying the binomial theorem to $(1-x^{26})^7$ we get that the RHS is $$ [x^{35}]\frac{1}{(1-x^7)}-7\cdot[x^9]\frac{1}{(1-x)^7}=\color{red}{\binom{41}{6}-7\cdot\binom{15}{6}}.$$ A combinatorial interpretation is simple: if an element belongs to $E$ but not to $F$, at most one of its coordinates is $\geq 27$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.