组合数学 (Spring 2013)/Sieve methods: Difference between revisions

From TCS Wiki
Jump to navigation Jump to search
imported>Etone
imported>Etone
 
(One intermediate revision by the same user not shown)
Line 73: Line 73:
Therefore, we have a one-to-one correspondence between surjective mappings from an <math>n</math>-set to an <math>m</math>-set and the ordered <math>m</math>-partitions of an <math>n</math>-set.
Therefore, we have a one-to-one correspondence between surjective mappings from an <math>n</math>-set to an <math>m</math>-set and the ordered <math>m</math>-partitions of an <math>n</math>-set.


The Stirling number of the second kind <math>S(n,m)</math> is the number of <math>m</math>-partitions of an <math>n</math>-set. There are <math>m!</math> ways to order an <math>m</math>-partition, thus the number of surjective mappings <math>f:[n]\rightarrow[m]</math> is <math>m! S(n,m)</math>. Combining with what we have proved for surjections, we give the following result for the Stirling number of the second kind.
The Stirling number of the second kind <math>\left\{{n\atop m}\right\}</math> is the number of <math>m</math>-partitions of an <math>n</math>-set. There are <math>m!</math> ways to order an <math>m</math>-partition, thus the number of surjective mappings <math>f:[n]\rightarrow[m]</math> is <math>m! \left\{{n\atop m}\right\}</math>. Combining with what we have proved for surjections, we give the following result for the Stirling number of the second kind.


{{Theorem|Proposition|
{{Theorem|Proposition|
:<math>\left\{n\atop m\right\}=\frac{1}{m!}\sum_{k=1}^m(-1)^{m-k}{m\choose k}k^n</math>.
:<math>\left\{{n\atop m}\right\}=\frac{1}{m!}\sum_{k=1}^m(-1)^{m-k}{m\choose k}k^n</math>.
}}
}}



Latest revision as of 06:18, 20 March 2013

Principle of Inclusion-Exclusion

Let [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] be two finite sets. The cardinality of their union is

[math]\displaystyle{ |A\cup B|=|A|+|B|-{\color{Blue}|A\cap B|} }[/math].

For three sets [math]\displaystyle{ A }[/math], [math]\displaystyle{ B }[/math], and [math]\displaystyle{ C }[/math], the cardinality of the union of these three sets is computed as

[math]\displaystyle{ |A\cup B\cup C|=|A|+|B|+|C|-{\color{Blue}|A\cap B|}-{\color{Blue}|A\cap C|}-{\color{Blue}|B\cap C|}+{\color{Red}|A\cap B\cap C|} }[/math].

This is illustrated by the following figure.

Generally, the Principle of Inclusion-Exclusion states the rule for computing the union of [math]\displaystyle{ n }[/math] finite sets [math]\displaystyle{ A_1,A_2,\ldots,A_n }[/math], such that

[math]\displaystyle{ \begin{align} \left|\bigcup_{i=1}^nA_i\right| &= \sum_{I\subseteq\{1,\ldots,n\}}(-1)^{|I|-1}\left|\bigcap_{i\in I}A_i\right|. \end{align} }[/math]


In combinatorial enumeration, the Principle of Inclusion-Exclusion is usually applied in its complement form.

Let [math]\displaystyle{ A_1,A_2,\ldots,A_n\subseteq U }[/math] be subsets of some finite set [math]\displaystyle{ U }[/math]. Here [math]\displaystyle{ U }[/math] is some universe of combinatorial objects, whose cardinality is easy to calculate (e.g. all strings, tuples, permutations), and each [math]\displaystyle{ A_i }[/math] contains the objects with some specific property (e.g. a "pattern") which we want to avoid. The problem is to count the number of objects without any of the [math]\displaystyle{ n }[/math] properties. We write [math]\displaystyle{ \bar{A_i}=U-A_i }[/math]. The number of objects without any of the properties [math]\displaystyle{ A_1,A_2,\ldots,A_n }[/math] is

[math]\displaystyle{ \begin{align} \left|\bar{A_1}\cap\bar{A_2}\cap\cdots\cap\bar{A_n}\right|=\left|U-\bigcup_{i=1}^nA_i\right| &= |U|+\sum_{I\subseteq\{1,\ldots,n\}}(-1)^{|I|}\left|\bigcap_{i\in I}A_i\right|. \end{align} }[/math]

