0

Assuming we have a set of Democrats that has $8$ people, Republicans that have $10$ people and independent that have $7 $ people. How many combinations are there to pick $14 $ people?

So basically the question is to find the solution to $$ X_{i}+X_{d}+X_{r}=14 $$ $$ \begin{cases} X_{i}\le7\\ X_{d}\le8\\ X_{r}\le10 \end{cases} $$

I think it needs to be solved with inclusion-exclusion but I'm unsure how.

  • This is not clear. Usually, "people" are supposed to be distinct. Are you declaring that two combinations are the same if they have the same numbers of people of each type? And are we choosing $10$ people or $14$? – lulu Aug 03 '22 at 18:58
  • my bad, fixed it, it needs to be 14 people. I'm assuming that people from same party are the same, like balls of same colour, because otherwise we can just do $ \binom{25}{14} $ I guess. – Danny Blozrov Aug 03 '22 at 19:02
  • Then I'd rephrase in terms of balls of varying colors. Or at least let people know what assumptions you are making. – lulu Aug 03 '22 at 19:03
  • As to the question: Stars and Bars basically does it, just ignoring the caps. Then note that you can't trip more than one of the caps so just go case by case to count the cases you must subtract. – lulu Aug 03 '22 at 19:04
  • 1
    The general problem (where you have to worry about tripping multiple caps) is a mess but it can still be done. See this question. – lulu Aug 03 '22 at 19:05
  • Yes I know of the principle, but the restrictions are hard to work with. – Danny Blozrov Aug 03 '22 at 19:10
  • 1
    Not really, just tedious. If you automate it, the computation should be very fast. As I say, the fact that you only need to deal with one cap at a time greatly simplifies things. – lulu Aug 03 '22 at 19:12

3 Answers3

1

All situations - unwanted cases such that $X_i \geq 8$ or $X_d \geq 9$ or $X_r \geq 11$

  • Unwanted cases : $|X_i \geq 8|+|X_d\geq9|+|X_r\geq11| -|X_i\geq8 \cap X_r\geq11|-|X_i\geq8 \cap X_d\geq9|-|X_d\geq9 \cap X_r\geq11|+|X_i\geq8 \cap X_r\geq11 \cap X_d\geq9|$ .Then , $$\binom{6+3-1}{2}+\binom{5+3-1}{2}+\binom{3+3-1}{2}-0-0-0+0 =59$$

  • All cases : $$\binom{14+3-1}{2}=120$$

So , $$120-59 =61$$

0

Using Python I managed to write some code to calculate it(not efficient but it seems to work):

def calcperm(N:int,r1:int,r2:int,r3:int):
"""

:param N: the number of solutions to X1+X2+X3=N :param r1: X1<=R1 :param r2: X2<=R2 :param r3: X3<=R3 :return: number of solutions """ res=0 for i in range(r1+1): for j in range(r2+1): for k in range(r3+1): if(i+j+k==N): res+=1 return res

0

A cursory inspection shows that more than one group can't simultaneously violate the upper constraints, which makes computations quite easy.

Using the combinations with repetitions formula $\Large{\binom{n+k-1}{k-1}}$, we get

Valid combinations excluding violations of constraints

$=\Large{ \binom{16}2 - \binom{16-8}2 - \binom{16-9}2 - \binom{16-11}2 = 61}$