Choose 'k' numbers from 'n' with no two consecutive.
Proof 1: Using stars and bars
There are 'n' positions(1,2....n) laid down in a line from which we have to pick 'k' positions such that no 2 are adjacent.
Let's say the picked positions are X and unpicked are O.
First we put 'k' Xs followed by 'n-k' Os. (So total positions are 'n').
Now the picked positions can't be adjacent so we put 'k-1' Os between them.
Now we are left with how many Os? n-k-(k-1) = n-2k + 1
These remaining Os can be freely distributed among the 'k+1' buckets.
Why 'k+1' buckets?
Because 'k' Xs have 1 gap on either side and 'k-1' gaps between them. So total k-1+2 = k+1 gaps(buckets).
So we have 'n-2k+1' identical objects(remaining Os) to be put in 'k+1' distinct buckets.
Stars and bars formula for the same for 'n' identical objects and 'k' distinct buckets:
(n+k-1)C(k-1)
Putting the new values here:
( (n-2k+1) + (k+1) - 1)C((k+1) - 1)
=
(n-k+1)C(k) => H.P.
Proof 2:(Compression trick)
Picture the numbers as spots on a line
Write the numbers 1, 2, 3 … n in a row.
Your job is to place k check-marks on some of those spots, but no two check-marks are allowed to sit next to each other (that’s the “no consecutive numbers” rule).
The trick: squeeze the gaps away
-
Label the chosen numbers
Call themBecause you never picked two in a row, each gap between and is at least 1.
-
Shift each choice left by its position in the list
DefineIn words: for the 2nd chosen number slide it left one step, for the 3rd slide it left two steps, and so on.
-
What just happened?
-
Because each gap was at least one, sliding never makes two numbers collide.
-
After sliding, the ’s are still in increasing order but can now sit next to each other—we erased the “no-consecutive” rule!
-
The smallest is still at least 1.
-
The largest can’t go past (we slid left by ).
So the list
is simply any set of k distinct numbers chosen from
-
-
Reverse the shift = perfect one-to-one match
Starting with any numbers inside and sliding them right (add ) recreates a legal gap-filled set in .
Therefore the two tasks are in bijection (perfect pairing).
Count the easy task
Choosing numbers from a list of without any restrictions is the ordinary binomial coefficient
Because of the perfect match above, that is also the number of gap-separated (no-consecutive) choices you wanted.
Quick example
Take .
| legal picks (no two consecutive) | slide left (subtract 0,1,2) | lands in |
|---|---|---|
| ✓ | ||
| ✓ | ||
| ✓ |
All “easy” triples in correspond to 20 legal triples in .
Comments
Post a Comment