For an [math]\displaystyle{ I\subseteq\{1,2,\ldots,n\} }[/math], we denote

[math]\displaystyle{ A_I=\bigcap_{i\in I}A_i }[/math]

with the convention that [math]\displaystyle{ A_\emptyset=U }[/math]. The above equation is stated as:

Principle of Inclusion-Exclusion
Let [math]\displaystyle{ A_1,A_2,\ldots,A_n }[/math] be a family of subsets of [math]\displaystyle{ U }[/math]. Then the number of elements of [math]\displaystyle{ U }[/math] which lie in none of the subsets [math]\displaystyle{ A_i }[/math] is
[math]\displaystyle{ \sum_{I\subseteq\{1,\ldots, n\}}(-1)^{|I|}|A_I| }[/math].

Let [math]\displaystyle{ S_k=\sum_{|I|=k}|A_I|\, }[/math]. Conventionally, [math]\displaystyle{ S_0=|A_\emptyset|=|U| }[/math]. The principle of inclusion-exclusion can be expressed as

[math]\displaystyle{ \left|\bar{A_1}\cap\bar{A_2}\cap\cdots\cap\bar{A_n}\right|= S_0-S_1+S_2+\cdots+(-1)^nS_n. }[/math]

Surjections

In the twelvefold way, we discuss the counting problems incurred by the mappings [math]\displaystyle{ f:N\rightarrow M }[/math]. The basic case is that elements from both [math]\displaystyle{ N }[/math] and [math]\displaystyle{ M }[/math] are distinguishable. In this case, it is easy to count the number of arbitrary mappings (which is [math]\displaystyle{ m^n }[/math]) and the number of injective (one-to-one) mappings (which is [math]\displaystyle{ (m)_n }[/math]), but the number of surjective is difficult. Here we apply the principle of inclusion-exclusion to count the number of surjective (onto) mappings.

Theorem
The number of surjective mappings from an [math]\displaystyle{ n }[/math]-set to an [math]\displaystyle{ m }[/math]-set is given by
[math]\displaystyle{ \sum_{k=1}^m(-1)^{m-k}{m\choose k}k^n }[/math].
Proof.

Let [math]\displaystyle{ U=\{f:[n]\rightarrow[m]\} }[/math] be the set of mappings from [math]\displaystyle{ [n] }[/math] to [math]\displaystyle{ [m] }[/math]. Then [math]\displaystyle{ |U|=m^n }[/math].

For [math]\displaystyle{ i\in[m] }[/math], let [math]\displaystyle{ A_i }[/math] be the set of mappings [math]\displaystyle{ f:[n]\rightarrow[m] }[/math] that none of [math]\displaystyle{ j\in[n] }[/math] is mapped to [math]\displaystyle{ i }[/math], i.e. [math]\displaystyle{ A_i=\{f:[n]\rightarrow[m]\setminus\{i\}\} }[/math], thus [math]\displaystyle{ |A_i|=(m-1)^n }[/math].

More generally, for [math]\displaystyle{ I\subseteq [m] }[/math], [math]\displaystyle{ A_I=\bigcap_{i\in I}A_i }[/math] contains the mappings [math]\displaystyle{ f:[n]\rightarrow[m]\setminus I }[/math]. And [math]\displaystyle{ |A_I|=(m-|I|)^n\, }[/math].

A mapping [math]\displaystyle{ f:[n]\rightarrow[m] }[/math] is surjective if [math]\displaystyle{ f }[/math] lies in none of [math]\displaystyle{ A_i }[/math]. By the principle of inclusion-exclusion, the number of surjective [math]\displaystyle{ f:[n]\rightarrow[m] }[/math] is

[math]\displaystyle{ \sum_{I\subseteq[m]}(-1)^{|I|}\left|A_I\right|=\sum_{I\subseteq[m]}(-1)^{|I|}(m-|I|)^n=\sum_{j=0}^m(-1)^j{m\choose j}(m-j)^n }[/math].

Let [math]\displaystyle{ k=m-j }[/math]. The theorem is proved.

