I'm "walking" through the book "A walk through combinatorics" and stumbled on an example I don't understand.
Example 3.19. A medical student has to work in a hospital for five days in January. However, he is not allowed to work two consecutive days in the hospital. In how many different ways can he choose the five days he will work in the hospital?
Solution. The difficulty here is to make sure that we do not choose two consecutive days. This can be assured by the following trick. Let $a_1, a_2, a_3, a_4, a_5$ be the dates of the five days of January that the student will spend in the hospital, in increasing order. Note that the requirement that there are no two consecutive numbers among the $a_i$, and $1 \le a_i \le 31$ for all $i$ is equivalent to the requirement that $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$. In other words, there is an obvious bijection between the set of 5-element subsets of [31] containing no two consecutive elements and the set of 5-element subsets of [27].
*** Instead of choosing the numbers $a_i$, we can choose the numbers $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$, that is, we can simply choose a five-element subset of [27], and we know that there are $\binom{27}{5}$ ways to do that.
What I don't understand here $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$:
- Why do the subtracting numbers increment with every other $a_i$?
- Why 27?
And the very last sentence (***) is unclear to me.
- Why is there no talk about "non-consecutive"? Why choosing 5 elements of 27 is equivalent to choosing 5 non-consecutive elements out of 31? I miss the connection.
I'd be very thankful if you could help me to understand this example!
The prohibition on consecutive days means the constraints are really $$1 \le a_1$$ $$a_1+1 \lt a_2$$ $$a_2+1 \lt a_3$$ $$a_3+1 \lt a_4$$ $$a_4+1 \lt a_5$$ $$a_5 \le 31.$$ Rewrite these so that the right hand side of each line is the same as the left hand side of the next line as $$1 \le a_1$$ $$a_1 \lt a_2-1$$ $$a_2-1 \lt a_3-2$$ $$a_3-2 \lt a_4-3$$ $$a_4-3 \lt a_5-4$$ $$a_5 -4 \le 27$$ and you can now combine these as a single line $$1 \le a_1 < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$$
Added for extended question:
Having done that, you could let $b_1=a_1$, $b_2=a_2-1$, $b_3=a_3-2$, $b_4=a_4-3$, and $b_5=a_5-4$, so $$1 \le b_1 < b_2 < b_3 < b_4 < b_5 \le 27$$ and so the number of integer solutions for the $b_i$ is obviously the same as the number of ways of choosing $5$ distinct integers from $27$, i.e. ${27 \choose 5}$.
Having chosen the $b_i$ in order from smallest to largest, you can get back to the $a_i$ (the working days) by adding $0$ to the smallest, $1$ to the next, $2$ to the middle one, $3$ to the next, and $4$ to the largest. It is obvious that this will give five dates with at least ones day's gap between them.