On this page
Non-attacking rooks never share a row or column, which is exactly the rule a permutation follows: each position gets one value, used once. The term "rook polynomial" was coined by John Riordan (Wikipedia), and he and Irving Kaplansky wrote an early paper on the subject, "The problem of the rooks and its applications", in the Duke Mathematical Journal in 1946.
What is a rook polynomial?
A board B is any set of cells from a grid. The rook polynomial R(B) = r_0 + r_1·x + r_2·x² + … has as its coefficient of x^k the number of ways to place k non-attacking rooks on B (MathWorld). r_0 is always 1, and r_1 is the number of cells.
The full 2×2 board has rook polynomial 1 + 4x + 2x²: one empty placement, four single rooks, and two diagonals (MathWorld).
If a board splits into pieces that share no row or column, its rook polynomial is the product of the pieces' polynomials (University of Minnesota Duluth notes).
How does the expansion rule work?
Pick any cell s. Either s is empty, or it holds a rook and no other rook may use its row or column. The same Minnesota Duluth notes state it as:
**R(B) = R(B − s) + x·R(B*)**, where B − s is the board without s, and B* is the board with the row and column of s removed. The x counts the rook on s.
First worked example: the full 2×2 board.
Take s as the top-left cell.
B − s is an L of three cells. Expand it on its corner: deleting it leaves two independent cells, (1 + x)² = 1 + 2x + x²; a rook on it leaves nothing, giving x. So the L has 1 + 3x + x².
B* is the single bottom-right cell: 1 + x.
R(B) = (1 + 3x + x²) + x(1 + x) = 1 + 4x + 2x², matching the direct count.
Second worked example: an L-shaped board of five cells, the top row and the left column of a 3×3 grid.
Choose s as the corner, which attacks every other cell.
B − s splits into two arms of two cells that share no row or column: (1 + 2x)² = 1 + 4x + 4x².
B* is empty, so R(B*) = 1.
R(B) = 1 + 4x + 4x² + x = 1 + 5x + 4x².
Check: five cells give r_1 = 5, and each cell of one arm pairs with each of the other, so r_2 = 4.
How do rook polynomials count restricted permutations?
Put positions on the rows of an n×n grid and values on the columns, then shade the forbidden cells. The Minnesota Duluth notes prove by inclusion-exclusion that the permutations avoiding every shaded cell number n! − r_1(n − 1)! + r_2(n − 2)! − … + (−1)^n r_n·0!, with r_k the rook numbers of the forbidden board.
For derangements the forbidden board is the diagonal (Wikipedia). For n = 3 its three cells share no rows or columns, so its polynomial is (1 + x)³ = 1 + 3x + 3x² + x³, and the count is 3! − 3·2! + 3·1! − 1·0! = 2.
A full placement of n rooks is a matching of rows to columns, so Hall's marriage theorem tells you when one exists, and counting with a bijection shows the same idea from another side.
What is the ménage problem, and how do rooks solve it?
The ménage problem asks how many ways n couples can sit at a round table, alternating men and women, with no one beside their partner; Édouard Lucas formulated it in 1891 and Jacques Touchard derived a formula in 1934 (Wikipedia).
Seat the women first. Each man may not take either seat beside his partner, which forbids the diagonal, the cells just above it, and one corner cell (Wikipedia).
For n = 4 that board has 8 cells, two per row and column. Counting directly: r_1 = 8; r_2 = 28 pairs minus 8 that share a line = 20; r_3 = 16; r_4 = 2. So 24 − 8·6 + 20·2 − 16·1 + 2·1 = 2.
That matches the ménage number for n = 4 in OEIS A000179, whose terms from n = 3 run 1, 2, 13, 80. The entry gives the full seating count as 2·n!·a(n), which is 96 for four couples.
A four-step plan for exam problems
Draw the n×n grid and shade the forbidden cells.
Reorder rows and columns so shaded cells form blocks sharing no row or column; multiply their polynomials.
Expand any tangled block on its busiest cell.
Put the rook numbers into the alternating sum, and check that r_1 equals the number of shaded cells.
For another recurrence built as a table, see Stirling numbers of the second kind. To revise inclusion-exclusion, the Fermi Concept Library covers every concept in mathematics, and the Fermi Problem Library has a step-by-step solver that explains the reasoning when your count comes out wrong.