[math]\displaystyle{ \square }[/math]

Recall that, in the twelvefold way, we establish a relation between surjections and partitions.

  • Surjection to ordered partition:
For a surjective [math]\displaystyle{ f:[n]\rightarrow[m] }[/math], [math]\displaystyle{ (f^{-1}(0),f^{-1}(1),\ldots,f^{-1}(m-1)) }[/math] is an ordered partition of [math]\displaystyle{ [n] }[/math].
  • Ordered partition to surjection:
For an ordered [math]\displaystyle{ m }[/math]-partition [math]\displaystyle{ (B_0,B_1,\ldots, B_{m-1}) }[/math] of [math]\displaystyle{ [n] }[/math], we can define a function [math]\displaystyle{ f:[n]\rightarrow[m] }[/math] by letting [math]\displaystyle{ f(i)=j }[/math] if and only if [math]\displaystyle{ i\in B_j }[/math]. [math]\displaystyle{ f }[/math] is surjective since as a partition, none of [math]\displaystyle{ B_i }[/math] is empty.

Therefore, we have a one-to-one correspondence between surjective mappings from an [math]\displaystyle{ n }[/math]-set to an [math]\displaystyle{ m }[/math]-set and the ordered [math]\displaystyle{ m }[/math]-partitions of an [math]\displaystyle{ n }[/math]-set.

The Stirling number of the second kind [math]\displaystyle{ \left\{{n\atop m}\right\} }[/math] is the number of [math]\displaystyle{ m }[/math]-partitions of an [math]\displaystyle{ n }[/math]-set. There are [math]\displaystyle{ m! }[/math] ways to order an [math]\displaystyle{ m }[/math]-partition, thus the number of surjective mappings [math]\displaystyle{ f:[n]\rightarrow[m] }[/math] is [math]\displaystyle{ m! \left\{{n\atop m}\right\} }[/math]. Combining with what we have proved for surjections, we give the following result for the Stirling number of the second kind.

Proposition
[math]\displaystyle{ \left\{{n\atop m}\right\}=\frac{1}{m!}\sum_{k=1}^m(-1)^{m-k}{m\choose k}k^n }[/math].

Derangements

We now count the number of bijections from a set to itself with no fixed points. This is the derangement problem.

For a permutation [math]\displaystyle{ \pi }[/math] of [math]\displaystyle{ \{1,2,\ldots,n\} }[/math], a fixed point is such an [math]\displaystyle{ i\in\{1,2,\ldots,n\} }[/math] that [math]\displaystyle{ \pi(i)=i }[/math]. A derangement of [math]\displaystyle{ \{1,2,\ldots,n\} }[/math] is a permutation of [math]\displaystyle{ \{1,2,\ldots,n\} }[/math] that has no fixed points.

Theorem
The number of derangements of [math]\displaystyle{ \{1,2,\ldots,n\} }[/math] given by
[math]\displaystyle{ n!\sum_{k=0}^n\frac{(-1)^k}{k!}\approx \frac{n!}{\mathrm{e}} }[/math].
Proof.

Let [math]\displaystyle{ U }[/math] be the set of all permutations of [math]\displaystyle{ \{1,2,\ldots,n\} }[/math]. So [math]\displaystyle{ |U|=n! }[/math].

Let [math]\displaystyle{ A_i }[/math] be the set of permutations with fixed point [math]\displaystyle{ i }[/math]; so [math]\displaystyle{ |A_i|=(n-1)! }[/math]. More generally, for any [math]\displaystyle{ I\subseteq \{1,2,\ldots,n\} }[/math], [math]\displaystyle{ A_I=\bigcap_{i\in I}A_i }[/math], and [math]\displaystyle{ |A_I|=(n-|I|)! }[/math], since permutations in [math]\displaystyle{ A_I }[/math] fix every point in [math]\displaystyle{ I }[/math] and permute the remaining points arbitrarily. A permutation is a derangement if and only if it lies in none of the sets [math]\displaystyle{ A_i }[/math]. So the number of derangements is

[math]\displaystyle{ \sum_{I\subseteq\{1,2,\ldots,n\}}(-1)^{|I|}(n-|I|)!=\sum_{k=0}^n(-1)^k{n\choose k}(n-k)!=n!\sum_{k=0}^n\frac{(-1)^k}{k!}. }[/math]

