Tricky seating arrangements

Five couples like to go to the movies together; they always sit in a row of ten adjacent seats. To shake things up a bit, they have a rule that nobody is allowed to sit next to their partner. How many seating arrangements are there for this party?

I thought of this problem while watching a bad (Hollywood) movie on a bad date ;)


The answer is 1263360.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

It's probably easiest to count the complement first, i.e., the number of arrangements where at least one couple sits together, and then subtract this from the total number of arrangements, namely 10 ! . 10!. To do this we will need to do some inclusion/exclusion counting.

If we were to count the number of arrangements that have at least one couple side by side, we would end up over-counting those arrangements where more than one couple sits side by side. In fact, we end up counting those arrangements that have precisely n n couples sitting side by side n n times for 1 n 5. 1 \le n \le 5.

If we were to count the number of arrangements that have at least two couples sitting side by side, we would end up counting the number of arrangements with precisely n n couples sitting side by side ( n 2 ) \binom{n}{2} times for 2 n 5. 2 \le n \le 5.

In general, if we were to count the number of arrangements that have at least k k couples sitting side by side for 1 k 5 , 1 \le k \le 5, we end up counting the number of arrangements with precisely n n couples sitting side by side ( n k ) \binom{n}{k} times for k n 5. k \le n \le 5.

Now let α k \alpha_{k} represent the number of arrangements that have at least k k specific couples sitting side by side. Now in general α k = 2 k ( 10 k ) ! , \alpha_{k} = 2^{k}(10 - k)!, since we can order each of these k k couples in two ways, and then arrange these k k couples and 10 2 k 10 - 2k remaining individuals in ( k + ( 10 2 k ) ) ! = ( 10 k ) ! (k + (10 - 2k))! = (10 - k)! ways.

Then, by the applicable inclusion-exclusion formula , (refer to the first special case), we see that the desired solution is

k = 0 5 ( 1 ) k ( 5 k ) α k = k = 0 5 ( 2 ) k ( 5 k ) ( 10 k ) ! = 1263360 . \displaystyle\sum_{k=0}^{5} (-1)^{k}\dbinom{5}{k}\alpha_{k} = \sum_{k=0}^{5} (-2)^{k}\dbinom{5}{k}(10 - k)! = \boxed{1263360}.

As a general result, with M M couples, the number of arrangements in which none of the couples sit side by side is given by

P M = k = 0 M ( 2 ) k ( M k ) ( 2 M k ) ! . P_{M} = \displaystyle\sum_{k=0}^{M} (-2)^{k} \dbinom{M}{k}(2M - k)!.

It would appear that lim M P M M ! = 1 e , \lim_{M \rightarrow \infty} \dfrac{P_{M}}{M!} = \dfrac{1}{e}, just as in a derangement, but I don't have a proof for this yet.

Wonderfully explained! Thank you, Brian! That's how I thought of the problem as I wrote it, in terms of inclusion/exclusion.

There is perhaps one issue that you need to clarify. It is a bit misleading to say that " N k "N_k is the number of arrangements that have at least k couples sitting side by side." So, for example, N 1 = 10 ! N_1=10! is the number of arrangements that have at least one couple sitting together... but that's the total number of arrangements. You need to rephrase this a bit.

Otto Bretscher - 6 years, 1 month ago

Log in to reply

Thanks! This was a fun question, so I thought it was worth the time to explain my method thoroughly. Yes, now that you mention it, N 1 N_{1} does equal 10 ! , 10!, but of course this is an "over-count". So while I believe that the calculation is still correct, I need to think of how to rephrase what N k N_{k} represents so that it is not misleading. I'll get to that shortly, (need food first). :)

P.S.. Is my last observation about the limit being 1 e \dfrac{1}{e} intuitively obvious? Or is it just a coincidence that it ends up behaving like a derangement?

Brian Charlesworth - 6 years, 1 month ago

Log in to reply

I must confess that, unlike algebra and calculus, I don't have a good "feel" for combinatorics... I have never taken a class on the subject, and I have never used it in my work. So, please, don't expect me to answer tricky follow-up questions. ;)

Otto Bretscher - 6 years, 1 month ago

Log in to reply

@Otto Bretscher Haha. Every time I think I have a "feel" for combinatorics a question invariably comes along and trips me up completely, so I quite understand your reticence to answer "tricky" follow-up questions. :)

Brian Charlesworth - 6 years, 1 month ago

