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 ;)
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.
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 is the number of arrangements that have at least k couples sitting side by side." So, for example, N 1 = 1 0 ! 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.
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 does equal 1 0 ! , 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 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 e 1 intuitively obvious? Or is it just a coincidence that it ends up behaving like a derangement?
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. ;)
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. :)
I would phrase it like this: Let 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 = ( 1 0 − k ) ! 2 k since we are permuting 1 0 − 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 ( k 5 ) c k = 1 2 6 3 3 6 0
The quantity you are working with, N k = ( k 5 ) 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... ;)
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. :)
Let S m , n be the number of ways to seat m individuals and n couples (that is m + 2 n people).
If m or n is negative, S m , n = 0 . S 0 , 0 = 1 . (More over, S m , 0 = m ! , but we won't need that.)
Let's find a recurrence relationship for S m , n .
So, we have:
S m , n = 2 n ⋅ ( S m + 1 , n − 1 − S m , n − 1 ) + m ⋅ S m − 1 , n
The answer is then S 0 , 5 = 1 ′ 2 6 3 ′ 3 6 0 , which you get by computing all S m , n where m + n ≤ 5 .
1 2 3 4 5 6 |
|
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 !
Then for any number of couples x sitting next to each other ( x from 1 to 5) we have the number of arrangements with x couples sitting next to each other is
t g t ( x ) = ( x 5 ) ∗ [ 2 x ∗ ( 1 0 − x ) ! − i = x + 1 ∑ 5 t g t ( i ) ∗ ( x i ) ÷ ( x 5 ) ]
The idea is to choose x couples from the 5, and stick them together. Then the number of ways to order the 10 people are 2 x ∗ ( 1 0 − x ) ! , however we must discount scenarios where there are actually more than x couples sitting together.
For any specific choice of x couples, only a portion of t g t ( i ) arrangements include those x couples, and that is precisely ( x i ) ÷ ( x 5 ) .
Now just choose your favorite programming language to solve for t g t ( 0 )
1 2 3 4 5 6 7 |
|
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 be the number of couples going to the cinema, and n = 2 M the number of persons. They have n ! possibilities to choose seats, but that includes all permutations where one (or more) couples sit next to each other: x i n ! = number of permutations with exactly i couples sitting next to each other = x 0 + … + x M
Our goal is x 0 , the number of permutations without any couple sitting next to each other.
Perhaps it's easier to calculate x 1 instead, the number of permutations where exactly one couple sits next to each other. We have 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 ) ! permutations of the remaining "persons". In total, we get: ( 1 M ) ⋅ 2 ⋅ ( 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 couples we count precisely i times: 2 ( 1 M ) ( n − 1 ) ! = x 1 + 2 x 2 + … + M x M = i = 1 ∑ M ( 1 i ) x i
However, we can generalize the approach. If we try to calculate x k , we choose k of M couples and have 2 k ways to order the significant others. Again, we treat these couples as single entities, to get ( n − k ) ! permutations of the remaining "persons". Similarly to before, we count all permutations with exactly i couples precisely ( k i ) times: 0 ≤ k ≤ M : 2 k ( k M ) ( n − k ) ! = x k + ( k k + 1 ) x k + 1 + … + ( k M ) x M = i = k ∑ M ( k i ) x i
On to the linear algebra part. We have M + 1 equations and M + 1 variables - let's put them together into one system: A : = ( ( k i ) ) k , i b : = ( 2 k ( k M ) ( n − k ) ! ) k x : = ( x i ) i ⇒ A x = b
Luckily, A has a simple general inverse and we get x 0 , the number of permutations without any couple sitting next to each other: A − 1 = ( ( − 1 ) k + i ( k i ) ) k , i ⇒ x 0 = i = 0 ∑ M ( − 1 ) i ( 0 i ) ⋅ 2 i ( i M ) ( n − i ) ! = i = 0 ∑ 5 ( − 2 ) i ( i 5 ) ( 1 0 − i ) ! = 1 2 6 3 3 6 0
Rem.: The approach via inverse has an added benefit - we get any x k we want: x k = ( − 1 ) k i = k ∑ M ( − 2 ) i ( k i ) ( i M ) ( n − i ) !
is the number of permutations with exactly k of M couples sitting next to each other!
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! ;^) )
Problem Loading...
Note Loading...
Set Loading...
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 1 0 ! . 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 couples sitting side by side n times for 1 ≤ n ≤ 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 couples sitting side by side ( 2 n ) times for 2 ≤ n ≤ 5 .
In general, if we were to count the number of arrangements that have at least k couples sitting side by side for 1 ≤ k ≤ 5 , we end up counting the number of arrangements with precisely n couples sitting side by side ( k n ) times for k ≤ n ≤ 5 .
Now let α k represent the number of arrangements that have at least k specific couples sitting side by side. Now in general α k = 2 k ( 1 0 − k ) ! , since we can order each of these k couples in two ways, and then arrange these k couples and 1 0 − 2 k remaining individuals in ( k + ( 1 0 − 2 k ) ) ! = ( 1 0 − 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 ( k 5 ) α k = k = 0 ∑ 5 ( − 2 ) k ( k 5 ) ( 1 0 − k ) ! = 1 2 6 3 3 6 0 .
As a general result, with 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 ( k M ) ( 2 M − k ) ! .
It would appear that lim M → ∞ M ! P M = e 1 , just as in a derangement, but I don't have a proof for this yet.