By Taylor's series,

[math]\displaystyle{ \frac{1}{\mathrm{e}}=\sum_{k=0}^\infty\frac{(-1)^k}{k!}=\sum_{k=0}^n\frac{(-1)^k}{k!}\pm o\left(\frac{1}{n!}\right) }[/math].

It is not hard to see that [math]\displaystyle{ n!\sum_{k=0}^n\frac{(-1)^k}{k!} }[/math] is the closest integer to [math]\displaystyle{ \frac{n!}{\mathrm{e}} }[/math].

[math]\displaystyle{ \square }[/math]

Therefore, there are about [math]\displaystyle{ \frac{1}{\mathrm{e}} }[/math] fraction of all permutations with no fixed points.

Permutations with restricted positions

We introduce a general theory of counting permutations with restricted positions. In the derangement problem, we count the number of permutations that [math]\displaystyle{ \pi(i)\neq i }[/math]. We now generalize to the problem of counting permutations which avoid a set of arbitrarily specified positions.

It is traditionally described using terminology from the game of chess. Let [math]\displaystyle{ B\subseteq \{1,\ldots,n\}\times \{1,\ldots,n\} }[/math], called a board. As illustrated below, we can think of [math]\displaystyle{ B }[/math] as a chess board, with the positions in [math]\displaystyle{ B }[/math] marked by "[math]\displaystyle{ \times }[/math]".

a b c d e f g h
8 a8 __ b8 cross c8 cross d8 __ e8 cross f8 __ g8 __ h8 cross 8
7 a7 cross b7 __ c7 __ d7 cross e7 __ f7 __ g7 cross h7 __ 7
6 a6 cross b6 __ c6 cross d6 cross e6 __ f6 cross g6 cross h6 __ 6
5 a5 __ b5 cross c5 __ d5 __ e5 cross f5 __ g5 cross h5 __ 5
4 a4 cross b4 __ c4 __ d4 __ e4 cross f4 cross g4 cross h4 __ 4
3 a3 __ b3 cross c3 __ d3 cross e3 __ f3 __ g3 __ h3 cross 3
2 a2 __ b2 __ c2 cross d2 __ e2 cross f2 __ g2 __ h2 cross 2
1 a1 cross b1 __ c1 __ d1 cross e1 __ f1 cross g1 __ h1 __ 1
a b c d e f g h

For a permutation [math]\displaystyle{ \pi }[/math] of [math]\displaystyle{ \{1,\ldots,n\} }[/math], define the graph [math]\displaystyle{ G_\pi(V,E) }[/math] as

[math]\displaystyle{ \begin{align} G_\pi &= \{(i,\pi(i))\mid i\in \{1,2,\ldots,n\}\}. \end{align} }[/math]

This can also be viewed as a set of marked positions on a chess board. Each row and each column has only one marked position, because [math]\displaystyle{ \pi }[/math] is a permutation. Thus, we can identify each [math]\displaystyle{ G_\pi }[/math] as a placement of [math]\displaystyle{ n }[/math] rooks (“城堡”,规则同中国象棋里的“车”) without attacking each other.

For example, the following is the [math]\displaystyle{ G_\pi }[/math] of such [math]\displaystyle{ \pi }[/math] that [math]\displaystyle{ \pi(i)=i }[/math].

a b c d e f g h
8 a8 white rook b8 __ c8 __ d8 __ e8 __ f8 __ g8 __ h8 __ 8
7 a7 __ b7 white rook c7 __ d7 __ e7 __ f7 __ g7 __ h7 __ 7
6 a6 __ b6 __ c6 white rook d6 __ e6 __ f6 __ g6 __ h6 __ 6
5 a5 __ b5 __ c5 __ d5 white rook e5 __ f5 __ g5 __ h5 __ 5
4 a4 __ b4 __ c4 __ d4 __ e4 white rook f4 __ g4 __ h4 __ 4
3 a3 __ b3 __ c3 __ d3 __ e3 __ f3 white rook g3 __ h3 __ 3
2 a2 __ b2 __ c2 __ d2 __ e2 __ f2 __ g2 white rook h2 __ 2
1 a1 __ b1 __ c1 __ d1 __ e1 __ f1 __ g1 __ h1 white rook 1
a b c d e f g h

