In how many ways you can select $k$ elements from the set $N=\{1,2,3\dotsc n\}$ if $1$ and $2$ can't be selected at the same time?

76 Views Asked by At

My solution is the following:

Choose $k$ elements from the set $N - 1$ (the set $N$, without $1$), then do the same for the element $2$ and at the last step subtract the elements which don't contain $1$ and $2$ because I count them $2$ times. So the solution is: $$ 2C(n-1,k) - C(n-2,k)$$

Am I right?

1

There are 1 best solutions below

0
On BEST ANSWER

Yeah this is alright. Also we know there $\binom{n}{k}$ ways to select $k$ integers from $N$ without any restrictions, and $\binom{n-2}{k-2}$ ways to select $k$ integers from $N$ so that both $1$ and $2$ are selected. SO the required number of ways is also same as: $$\binom{n}{k}-\binom{n-2}{k-2}$$