In combinatorial mathematics, a rook polynomial is a generating polynomial of the number of ways to place non-attacking rooks on a board that looks like a checkerboard; that is, no two rooks may be in the same row or column. The board is any subset of the squares of a rectangular board with m rows and n columns; we think of it as the squares in which one is allowed to put a rook. The board is the ordinary chessboard if all squares are allowed and m = n = 8 and a chessboard of any size if all squares are allowed and m = n. The coefficient of x k in the rook polynomial RB(x) is the number of ways k rooks, none of which attacks another, can be arranged in the squares of B. The rooks are arranged in such a way that there is no pair of rooks in the same row or column. In this sense, an arrangement is the positioning of rooks on a static, immovable board; the arrangement will not be different if the board is rotated or reflected while keeping the squares stationary. The polynomial also remains the same if rows are interchanged or columns are interchanged.
The term "rook polynomial" was coined by John Riordan. Despite the name's derivation from chess, the impetus for studying rook polynomials is their connection with counting permutations (or partial permutations) with restricted positions. A board B that is a subset of the n × n chessboard corresponds to permutations of n objects, which we may take to be the numbers 1, 2, ..., n, such that the number aj in the j-th position in the permutation must be the column number of an allowed square in row j of B. Famous examples include the number of ways to place n non-attacking rooks on:
- an entire n × n chessboard, which is an elementary combinatorial problem;
- the same board with its diagonal squares forbidden; this is the derangement or "hat-check" problem;
- the same board without the squares on its diagonal and immediately above its diagonal (and without the bottom left square), which is essential in the solution of the problème des ménages.
Interest in rook placements arises in pure and applied combinatorics, group theory, number theory, and statistical physics. The particular value of rook polynomials comes from the utility of the generating function approach, and also from the fact that the zeroes of the rook polynomial of a board provide valuable information about its coefficients, i.e., the number of non-attacking placements of k rooks.
The rook polynomial RB(x) of a board B is the generating function for the numbers of arrangements of non-attacking rooks:
where rk is the number of ways to place k non-attacking rooks on the board. Despite the notation, this is a finite sum, since the board is finite so there is a maximum number of non-attacking rooks it can hold; indeed, there cannot be more rooks than the smaller of the number of rows and columns in the board.
The first few rook polynomials on square n × n boards are (with Rn = RB):
In words, this means that on a 1 × 1 board, 1 rook can be arranged in 1 way, and zero rooks can also be arranged in 1 way (empty board); on a complete 2 × 2 board, 2 rooks can be arranged in 2 ways (on the diagonals), 1 rook can be arranged in 4 ways, and zero rooks can be arranged in 1 way; and so forth for larger boards.
For complete m × n rectangular boards Bm,n we write Rm,n := RBm,n . The smaller of m and n can be taken as an upper limit for k, since obviously rk = 0 if k > min(m, n). This is also shown in the formula for Rm,n(x).
The rook polynomial of a rectangular chessboard is closely related to the generalized Laguerre polynomial Lnα(x) by the identity
The rook polynomial Rm,n(x) corresponds to the complete bipartite graph Km,n . The rook polynomial of a general board B ⊆ Bm,n corresponds to the bipartite graph with left vertices v1, v2, ..., vm and right vertices w1, w2, ..., wn and an edge viwj whenever the square (i, j) is allowed, i.e., belongs to B. Thus, the theory of rook polynomials is, in a sense, contained in that of matching polynomials.
We deduce an important fact about the coefficients rk, which we recall given the number of non-attacking placements of k rooks in B: these numbers are unimodal, i.e., they increase to a maximum and then decrease. This follows (by a standard argument) from the theorem of Heilmann and Lieb about the zeroes of a matching polynomial (a different one from that which corresponds to a rook polynomial, but equivalent to it under a change of variables), which implies that all the zeroes of a rook polynomial are negative real numbers.
Connection to matrix permanents
For incomplete square n × n boards, (i.e. rooks are not allowed to be played on some arbitrary subset of the board's squares) computing the number of ways to place n rooks on the board is equivalent to computing the permanent of a 0–1 matrix.
Complete rectangular boards
A precursor to the rook polynomial is the classic "Eight rooks problem" by H. E. Dudeney in which he shows that the maximum number of non-attacking rooks on a chessboard is eight by placing them on one of the main diagonals (Fig. 1). The question asked is: "In how many ways can eight rooks be placed on an 8 × 8 chessboard so that neither of them attacks the other?" The answer is: "Obviously there must be a rook in every row and every column. Starting with the bottom row, it is clear that the first rook can be put on any one of eight different squares (Fig. 1). Wherever it is placed, there is the option of seven squares for the second rook in the second row. Then there are six squares from which to select the third row, five in the fourth, and so on. Therefore the number of different ways must be 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320" (that is, 8!, where "!" is factorial).
The same result can be obtained in a slightly different way. Let us endow each rook with a positional number, corresponding to the number of its rank, and assign it a name that corresponds to the name of its file. Thus, rook a1 has position 1 and name "a", rook b2 has position 2 and name "b", etc. Then let us order the rooks into an ordered list (sequence) by their positions. The diagram on Fig. 1 will then transform in the sequence (a,b,c,d,e,f,g,h). Placing any rook on another file would involve moving the rook that hitherto occupied the second file to the file, vacated by the first rook. For instance, if rook a1 is moved to "b" file, rook b2 must be moved to "a" file, and now they will become rook b1 and rook a2. The new sequence will become (b,a,c,d,e,f,g,h). In combinatorics, this operation is termed permutation, and the sequences, obtained as a result of the permutation, are permutations of the given sequence. The total number of permutations, containing 8 elements from a sequence of 8 elements is 8! (factorial of 8).
To assess the effect of the imposed limitation "rooks must not attack each other", let us consider the problem without such limitation. In how many ways can eight rooks be placed on an 8 × 8 chessboard? This will be the total number of combinations of 8 rooks on 64 squares:
Thus, the limitation "rooks must not attack each other" reduces the total number of allowable positions from combinations to permutations which is a factor of about 109,776.
A number of problems from different spheres of human activity can be reduced to the rook problem by giving them a "rook formulation". As an example: A company must employ n workers on n different jobs and each job must be carried out only by one worker. In how many ways can this appointment be done?
Let us put the workers on the ranks of the n × n chessboard, and the jobs − on the files. If worker i is appointed to job j, a rook is placed on the square where rank i crosses file j. Since each job is carried out only by one worker and each worker is appointed to only one job, all files and ranks will contain only one rook as a result of the arrangement of n rooks on the board, that is, the rooks do not attack each other.
The rook polynomial as a generalization of the rooks problem
The classical rooks problem immediately gives the value of r8, the coefficient in front of the highest order term of the rook polynomial. Indeed, its result is that 8 non-attacking rooks can be arranged on an 8 × 8 chessboard in r8 = 8! = 40320 ways.
Let us generalize this problem by considering an m × n board, that is, a board with m ranks (rows) and n files (columns). The problem becomes: In how many ways can one arrange k rooks on an m × n board in such a way that they do not attack each other?
It is clear that for the problem to be solvable, k must be less or equal to the smaller of the numbers m and n; otherwise one cannot avoid placing a pair of rooks on a rank or on a file. Let this condition be fulfilled. Then the arrangement of rooks can be carried out in two steps. First, choose the set of k ranks on which to place the rooks. Since the number of ranks is m, of which k must be chosen, this choice can be done in ways. Similarly, the set of k files on which to place the rooks can be chosen in ways. Because the choice of files does not depend on the choice of ranks, according to the products rule there are ways to choose the square on which to place the rook.
However, the task is not yet finished because k ranks and k files intersect in k2 squares. By deleting unused ranks and files and compacting the remaining ranks and files together, one obtains a new board of k ranks and k files. It was already shown that on such board k rooks can be arranged in k! ways (so that they do not attack each other). Therefore, the total number of possible non-attacking rooks arrangements is:
For instance, 3 rooks can be placed on a conventional chessboard (8 × 8) in ways. For k = m = n, the above formula gives rk = n! that corresponds to the result obtained for the classical rooks problem.
The rook polynomial with explicit coefficients is now:
If the limitation "rooks must not attack each other" is removed, one must choose any k squares from m × n squares. This can be done in:
If the k rooks differ in some way from each other, e.g., they are labelled or numbered, all the results obtained so far must be multiplied by k!, the number of permutations of k rooks.
As a further complication to the rooks problem, let us require that rooks not only be non-attacking but also symmetrically arranged on the board. Depending on the type of symmetry, this is equivalent to rotating or reflecting the board. Symmetric arrangements lead to many problems, depending on the symmetry condition.
The simplest of those arrangements is when rooks are symmetric about the centre of the board. Let us designate with Gn the number of arrangements in which n rooks are placed on a board with n ranks and n files. Now let us make the board to contain 2n ranks and 2n files. A rook on the first file can be placed on any of the 2n squares of that file. According to the symmetry condition, placement of this rook defines the placement of the rook that stands on the last file − it must be arranged symmetrically to the first rook about the board centre. Let us remove the first and the last files and the ranks that are occupied by rooks (since the number of ranks is even, the removed rooks cannot stand on the same rank). This will give a board of 2n − 2 files and 2n − 2 ranks. It is clear that to each symmetric arrangement of rooks on the new board corresponds a symmetric arrangement of rooks on the original board. Therefore, G2n = 2nG2n − 2 (the factor 2n in this expression comes from the possibility for the first rook to occupy any of the 2n squares on the first file). By iterating the above formula one reaches to the case of a 2 × 2 board, on which there are 2 symmetric arrangements (on the diagonals). As a result of this iteration, the final expression is G2n = 2nn! For the usual chessboard (8 × 8), G8 = 24 × 4! = 16 × 24 = 384 centrally symmetric arrangements of 8 rooks. One such arrangement is shown in Fig. 2.
For odd-sized boards (containing 2n + 1 ranks and 2n + 1 files) there is always a square that does not have its symmetric double − this is the central square of the board. There must always be a rook placed on this square. Removing the central file and rank, one obtains a symmetric arrangement of 2n rooks on a 2n × 2n board. Therefore, for such board, once again G2n + 1 = G2n = 2nn!
A little more complicated problem is to find the number of non-attacking arrangements that do not change upon 90° rotation of the board. Let the board has 4n files and 4n ranks, and the number of rooks is also 4n. In this case, the rook that is on the first file can occupy any square on this file, except the corner squares (a rook cannot be on a corner square because after a 90° rotation there would 2 rooks that attack each other). There are another 3 rooks that correspond to that rook and they stand, respectively, on the last rank, the last file, and the first rank (they are obtained from the first rook by 90°, 180°, and 270° rotations). Removing the files and ranks of those rooks, one obtains the rook arrangements for a (4n − 4) × (4n − 4) board with the required symmetry. Thus, the following recurrence relation is obtained: R4n = (4n − 2)R4n − 4, where Rn is the number of arrangements for a n × n board. Iterating, it follows that R4n = 2n(2n − 1)(2n − 3)...1. The number of arrangements for a (4n + 1) × (4n + 1) board is the same as that for a 4n × 4n board; this is because on a (4n + 1) × (4n + 1) board, one rook must necessarily stand in the centre and thus the central rank and file can be removed. Therefore R4n + 1 = R4n. For the traditional chessboard (n = 2), R8 = 4 × 3 × 1 = 12 possible arrangements with rotational symmetry.
For (4n + 2) × (4n + 2) and (4n + 3) × (4n + 3) boards, the number of solutions is zero. Two cases are possible for each rook: either it stands in the centre or it doesn't stand in the centre. In the second case, this rook is included in the rook quartet that exchanges squares on turning the board at 90°. Therefore, the total number of rooks must be either 4n (when there is no central square on the board) or 4n + 1. This proves that R4n + 2 = R4n + 3 = 0.
The number of arrangements of n non-attacking rooks symmetric to one of the diagonals (for determinacy, the diagonal corresponding to a1–h8 on the chessboard) on a n × n board is given by the telephone numbers defined by the recurrence Qn = Qn − 1 + (n − 1)Qn − 2. This recurrence is derived in the following way. Note that the rook on the first file either stands on the bottom corner square or it stands on another square. In the first case, removal of the first file and the first rank leads to the symmetric arrangement n − 1 rooks on a (n − 1) × (n − 1) board. The number of such arrangements is Qn − 1. In the second case, for the original rook there is another rook, symmetric to the first one about the chosen diagonal. Removing the files and ranks of those rooks leads to a symmetric arrangement n − 2 rooks on a (n − 2) × (n − 2) board. Since the number of such arrangements is Qn − 2 and the rook can be put on the n − 1 square of the first file, there are (n − 1)Qn − 2 ways for doing this, which immediately gives the above recurrence. The number of diagonal-symmetric arrangements is then given by the expression:
This expression is derived by partitioning all rook arrangements in classes; in class s are those arrangements in which s pairs of rooks do not stand on the diagonal. In exactly the same way, it can be shown that the number of n-rook arrangements on a n × n board, such that they do not attack each other and are symmetric to both diagonals is given by the recurrence equations B2n = 2B2n − 2 + (2n − 2)B2n − 4 and B2n + 1 = B2n.
Arrangements counted by symmetry classes
A different type of generalization is that in which rook arrangements that are obtained from each other by symmetries of the board are counted as one. For instance, if rotating the board by 90 degrees is allowed as a symmetry, then any arrangement obtained by a rotation of 90, 180, or 270 degrees is considered to be "the same" as the original pattern, even though these arrangements are counted separately in the original problem where the board is fixed. For such problems, Dudeney observes: "How many ways there are if mere reversals and reflections are not counted as different has not yet been determined; it is a difficult problem." The problem reduces to that of counting symmetric arrangements via Burnside's lemma.
- John Riordan, An Introduction to Combinatorial Analysis, Princeton University Press, 1980 (originally published by John Wiley and Sons, New York; Chapman and Hall, London, 1958) ISBN 978-0-691-02365-6 (reprinted again in 2002, by Dover Publications). See chapters 7 & 8.
- Ole J. Heilmann and Elliott H. Lieb, Theory of monomer-dimer systems. Communications in Mathematical Physics, Vol. 25 (1972), pp. 190–232.
- Dudeney, Henry E. Amusements In Mathematics. 1917. Nelson. (republished by Plain Label Books: ISBN 1-60303-152-9, also as a collection of newspaper clippings, Dover Publications, 1958; Kessinger Publishing, 2006). The book can be freely downloaded from Project Gutenberg site 
- Dudeney, Problem 295
- Vilenkin, Naum Ya. Combinatorics (Kombinatorika). 1969. Nauka Publishers, Moscow (In Russian).
- Vilenkin, Naum Ya. Popular Combinatorics (Populyarnaya kombinatorika). 1975. Nauka Publishers, Moscow (In Russian).
- Gik, Evgeny Ya. Mathematics on the Chessboard (Matematika na shakhmatnoy doske). 1976. Nauka Publishers, Moscow (In Russian).
- Gik, Evgeny Ya. Chess and Mathematics (Shakhmaty i matematika). 1983. Nauka Publishers, Moscow (In Russian). ISBN 3-87144-987-3 (GVK-Gemeinsamer Verbundkatalog)
- Kokhas', Konstantin P. Rook Numbers and Polynomials (Ladeynye chisla i mnogochleny). MCNMO, Moscow, 2003 (in Russian). ISBN 5-94057-114-X www
.mccme .ru /free-books /mmmf-lectures /book .26 .pdf (GVK-Gemeinsamer Verbundkatalog)
- Dudeney, Answer to Problem 295