Now define

[math]\displaystyle{ \begin{align} N_0 &= \left|\left\{\pi\mid B\cap G_\pi=\emptyset\right\}\right|\\ r_k &= \mbox{number of }k\mbox{-subsets of }B\mbox{ such that no two elements have a common coordinate}\\ &=\left|\left\{S\in{B\choose k} \,\bigg|\, \forall (i_1,j_1),(i_2,j_2)\in S, i_1\neq i_2, j_1\neq j_2 \right\}\right| \end{align} }[/math]

Interpreted in chess game,

  • [math]\displaystyle{ B }[/math]: a set of marked positions in an [math]\displaystyle{ [n]\times [n] }[/math] chess board.
  • [math]\displaystyle{ N_0 }[/math]: the number of ways of placing [math]\displaystyle{ n }[/math] non-attacking rooks on the chess board such that none of these rooks lie in [math]\displaystyle{ B }[/math].
  • [math]\displaystyle{ r_k }[/math]: number of ways of placing [math]\displaystyle{ k }[/math] non-attacking rooks on [math]\displaystyle{ B }[/math].

Our goal is to count [math]\displaystyle{ N_0 }[/math] in terms of [math]\displaystyle{ r_k }[/math]. This gives the number of permutations avoid all positions in a [math]\displaystyle{ B }[/math].

Theorem
[math]\displaystyle{ N_0=\sum_{k=0}^n(-1)^kr_k(n-k)! }[/math].
Proof.

For each [math]\displaystyle{ i\in[n] }[/math], let [math]\displaystyle{ A_i=\{\pi\mid (i,\pi(i))\in B\} }[/math] be the set of permutations [math]\displaystyle{ \pi }[/math] whose [math]\displaystyle{ i }[/math]-th position is in [math]\displaystyle{ B }[/math].

[math]\displaystyle{ N_0 }[/math] is the number of permutations avoid all positions in [math]\displaystyle{ B }[/math]. Thus, our goal is to count the number of permutations [math]\displaystyle{ \pi }[/math] in none of [math]\displaystyle{ A_i }[/math] for [math]\displaystyle{ i\in [n] }[/math].

For each [math]\displaystyle{ I\subseteq [n] }[/math], let [math]\displaystyle{ A_I=\bigcap_{i\in I}A_i }[/math], which is the set of permutations [math]\displaystyle{ \pi }[/math] such that [math]\displaystyle{ (i,\pi(i))\in B }[/math] for all [math]\displaystyle{ i\in I }[/math]. Due to the principle of inclusion-exclusion,

[math]\displaystyle{ N_0=\sum_{I\subseteq [n]} (-1)^{|I|}|A_I|=\sum_{k=0}^n(-1)^k\sum_{I\in{[n]\choose k}}|A_I| }[/math].

The next observation is that

[math]\displaystyle{ \sum_{I\in{[n]\choose k}}|A_I|=r_k(n-k)! }[/math],

because we can count both sides by first placing [math]\displaystyle{ k }[/math] non-attacking rooks on [math]\displaystyle{ B }[/math] and placing [math]\displaystyle{ n-k }[/math] additional non-attacking rooks on [math]\displaystyle{ [n]\times [n] }[/math] in [math]\displaystyle{ (n-k)! }[/math] ways.

Therefore,

[math]\displaystyle{ N_0=\sum_{k=0}^n(-1)^kr_k(n-k)! }[/math].
[math]\displaystyle{ \square }[/math]

Derangement problem

We use the above general method to solve the derange problem again.

Take [math]\displaystyle{ B=\{(1,1),(2,2),\ldots,(n,n)\} }[/math] as the chess board. A derangement [math]\displaystyle{ \pi }[/math] is a placement of [math]\displaystyle{ n }[/math] non-attacking rooks such that none of them is in [math]\displaystyle{ B }[/math].

