p´olya counting iteaching.csse.uwa.edu.au/units/cits7209/polya.pdfa necklace was defined to be an...
TRANSCRIPT
NecklacesPolya’s Enumeration Theorem
Polya Counting I
Gordon Royle
Semester 1, 2004
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
George Polya (1887 – 1985)
George Polya discovered apowerful general method forenumerating the number oforbits of a group on particularconfigurations. This methodbecame known as the PolyaEnumeration Theorem, orPET.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Necklaces
Consider a decorative ornament that consists of n coloured“beads” arranged on a circular loop of string.
This can be represented simply as a word of length n over asuitable alphabet of colours: bbgbrr
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Rotation
Two words that differ purely by a (cyclic) rotation clearly representthe same ornament, and are called equivalent:
rbbgbr ≡ rrbbgb ≡ bbgbrr
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Necklaces
An (n, k)−necklace is an equivalence class of words of length nover an alphabet of size k under rotation. The basic enumerationproblem is then:
Necklace EnumerationFor a given n and k, how many (n, k)-necklaces are there?
Equivalently, we are asking how many orbits the cyclic group Cn
has on the set of all words of length n over an alphabet of size k.
We will denote this value by a(n, k).
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
(6, 3)-necklaces
By Burnside’s lemma, the number of orbits of C6 on words oflength 6 over an alphabet of size 3 is equal to the average numberof words fixed by each element of C6.
Element g |fix(g)|e 36
(1, 2, 3, 4, 5, 6) 3(1, 3, 5)(2, 4, 6) 32
(1, 4)(2, 5)(3, 6) 33
(1, 5, 3)(2, 6, 4) 32
(1, 6, 5, 4, 3, 2) 3
a(6, 3) =16
∑g∈C6
|fix(g)| = 130.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
(6, k)-necklaces
If we allow k colours, then the computation is the same exceptthat the number of configurations fixed by each element nowdepends on k.
Element g |fix(g)|e k6
(1, 2, 3, 4, 5, 6) k(1, 3, 5)(2, 4, 6) k2
(1, 4)(2, 5)(3, 6) k3
(1, 5, 3)(2, 6, 4) k2
(1, 6, 5, 4, 3, 2) k
a(6, k) =16
∑g∈C6
|fix(g)| = (2k + 2k2 + k3 + k6)/6;
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
(n, k)-necklaces
The number of words fixed by an element g of Cn is completelydetermined by the number of cycles in the cycle decomposition ofg — in fact, if g has c cycles, then it fixes kc words.Now, if g = (1, 2, . . . , n) then the elements of Cn are the npermutations
g, g2, . . . , gn = e.
The order of the element gi is
n/ gcd(n, i)
and hence it has gcd(n, i) cycles in its cycle decomposition.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
(n, k)-necklaces
Therefore the number of (n, k)-necklaces is given by
a(n, k) =1n
n∑i=1
kgcd(n,i).
If p is a prime number then this can be substantially simplified,because gcd(p, i) = 1 for all i < p, and so we get
a(p, k) =1p((p− 1)k + kp).
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Euler’s φ Function
For any positive integer x, let φ(x) denote the number of integers1 ≤ i ≤ x such that gcd(x, i) = 1.
This function is sometimes called Euler’s φ function or Euler’stotient function and its first few values are given below:
x φ(x) x φ(x)1 1 2 13 2 4 25 4 6 27 6 8 49 6 10 411 10 12 4
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
General Result
The following theorem explains the significance of Euler’s functionfor necklaces:
TheoremFor any divisor d of n, there are φ(d) elements of order d in Cn.
CorollaryThe number of (n, k)-necklaces is given by
a(n, k) =1n
∑d|n
φ(d)kn/d.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Proof of Theorem
For each possible “greatest common divisor” value g|n, how manynumbers i are there such that
gcd(n, i) = g?
For this to occur, we must have
n = n1g i = i1g
where gcd(n1, i1) = 1.
Clearly this number is just φ(n1) = φ(n/g), and putting d = n/gwe obtain the result.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
In GAP
Using GAP’s built-in functions, this can be written in a very slickfashion:
neckLaces := function(n,k)return Sum(DivisorsInt(n),d->Phi(d)*k^(n/d))/n;
end;
Here DivisorsInt returns the list of divisors of a number, andPhi is Euler’s φ function. This use of Sum with two argumentsapplies the function given as the second argument to every elementof the list in the first argument and sums the resulting values.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Bracelets
Some of these ornaments can be freely turned over (for example, ifthe beads are just spherical), but sometimes they cannot, and sowhether we consider configurations that are mirror-images to beequivalent or not depends on the application.An (n, k)−bracelet is an equivalence class of words of length nunder rotation and reflection.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Counting Bracelets
In order to determine b(n, k) – the number of bracelets of length nover an alphabet of size k, we need to find the number of orbits ofthe dihedral group D2n on k-ary n-tuples.
ExerciseDetermine b(n, k).
Hint: Experiment first with GAP and small dihedral groups. Thefinal expression will differ according to whether n is even or odd, soexamine carefully the differences.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Representatives
A necklace was defined to be an equivalence class of words underrotation. For example, if n = 3 and the alphabet is {0, 1, 2} thenthe following set is an example of a necklace:
{010012, 100120, 001201, 012010, 120100, 201001}.
Any one of these words suffices to determine the necklace, and sowe represent a necklace by using the lexicographically least wordthat it contains. Thus the necklace
{010012, 100120, 001201, 012010, 120100, 201001}
is represented by the word
001201.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Generation
We could generate all necklaces by generating all the kn wordsusing the odometer principle and then discarding all the ones thatare not the lexicographically least in their class.
This is not an efficient way to generate necklaces because itgenerates kn words for approximately kn/n necklaces, thus doingabout n times too much work.
An interesting algorithm to generate necklaces was found byFredericksen, Kessler and Maiorana and is therefore known as theFKM algorithm.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
FKM Algorithm
To generate all (n, k)-necklaces over the alphabet{0, 1, . . . , k − 1}, consider the following rule to generate a list ofwords (which will include both necklaces and some non-necklaces)in increasing lexicographic order from the first word 0n = 000 . . . 0to the last word (k − 1)n.
For any word α = a1a2 . . . an other than (k − 1)n, the successor ofα is obtained as follows:
I Let i be the largest value such that ai < (k − 1),I Let β = a1a2 . . . ai−1(ai + 1),I Then succ(α) is the first n characters of βββ . . .; this word is
a necklace if and only if i is a divisor of n.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Example
Suppose we are generating (6, 3)-necklaces; then the FKMalgorithm starts as follows:
0 0 0 0 0 00 0 0 0 0 10 0 0 0 0 20 0 0 0 1 0 ← reject0 0 0 0 1 10 0 0 0 1 20 0 0 0 2 0 ← reject0 0 0 0 2 10 0 0 0 2 20 0 0 1 0 0 ← reject
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Example (cont.)
At some later stage of the algorithm, it continues
0 1 2 2 2 20 2 0 2 0 20 2 0 2 1 0 ← reject0 2 0 2 1 10 2 0 2 1 20 2 0 2 2 0 ← reject0 2 0 2 2 10 2 0 2 2 20 2 1 0 2 1
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Pre-necklaces
The set of words produced by the FKM algorithm is actually thecollection of pre-necklaces — that is, words that can occur at thebeginning of a k-ary necklace of some possibly larger length.
Proving this, and the fact that the necklaces occur precisely when iis a divisor of n is not extremely difficult, but does require somecareful analysis of the structure of necklaces.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
IntroductionEnumerationGeneration
Binary Necklaces
Binary necklaces (i.e those with k = 2) can be produced by theFKM algorithm:
0 0 0 0 0 0 00 0 0 0 0 0 10 0 0 0 0 1 10 0 0 0 1 0 10 0 0 0 1 1 10 0 0 1 0 0 10 0 0 1 0 1 1
0 0 0 1 1 0 10 0 0 1 1 1 10 0 1 0 0 1 10 0 1 0 1 0 10 0 1 0 1 1 10 0 1 1 0 1 10 0 1 1 1 0 1
0 0 1 1 1 1 10 1 0 1 0 1 10 1 0 1 1 1 10 1 1 0 1 1 10 1 1 1 1 1 11 1 1 1 1 1 1
Unsolved ProblemIs there a list containing representatives of all of the binary n-bitnecklaces (for odd n) such that successive elements differ in onlyone place? (In other words, a Gray code for binary necklaces).
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
Cycle Index
Cycle Index
Given a permutation g of degree n, let ci(g) be the number ofcycles of length i in its cycle decomposition.
Then the cycle index of a permutation group is a polynomial thatsummarizes the information about the cycle types of all theelements of the group.
ZG(X1, X2, . . . , Xn) =1|G|
∑g∈G
Xc1(g)1 X
c2(g)2 · · ·Xcn(g)
n
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
Cycle Index
Examples
The cycle index of the group C6 is given by
ZC6(X1, X2, . . . , X6) =16(X6
1 + X32 + 2X2
3 + 2X6).
Notice that the number of (6, k)-necklaces is given by
a(6, k) = ZC6(k, k, k, k, k, k)
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
Cycle Index
Polya’s Enumeration Theorem
Now we state a simple version of Polya’s Enumeration Theorem.
Polya’s Enumeration Theorem (PET)Let A and B be two finite sets, and suppose that group G acts onA. Then the number of orbits of G on the set BA of functions
f : A→ B
is given byZG(|B|, |B|, . . . , |B|).
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
Cycle Index
Necklaces
PET applies directly to necklaces, because if we take
I A = {1, 2, . . . n},I B = {0, 1, . . . , k − 1}, and
I G = Cn.
then a function from A→ B corresponds to a word of length nover the alphabet {0, 1, . . . , k − 1}, and the orbits of these wordsunder Cn are precisely the necklaces.
So, we geta(n, k) = ZCn(k, k, . . . , k)
as we have (almost) already seen.
Gordon Royle Polya Counting I
NecklacesPolya’s Enumeration Theorem
Cycle Index
Proof of PETThe proof of PET follows directly from Burnside’s lemma.
A function f : A→ B is fixed by a permutation g ∈ G if and onlyif f is constant on each of the cycles of g. Therefore if g has c(g)cycles altogether, then there are
|B|c(g)
functions fixed by g.
Now g makes a contribution to ZG of
Xc1(g)1 X
c2(g)2 · · ·Xcn(g)
n
and if we substitute Xi = |B| then we get
|B|c1(g)+c2(g)+···+cn(g) = |B|c(g).
Gordon Royle Polya Counting I