I would phrase it like this: Let c k c_k be the number of ways k SPECIFIC couples can sit together (maybe "the first k" if they are ordered somehow). As you explained, c k = ( 10 k ) ! 2 k c_k=(10-k)!2^k since we are permuting 10 k 10-k parties (k couples and 10-2k individuals) and the partners in each couple can sit on either side. Now, by the standard formula for inclusion/exclusion, the quantity we seek is k = 0 5 ( 1 ) k ( 5 k ) c k = 1263360 \sum_{k=0}^5(-1)^k\dbinom{5}{k}c_k=1263360

The quantity you are working with, N k = ( 5 k ) c k N_k=\dbinom{5}{k}c_k , while useful in the formula, is hard to define in terms of the seating arrangements.

But don't get me wrong: this is just a detail. Overall, I really enjoy your careful and detailed solution. I just don't have the patience to explain things like that, and perhaps not the skill either (with English being my third language). While we both are probably about ten levels below these giants, your writing style reminds me of Euler, while mine is closer to Gauss... ;)

Otto Bretscher - 6 years, 1 month ago

Log in to reply

@Otto Bretscher Thanks for the suggestion. I ended up going with your suggestion, since then I could link to an explanation of the inclusion-exclusion principle and have it make more sense. My initial version reflected my actual thought process, but it was proving difficult to clarify the definitions for the terms I was using so I went with a more standard, but slightly less intuitive, explanation. And if only I could have a fraction of Euler's brilliance, even for a day ... sigh. :)

Brian Charlesworth - 6 years, 1 month ago
Laurent Shorts
Oct 4, 2016

Let S m , n S_{m,n} be the number of ways to seat m m individuals and n n couples (that is m + 2 n m+2n people).