a b c d e f g h
8 a8 cross b8 __ c8 __ d8 __ e8 __ f8 __ g8 __ h8 __ 8
7 a7 __ b7 cross c7 __ d7 __ e7 __ f7 __ g7 __ h7 __ 7
6 a6 __ b6 __ c6 cross d6 __ e6 __ f6 __ g6 __ h6 __ 6
5 a5 __ b5 __ c5 __ d5 cross e5 __ f5 __ g5 __ h5 __ 5
4 a4 __ b4 __ c4 __ d4 __ e4 cross f4 __ g4 __ h4 __ 4
3 a3 __ b3 __ c3 __ d3 __ e3 __ f3 cross g3 __ h3 __ 3
2 a2 __ b2 __ c2 __ d2 __ e2 __ f2 __ g2 cross h2 __ 2
1 a1 __ b1 __ c1 __ d1 __ e1 __ f1 __ g1 __ h1 cross 1
a b c d e f g h

Clearly, the number of ways of placing [math]\displaystyle{ k }[/math] non-attacking rooks on [math]\displaystyle{ B }[/math] is [math]\displaystyle{ r_k={n\choose k} }[/math]. We want to count [math]\displaystyle{ N_0 }[/math], which gives the number of ways of placing [math]\displaystyle{ n }[/math] non-attacking rooks such that none of these rooks lie in [math]\displaystyle{ B }[/math].

By the above theorem

[math]\displaystyle{ N_0=\sum_{k=0}^n(-1)^kr_k(n-k)!=\sum_{k=0}^n(-1)^k{n\choose k}(n-k)!=\sum_{k=0}^n(-1)^k\frac{n!}{k!}=n!\sum_{k=0}^n(-1)^k\frac{1}{k!}\approx\frac{n!}{e}. }[/math]

Problème des ménages

Suppose that in a banquet, we want to seat [math]\displaystyle{ n }[/math] couples at a circular table, satisfying the following constraints:

  • Men and women are in alternate places.
  • No one sits next to his/her spouse.

In how many ways can this be done?

(For convenience, we assume that every seat at the table marked differently so that rotating the seats clockwise or anti-clockwise will end up with a different solution.)

First, let the [math]\displaystyle{ n }[/math] ladies find their seats. They may either sit at the odd numbered seats or even numbered seats, in either case, there are [math]\displaystyle{ n! }[/math] different orders. Thus, there are [math]\displaystyle{ 2(n!) }[/math] ways to seat the [math]\displaystyle{ n }[/math] ladies.

After sitting the wives, we label the remaining [math]\displaystyle{ n }[/math] places clockwise as [math]\displaystyle{ 0,1,\ldots, n-1 }[/math]. And a seating of the [math]\displaystyle{ n }[/math] husbands is given by a permutation [math]\displaystyle{ \pi }[/math] of [math]\displaystyle{ [n] }[/math] defined as follows. Let [math]\displaystyle{ \pi(i) }[/math] be the seat of the husband of he lady sitting at the [math]\displaystyle{ i }[/math]-th place.

It is easy to see that [math]\displaystyle{ \pi }[/math] satisfies that [math]\displaystyle{ \pi(i)\neq i }[/math] and [math]\displaystyle{ \pi(i)\not\equiv i+1\pmod n }[/math], and every permutation [math]\displaystyle{ \pi }[/math] with these properties gives a feasible seating of the [math]\displaystyle{ n }[/math] husbands. Thus, we only need to count the number of permutations [math]\displaystyle{ \pi }[/math] such that [math]\displaystyle{ \pi(i)\not\equiv i, i+1\pmod n }[/math].

Take [math]\displaystyle{ B=\{(0,0),(1,1),\ldots,(n-1,n-1), (0,1),(1,2),\ldots,(n-2,n-1),(n-1,0)\} }[/math] as the chess board. A permutation [math]\displaystyle{ \pi }[/math] which defines a way of seating the husbands, is a placement of [math]\displaystyle{ n }[/math] non-attacking rooks such that none of them is in [math]\displaystyle{ B }[/math].

