How many ways are there to pick r objects from n objects when repetitions are allowed and ...

581 Views Asked by At

How many ways are there to pick r objects from n objects when repetitions are allowed and either both the first and the second objects appear exactly once or both do not appear?

So here is what I tried and I'm not sure if it's correct.

If we have n bins and each bin is an object, and we choose each object once we will have r-n, but since the first and second object appear once or not at all we have r-(n-2)+-2, at least I think. So using

$n+k-1 \choose k$

I think I can get

$n+(r-(n-2)\pm2)-1 \choose k$

Is this correct? I dont think it is, but I'm not sure how else to go about this.

1

There are 1 best solutions below

4
On BEST ANSWER

We can simply separate the $2$ cases:

1 and 2 element don't appear

This means that we must choose $r$ elements with repetition, from $n-2$ elements:

$${{n-2+r-1}\choose{r-1}}={{n+r-3}\choose{r-1}}$$

1 and 2 element appear one time

This time we have to select $r-2$ elements with repetition, from $n-2$ elements:

$${{n-2+r-2-1}\choose{r-2-1}}={{n+r-5}\choose{r-3}}$$

Since the two cases are disjoint, the result is the sum of them:

$${{n+r-5}\choose{r-3}}+{{n+r-3}\choose{r-1}}$$