If m m or n n is negative, S m , n = 0 S_{m,n}=0 . S 0 , 0 = 1 S_{0,0}=1 . (More over, S m , 0 = m ! S_{m,0}=m! , but we won't need that.)

Let's find a recurrence relationship for S m , n S_{m,n} .

  • If at first you seat someone in couple, you have 2 n 2n ways to choose that person, and then you have S m + 1 , n 1 S_{m+1,n-1} ways to seat the others, of which you have to remove S m , n 1 S_{m,n-1} ways where you just seated the significant other of the first person right after. That makes 2 n ( S m + 1 , n 1 S m , n 1 ) 2n·(S_{m+1,n-1}-S_{m,n-1}) .
  • If at first you seat someone not in couple, you have m m ways to choose that person, and then you have S m 1 , n S_{m-1,n} ways to seat the others, which are all valid ways. That makes m S m 1 , n m·S_{m-1,n} .

So, we have:

S m , n = 2 n ( S m + 1 , n 1 S m , n 1 ) + m S m 1 , n \boxed{S_{m,n}\,\,=\,\,2n\,·\,(S_{m+1,n-1}\,-\,S_{m,n-1})\,\,+\,\,m\,·\,S_{m-1,n}}

The answer is then S 0 , 5 = 1 26 3 360 S_{0,5}=1'263'360 , which you get by computing all S m , n S_{m,n} where m + n 5 m+n≤5 .

1
2
3
4
5
6
def S(n,m):
  if n<0 or m<0: return 0
  if n==0 and m==0: return 1
  return 2*n * (S(n-1,m+1) - S(n-1,m))  +  m * S(n,m-1)

print S(0,5)

Yuriy Kazakov
May 1, 2017
Stern Huang
May 11, 2015

Coded this problem to help me solve it.

Count the number of arrangements with all five couples sitting together. This is just ( 5 5 ) 2 5 5 ! \binom{5}{5}*2^5*5!

Then for any number of couples x x sitting next to each other ( x x from 1 to 5) we have the number of arrangements with x x couples sitting next to each other is

t g t ( x ) = ( 5 x ) [ 2 x ( 10 x ) ! i = x + 1 5 t g t ( i ) ( i x ) ÷ ( 5 x ) ] \displaystyle tgt(x)=\binom{5}{x}*\left[2^x*(10-x)!-\sum_{i=x+1}^5 tgt(i)*\binom{i}{x}\div \binom{5}{x}\right]

The idea is to choose x x couples from the 5, and stick them together. Then the number of ways to order the 10 people are 2 x ( 10 x ) ! 2^x*(10-x)! , however we must discount scenarios where there are actually more than x x couples sitting together.

For any specific choice of x x couples, only a portion of t g t ( i ) tgt(i) arrangements include those x x couples, and that is precisely ( i x ) ÷ ( 5 x ) \binom{i}{x}\div\binom{5}{x} .

Now just choose your favorite programming language to solve for t g t ( 0 ) tgt(0)

1
2
3
4
5
6
7
def tgt(x):
  sub=0
  for i in range(x+1,6):
    sub+=tgt(i)*choose(i,x)/choose(5,x)
  return choose(5,x)*((2**x)*fact(10-x)-sub)

print tgt(0)

Carsten Meyer
Apr 27, 2020

This was hard, but fun - third try, no less. My approach is similar to Brian Charlesworth's, but I use linear algebra in the end.

For simplicity, let M = 5 M=5 be the number of couples going to the cinema, and n = 2 M n=2M the number of persons. They have n ! n! possibilities to choose seats, but that includes all permutations where one (or more) couples sit next to each other: x i = number of permutations with exactly i couples sitting next to each other n ! = x 0 + + x M \begin{aligned} x_i&=\text{number of permutations with exactly }i\text{ couples sitting next to each other}\\ n!&=x_0+\ldots+x_M \end{aligned}

Our goal is x 0 x_0 , the number of permutations without any couple sitting next to each other.


Perhaps it's easier to calculate x 1 x_1 instead, the number of permutations where exactly one couple sits next to each other. We have M M ways to choose one of the couples and 2 ways to order it. Now imagine that we treat the couple as a single entity, to get ( n 1 ) ! (n-1)! permutations of the remaining "persons". In total, we get: ( M 1 ) 2 ( n 1 ) ! \binom{M}{1}\cdot 2\cdot (n-1)!

There is just a slight problem: With the last step, we also counted all permutations with two or more couples! Even worse, we counted them multiple times - each permutation with exactly i i couples we count precisely i i times: 2 ( M 1 ) ( n 1 ) ! = x 1 + 2 x 2 + + M x M = i = 1 M ( i 1 ) x i 2\binom{M}{1}(n-1)!=x_1+2x_2+\ldots+Mx_M=\sum_{i=1}^M\binom{i}{1}x_i

However, we can generalize the approach. If we try to calculate x k x_k , we choose k k of M M couples and have 2 k 2^k ways to order the significant others. Again, we treat these couples as single entities, to get ( n k ) ! (n-k)! permutations of the remaining "persons". Similarly to before, we count all permutations with exactly i i couples precisely ( i k ) \binom{i}{k} times: 0 k M : 2 k ( M k ) ( n k ) ! = x k + ( k + 1 k ) x k + 1 + + ( M k ) x M = i = k M ( i k ) x i \begin{aligned} 0&\leq k \leq M:&&&2^k\binom{M}{k}(n-k)!&=x_k+\binom{k+1}{k}x_{k+1}+\ldots+\binom{M}{k}x_M=\sum_{i=k}^M\binom{i}{k}x_i \end{aligned}


On to the linear algebra part. We have M + 1 M+1 equations and M + 1 M+1 variables - let's put them together into one system: A : = ( ( i k ) ) k , i b : = ( 2 k ( M k ) ( n k ) ! ) k x : = ( x i ) i A x = b \begin{aligned} A&:=\left(\binom{i}{k}\right)_{k,i}&&&\vec{b}&:=\left(2^k\binom{M}{k}(n-k)!\right)_k&&&\vec{x}&:=(x_i)_i&&&\Rightarrow &&&& A\vec{x}&=\vec{b} \end{aligned}

Luckily, A A has a simple general inverse and we get x 0 x_0 , the number of permutations without any couple sitting next to each other: A 1 = ( ( 1 ) k + i ( i k ) ) k , i x 0 = i = 0 M ( 1 ) i ( i 0 ) 2 i ( M i ) ( n i ) ! = i = 0 5 ( 2 ) i ( 5 i ) ( 10 i ) ! = 1263360 \begin{aligned} A^{-1}&=\left( (-1)^{k+i}\binom{i}{k} \right)_{k,i}&&&\Rightarrow&&&&x_0&=\sum_{i=0}^M(-1)^i\cancel{\binom{i}{0}}\cdot 2^i\binom{M}{i}(n-i)!=\sum_{i=0}^5(-2)^i\binom{5}{i}(10-i)!=\boxed{1263360} \end{aligned}


Rem.: The approach via inverse has an added benefit - we get any x k x_k we want: x k = ( 1 ) k i = k M ( 2 ) i ( i k ) ( M i ) ( n i ) ! x_k=(-1)^k\sum_{i=k}^M(-2)^{i}\binom{i}{k}\binom{M}{i}(n-i)!

is the number of permutations with exactly k k of M M couples sitting next to each other!

Geoff Pilling
Jul 7, 2016

My solution:

========================================================

permute AABBCCDDEE > combos

grep -v AA combos | grep -v BB | grep -v CC | grep -v DD |grep -v EE > combos.no_spouses

wc combos.no_spouses

1263360 1263360 13896960 combos.no_spouses

========================================================

(I couldn't think of an elegant mathematical way to solve it to I resorted to brute force and compute power! ;^) )

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...