a b c d e f g h
8 a8 cross b8 cross c8 __ d8 __ e8 __ f8 __ g8 __ h8 __ 8
7 a7 __ b7 cross c7 cross d7 __ e7 __ f7 __ g7 __ h7 __ 7
6 a6 __ b6 __ c6 cross d6 cross e6 __ f6 __ g6 __ h6 __ 6
5 a5 __ b5 __ c5 __ d5 cross e5 cross f5 __ g5 __ h5 __ 5
4 a4 __ b4 __ c4 __ d4 __ e4 cross f4 cross g4 __ h4 __ 4
3 a3 __ b3 __ c3 __ d3 __ e3 __ f3 cross g3 cross h3 __ 3
2 a2 __ b2 __ c2 __ d2 __ e2 __ f2 __ g2 cross h2 cross 2
1 a1 cross b1 __ c1 __ d1 __ e1 __ f1 __ g1 __ h1 cross 1
a b c d e f g h

We need to compute [math]\displaystyle{ r_k }[/math], the number of ways of placing [math]\displaystyle{ k }[/math] non-attacking rooks on [math]\displaystyle{ B }[/math]. For our choice of [math]\displaystyle{ B }[/math], [math]\displaystyle{ r_k }[/math] is the number of ways of choosing [math]\displaystyle{ k }[/math] points, no two consecutive, from a collection of [math]\displaystyle{ 2n }[/math] points arranged in a circle.

We first see how to do this in a line.

Lemma
The number of ways of choosing [math]\displaystyle{ k }[/math] non-consecutive objects from a collection of [math]\displaystyle{ m }[/math] objects arranged in a line, is [math]\displaystyle{ {m-k+1\choose k} }[/math].
Proof.

We draw a line of [math]\displaystyle{ m-k }[/math] black points, and then insert [math]\displaystyle{ k }[/math] red points into the [math]\displaystyle{ m-k+1 }[/math] spaces between the black points (including the beginning and end).

[math]\displaystyle{ \begin{align} &\sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \, \sqcup \\ &\qquad\qquad\qquad\quad\Downarrow\\ &\sqcup \, \bullet \,\, {\color{Red}\bullet} \, \bullet \,\, {\color{Red}\bullet} \, \bullet \, \sqcup \, \bullet \,\, {\color{Red}\bullet}\, \, \bullet \, \sqcup \, \bullet \, \sqcup \, \bullet \,\, {\color{Red}\bullet} \end{align} }[/math]

This gives us a line of [math]\displaystyle{ m }[/math] points, and the red points specifies the chosen objects, which are non-consecutive. The mapping is 1-1 correspondence. There are [math]\displaystyle{ {m-k+1\choose k} }[/math] ways of placing [math]\displaystyle{ k }[/math] red points into [math]\displaystyle{ m-k+1 }[/math] spaces.

[math]\displaystyle{ \square }[/math]

The problem of choosing non-consecutive objects in a circle can be reduced to the case that the objects are in a line.

Lemma
The number of ways of choosing [math]\displaystyle{ k }[/math] non-consecutive objects from a collection of [math]\displaystyle{ m }[/math] objects arranged in a circle, is [math]\displaystyle{ \frac{m}{m-k}{m-k\choose k} }[/math].
Proof.

Let [math]\displaystyle{ f(m,k) }[/math] be the desired number; and let [math]\displaystyle{ g(m,k) }[/math] be the number of ways of choosing [math]\displaystyle{ k }[/math] non-consecutive points from [math]\displaystyle{ m }[/math] points arranged in a circle, next coloring the [math]\displaystyle{ k }[/math] points red, and then coloring one of the uncolored point blue.

Clearly, [math]\displaystyle{ g(m,k)=(m-k)f(m,k) }[/math].

But we can also compute [math]\displaystyle{ g(m,k) }[/math] as follows:

  • Choose one of the [math]\displaystyle{ m }[/math] points and color it blue. This gives us [math]\displaystyle{ m }[/math] ways.
  • Cut the circle to make a line of [math]\displaystyle{ m-1 }[/math] points by removing the blue point.
  • Choose [math]\displaystyle{ k }[/math] non-consecutive points from the line of [math]\displaystyle{ m-1 }[/math] points and color them red. This gives [math]\displaystyle{ {m-k\choose k} }[/math] ways due to the previous lemma.

Thus, [math]\displaystyle{ g(m,k)=m{m-k\choose k} }[/math]. Therefore we have the desired number [math]\displaystyle{ f(m,k)=\frac{m}{m-k}{m-k\choose k} }[/math].

