Number of ways to choose same number of elements from two different sets

150 Views Asked by At

Given two sets of elements $S$ and $R$, with $p$ elements and $q$ elements respectively, what is the number of ways to choose the same number of elements from these two sets? Is there any formula to compute this?

1

There are 1 best solutions below

0
On

Simply sum up the number of ways to choose a given number $r$ of elements from each set for all $r$ less than or equal to the smallest of $p$ and $q$ (for, if $r$ is bigger than $p$, say, we cannot possibly choose $r$ elements from $S$). There are ${p \choose r}$ ways to choose an element from $S$ and ${q \choose r}$ ways to choose an element from $R$, hence there are ${p \choose r}{q \choose r}$ ways to select $r$ elements from each set. Then there are $$\sum_{r=1}^{\min\{p,q\}} {p \choose r}{q \choose r}$$ ways to select the same number of elements from each set if you stipulate that you can't take $r=0$ (i.e. choose zero elements from $S$ and zero elements from $R$), but if you allow $r=0$ then of course you can just start the sum from $r=0$ instead of $r=1$.