4

There are n chairs in a row. In how many ways can a teacher sit k students on these chairs so that no 2 students sit next to each other (and obviously no 2 students sit on 1 chair)?

I was thinking about inclusion-exclusion, that each student will sit next to each other, however it isn't good enough since there could be more chairs than students. Basically currently I have no idea how to solve it.

stiifii
  • 103

4 Answers4

6

Line up $n-k$ of the chairs in a row; these will be the ones that remain empty.

Now choose $k$ of the gaps created by the empty chairs in which to seat the students;

since there are $n-k+1$ gaps, this gives $\dbinom{n-k+1}{k}$ possibilities.


EDIT: As pointed out in the comments, the final answer should be $\dbinom{n-k+1}{k}\cdot k!$,

since there are $k!$ ways to arrange the $k$ students in their seats.

user84413
  • 27,747
  • Sorry for gravedigging but I would like to say that we will have to multiply that answer you have to k! so that they could be arranged in different orders. Just to make it clear to readers..! – Mr Pro Pop May 25 '18 at 00:54
  • @MrProPop Thanks for catching this mistake, and I will try to correct it. – user84413 Jul 07 '18 at 20:36
5

Hint: Label the seats $1, 2, \ldots n$. If the $k$ students occupy the seats $a_1, a_2, \ldots, a_k$ (in increasing order), let $b_1=a_1-1$, $b_2=a_2-2$, ... , $b_k=a_k-k$. Then $$0 \leqslant b_1 < b_2 < \dotsb < b_k \leqslant n-k,$$ so $B = \{b_1 \ldots, b_k\}$ is a $k$-element subset of an $(n-k+1)$-set. Conversely, from any such subset you can obtain a seating configuration.

Now the question becomes: How many such sets $B$ are there?

Catalin Zara
  • 6,372
1

If it's solvable, then $k\le \lfloor{\frac{n}{2}}\rfloor$ ($\lfloor x\rfloor$ is the floor function in case you didn't know). We get that because each student has to have space around them if you start from the very front and go student space student space ... and continue like this it's like choosing a container of two to put each student in. There are at most $\frac{n}{2}$ of these containers of two. Therefore, via the pigeonhole principle, there can't be more than $\frac{n}{2}$ students. There are two cases that can eventually be combined either the first student is at the very front or one seat back. Now, the representation of multiplying all the positive numbers together up to a number n! . You can also define multifactorials as: $n\underbrace{!...!}_m=\prod_{d=0}^{\lfloor {\frac{n}{m}}\rfloor} n-dm$

This comes in use, because, with m=2 we have n$\cdot(n-2)...$ which means, the first student has n seats to choose from, the second has n-2 ... (not the seat the first student had or the one behind it if they are in the very front). The teacher could also have started the spacing starting with the first student at the second desk in the row leading to $(n-1)\cdot (n-3)...$ . To spread out the students like this, has taken up $2\cdot k-1$ seats from either representation so in the first case we have $\frac{n!!}{(n-2\cdot k)!!}$ , and the second case $\frac{(n-1)!!}{(n-2\cdot k-1)!!}$ and depending on ordering of things mattering you can divide by $k!\cdot (n-k)!$ for the arrangements of the students and the empty chairs ( as if ordering doesn't matter all the students are the same and all the empty chairs are the same when put in the same places).

at least that's the best explanation I can give.

  • This answer is not correct. If $n = 10, k = 3$ then there are only $\binom{10}{3} = 120$ ways to seat the 3 students without restriction. But $10!!/4!! = 480$ and $9!!/3!! = 315$ which are both too big. You can't divide either of these by $3!7!$ because you don't get an integer. The correct answer should be $\binom{n - k + 1}{k}$. – Sera Gunn Jun 29 '17 at 14:51
  • 10!/(10-3)! = 1098 =908 =720 dividing by 3! is if we don't care about order ( it talks of number of ways, is order affecting the number of ways ?). also 10!!/4!!= (1086)= 480 and 97*5= 315 I agree but there product does divide by 7! and 3! is partly how I was thinking. I guess I wasn't sure enough to give a solid answer because order could affect it. –  Jun 29 '17 at 16:25
  • Taking the product doesn't make sense and even if you did that you would get the answer $5$, which is too small because I could start off by filling the first four chairs: 1010 (0 = empty, 1 = student) and then there are 6 more spots to put the third student. See the other answers. Mine is a bit technical but the other two should be easy enough to understand. – Sera Gunn Jun 29 '17 at 16:33
  • okay I guess I should delete it then –  Jun 29 '17 at 17:05
  • Don't feel bad. Counting correctly isn't easy. That's what prompted this question. – Sera Gunn Jun 29 '17 at 17:19
  • my thought was something like this: $$\underbrace{S,D,\ldots}\text{n desks with k being students starting at the $1^{st}$ desk}$$ and $$\underbrace{D,S,\ldots}\text{n desks with k being students starting at the $2^{nd}$ desk}$$ could help I guess. –  Jun 29 '17 at 17:28
1

Consider strings over the alphabet $\{0,1\}$ where $0$ denotes a chair and $1$ denotes a student. The strings that do not contain $11$ are captured by the regular expression $0^* (10^+)^* \{\varepsilon, 1\}$. If we give $0$ a weight of $x$ and $1$ a weight of $xy$ then we are looking for the coefficient of $[x^ny^k]$.

Using these weights, the generating function for $0^* (10^+)^* \{\varepsilon, 1\}$ is

$$ \frac{1}{1 - x} \cdot \frac{1}{1 - \frac{x^2y}{1 - x}} \cdot (1 + xy) = \frac{1 + xy}{1 - x - x^2y}. $$

Hence the answer is $$ [x^ny^k]\frac{1 + xy}{1 - x - x^2y} = [x^ny^k]\frac{1}{1 - x - x^2y} + [x^{n - 1}y^{k-1}]\frac{1}{1 - x - x^2y} $$ where \begin{align} [x^ny^k]\frac{1}{1 - x - x^2y} &= [x^ny^k] \sum_m (x + x^2y)^m \\ &= [x^ny^k] \sum_m \sum_r \binom{m}{r} x^{m-r}x^{2r}y^r \\ &= [x^ny^k] \sum_m \sum_r \binom{m}{r} x^{m + r}y^r \\ &= \binom{n - k}{k}. \end{align} Therefore $$ [x^ny^k]\frac{1 + xy}{1 - x - x^2y} = \binom{n - k}{k} + \binom{(n - 1) - (k - 1)}{k - 1} = \binom{n - k + 1}{k}. $$

Sera Gunn
  • 27,981