[math]\displaystyle{ \square }[/math]

By the above lemma, we have that [math]\displaystyle{ r_k=\frac{2n}{2n-k}{2n-k\choose k} }[/math]. Then apply the theorem of counting permutations with restricted positions,

[math]\displaystyle{ N_0=\sum_{k=0}^n(-1)^kr_k(n-k)!=\sum_{k=0}^n(-1)^k\frac{2n}{2n-k}{2n-k\choose k}(n-k)!. }[/math]

This gives the number of ways of seating the [math]\displaystyle{ n }[/math] husbands after the ladies are seated. Recall that there are [math]\displaystyle{ 2n! }[/math] ways of seating the [math]\displaystyle{ n }[/math] ladies. Thus, the total number of ways of seating [math]\displaystyle{ n }[/math] couples as required by problème des ménages is

[math]\displaystyle{ 2n!\sum_{k=0}^n(-1)^k\frac{2n}{2n-k}{2n-k\choose k}(n-k)!. }[/math]

The Euler totient function

Two integers [math]\displaystyle{ m, n }[/math] are said to be relatively prime if their greatest common diviser [math]\displaystyle{ \mathrm{gcd}(m,n)=1 }[/math]. For a positive integer [math]\displaystyle{ n }[/math], let [math]\displaystyle{ \phi(n) }[/math] be the number of positive integers from [math]\displaystyle{ \{1,2,\ldots,n\} }[/math] that are relative prime to [math]\displaystyle{ n }[/math]. This function, called the Euler [math]\displaystyle{ \phi }[/math] function or the Euler totient function, is fundamental in number theory.

We now derive a formula for this function by using the principle of inclusion-exclusion.

Theorem (The Euler totient function)

Suppose [math]\displaystyle{ n }[/math] is divisible by precisely [math]\displaystyle{ r }[/math] different primes, denoted [math]\displaystyle{ p_1,\ldots,p_r }[/math]. Then

[math]\displaystyle{ \phi(n)=n\prod_{i=1}^r\left(1-\frac{1}{p_i}\right) }[/math].
Proof.

Let [math]\displaystyle{ U=\{1,2,\ldots,n\} }[/math] be the universe. The number of positive integers from [math]\displaystyle{ U }[/math] which is divisible by some [math]\displaystyle{ p_{i_1},p_{i_2},\ldots,p_{i_s}\in\{p_1,\ldots,p_r\} }[/math], is [math]\displaystyle{ \frac{n}{p_{i_1}p_{i_2}\cdots p_{i_s}} }[/math].

[math]\displaystyle{ \phi(n) }[/math] is the number of integers from [math]\displaystyle{ U }[/math] which is not divisible by any [math]\displaystyle{ p_1,\ldots,p_r }[/math]. By principle of inclusion-exclusion,

[math]\displaystyle{ \begin{align} \phi(n) &=n+\sum_{k=1}^r(-1)^k\sum_{1\le i_1\lt i_2\lt \cdots \lt i_k\le n}\frac{n}{p_{i_1}p_{i_2}\cdots p_{i_k}}\\ &=n-\sum_{1\le i\le n}\frac{n}{p_i}+\sum_{1\le i\lt j\le n}\frac{n}{p_i p_j}-\sum_{1\le i\lt j\lt k\le n}\frac{n}{p_{i} p_{j} p_{k}}+\cdots + (-1)^r\frac{n}{p_{1}p_{2}\cdots p_{r}}\\ &=n\left(1-\sum_{1\le i\le n}\frac{1}{p_i}+\sum_{1\le i\lt j\le n}\frac{1}{p_i p_j}-\sum_{1\le i\lt j\lt k\le n}\frac{1}{p_{i} p_{j} p_{k}}+\cdots + (-1)^r\frac{1}{p_{1}p_{2}\cdots p_{r}}\right)\\ &=n\prod_{i=1}^r\left(1-\frac{1}{p_i}\right). \end{align} }[/math]
[math]\displaystyle{ \square }[/math]

Reference

  • Stanley, Enumerative Combinatorics, Volume 1, Chapter 2.
  • van Lin and Wilson, A course in combinatorics, Chapter 10, 25.