The Mathematica Journal A Generator of Rook Polynomials

Similar documents
Chapter 3 PRINCIPLE OF INCLUSION AND EXCLUSION

The Classification of Quadratic Rook Polynomials of a Generalized Three Dimensional Board

Staircase Rook Polynomials and Cayley s Game of Mousetrap

European Journal of Combinatorics. Staircase rook polynomials and Cayley s game of Mousetrap

132-avoiding Two-stack Sortable Permutations, Fibonacci Numbers, and Pell Numbers

A theorem on the cores of partitions

A Group-theoretic Approach to Human Solving Strategies in Sudoku

Graphs of Tilings. Patrick Callahan, University of California Office of the President, Oakland, CA

Combinatorics. PIE and Binomial Coefficients. Misha Lavrov. ARML Practice 10/20/2013

NEGATIVE FOUR CORNER MAGIC SQUARES OF ORDER SIX WITH a BETWEEN 1 AND 5

Slicing a Puzzle and Finding the Hidden Pieces

Week 1. 1 What Is Combinatorics?

arxiv: v1 [math.co] 24 Nov 2018

If a word starts with a vowel, add yay on to the end of the word, e.g. engineering becomes engineeringyay

Corners in Tree Like Tableaux

Latin Squares for Elementary and Middle Grades

Chapter 6.1. Cycles in Permutations

Math 3338: Probability (Fall 2006)

Olympiad Combinatorics. Pranav A. Sriram

Reflections on the N + k Queens Problem

Tiling Problems. This document supersedes the earlier notes posted about the tiling problem. 1 An Undecidable Problem about Tilings of the Plane

Dyck paths, standard Young tableaux, and pattern avoiding permutations

The number of mates of latin squares of sizes 7 and 8

Investigation of Algorithmic Solutions of Sudoku Puzzles

EC O4 403 DIGITAL ELECTRONICS

CURS Nazanin Afshari Sep. 25, Alge Tiles

m-partition Boards and Poly-Stirling Numbers

MAT3707. Tutorial letter 202/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/202/1/2017


Stacking Blocks and Counting Permutations

Twenty-fourth Annual UNC Math Contest Final Round Solutions Jan 2016 [(3!)!] 4

Automatic Enumeration and Random Generation for pattern-avoiding Permutation Classes

How Many Mates Can a Latin Square Have?

Non-Attacking Bishop and King Positions on Regular and Cylindrical Chessboards

Mathematics Competition Practice Session 6. Hagerstown Community College: STEM Club November 20, :00 pm - 1:00 pm STC-170

Modular arithmetic Math 2320

Senior Math Circles February 10, 2010 Game Theory II

Activity Sheet #1 Presentation #617, Annin/Aguayo,

BMT 2018 Combinatorics Test Solutions March 18, 2018

MAT 409 Semester Exam: 80 points

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal.

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

International Journal of Combinatorial Optimization Problems and Informatics. E-ISSN:

Math 3012 Applied Combinatorics Lecture 2

arxiv: v1 [math.co] 24 Oct 2018

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

An Elementary Solution to the Ménage Problem

CS431 homework 2. 8 June Question 1 (page 54, problem 2.3). Is lg n = O(n)? Is lg n = Ω(n)? Is lg n = Θ(n)?

Pattern Avoidance in Unimodal and V-unimodal Permutations

Counting in Algorithms

THE TAYLOR EXPANSIONS OF tan x AND sec x

Econ 172A - Slides from Lecture 18

YGB #2: Aren t You a Square?

Closed Almost Knight s Tours on 2D and 3D Chessboards

Permutation Tableaux and the Dashed Permutation Pattern 32 1

Wythoff s Game. Kimberly Hirschfeld-Cotton Oshkosh, Nebraska

THE ENUMERATION OF PERMUTATIONS SORTABLE BY POP STACKS IN PARALLEL

Principle of Inclusion-Exclusion Notes

arxiv: v2 [cs.cc] 18 Mar 2013

EXPLAINING THE SHAPE OF RSK

Mathematics of Magic Squares and Sudoku

A CLASSIFICATION OF QUADRATIC ROOK POLYNOMIALS

LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE

IF ONE OR MORE of the antennas in a wireless communication

THE ASSOCIATION OF MATHEMATICS TEACHERS OF NEW JERSEY 2018 ANNUAL WINTER CONFERENCE FOSTERING GROWTH MINDSETS IN EVERY MATH CLASSROOM

An Algorithm for Packing Squares

Collectives Pattern CS 472 Concurrent & Parallel Programming University of Evansville

On uniquely k-determined permutations

Learning objective Various Methods for finding initial solution to a transportation problem

JIGSAW ACTIVITY, TASK # Make sure your answer in written in the correct order. Highest powers of x should come first, down to the lowest powers.

Conway s Soldiers. Jasper Taylor

Design and Analysis of Row Bypass Multiplier using various logic Full Adders

Fast Sorting and Pattern-Avoiding Permutations

Tilings with T and Skew Tetrominoes

Problem 2A Consider 101 natural numbers not exceeding 200. Prove that at least one of them is divisible by another one.

Chapter 7. Intro to Counting

Bounds for Cut-and-Paste Sorting of Permutations

Perfect Domination for Bishops, Kings and Rooks Graphs On Square Chessboard

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems

NON-OVERLAPPING PERMUTATION PATTERNS. To Doron Zeilberger, for his Sixtieth Birthday

Easy Games and Hard Games

Lecture 20: Combinatorial Search (1997) Steven Skiena. skiena

Note to Teacher. Description of the investigation. Time Required. Materials. Procedures for Wheel Size Matters TEACHER. LESSONS WHEEL SIZE / Overview

The Problem. Tom Davis December 19, 2016

A STUDY OF EULERIAN NUMBERS FOR PERMUTATIONS IN THE ALTERNATING GROUP

CPCS 222 Discrete Structures I Counting

Progress in Computer Science No.4. Edited by J.Bendey E. Coffman R.L.Graham D. Kuck N. Pippenger. Springer Science+Business Media, LLC

The Mathematics Behind Sudoku Laura Olliverrie Based off research by Bertram Felgenhauer, Ed Russel and Frazer Jarvis. Abstract

Counting Permutations with Even Valleys and Odd Peaks

A NUMBER THEORY APPROACH TO PROBLEM REPRESENTATION AND SOLUTION

A Covering System with Minimum Modulus 42

The Tilings of Deficient Squares by Ribbon L-Tetrominoes Are Diagonally Cracked

Automatically Generating Puzzle Problems with Varying Complexity

A GRAPH THEORETICAL APPROACH TO SOLVING SCRAMBLE SQUARES PUZZLES. 1. Introduction

CONDITIONAL PROBABILITY

The Role of Combinatorics in Hearthstone

Teaching Mechanical Design Failure Theories with Use of CAD

You ve seen them played in coffee shops, on planes, and

Permutation Generation Method on Evaluating Determinant of Matrices

Removing the Fear of Fractions from Your Students Thursday, April 16, 2015: 9:30 AM-10:30 AM 157 A (BCEC) Lead Speaker: Joseph C.

Transcription:

The Mathematica Journal A Generator of Rook Polynomials Daniel C. Fielder A list adaptation of an inclusion-exclusion method for calculating the rook polynomials of arbitrary finite chessboards is discussed and presented. General On a chessboard of any configuration, a rook is nontaking if the cell it occupies is not in the same row or column as the cell of any other rook. A rook polynomial is an ordinary generating function in which the coefficient of x k (k = 0, 1, 2, ) is the number of ways k nontaking rooks can be distributed on a finite board. Rook polynomials have many applications in combinatorics, especially in counting restricted permutations. A chessboard can be described mathematically as an ordered set of its cells unique (row, column) pairs. A chessboard need not be rectangular. The algorithm for finding rook polynomials discussed in this article is an adaptation of a well-known inclusion-exclusion method, typically described by Riordan [1, 168 170] and Liu [2, 111 118]. This method selects any cell of the board as a special cell. As Liu observes, the number of ways k nontaking rooks on the original chessboard C is the number of ways with a rook always included in the special cell plus the number of ways with all rooks excluded from the special cell. The board C i is found by crossing out the row and column of the special cell. The contribution of the rook polynomial from C i must be multiplied by x to account for the loss of the cell along with its row and column. The board C e is found by eliminating the special cell completely. Hence, C = x C i + C e forms an interesting equation in x, with chessboards as coefficients. Continued reductions of C i and C e and their successor boards yield nested sets of x s from which the rook polynomial of board C emerges. When working by hand, recognition of the rook polynomials of intermediate boards often shortens this search a luxury usually not afforded in a computer reduction. A By Hand Example This small example provides a convenient comparison to the computer algorithm adaptation later. Consider the following chessboard of four cells and (arbitrarily)

372 Daniel C. Fielder make 1, 1 the special cell at the start. The choice of intermediate special cells is obvious. The following reduction leads to the unique rook polynomial, 1 + 4 x + 3 x 2. 1, 1 2, 1 2, 2 3, 2 = x 2, 2 3, 2 2, 1 2, 2 + 3, 2 = x Ix + 3, 2 M + i 2, 2 y jx 3, 2 + k 3, 2 z = { x 2 + 2 x 3, 2 + Ix + 3, 2 M = x 2 + x + H2 x + 1L 3, 2 = x 2 + x + H2 x + 1L Hx + 1L = x 2 + x + 2 x + 2 x 2 + 1 + x = 1 + 4 x + 3 x 2 The steps taken use algebraic combination and the knowledge that the rook polynomials of the empty chessboard and a single cell (in this case 3, 2 ) are 1 and 1 + x. A List Example In this example, the computer algorithm for finding rook polynomials is an orderly list adaptation of the by hand example. First, initiate a horizontal stack with the list of the chessboard s (row, column) cells on the initial top of the stack. (In the implementation the top will be the first element of the list stacklist.) From data in the top of the stack, generate a list of cells of the first exclusive type board and append it to the bottom of the stack. (In the implementation the bottom will be put farthest to the right). Next, compare the (row, column) pattern information of the first cell of the top with the patterns of the remaining top cells to obtain the cell information for the first inclusive type list. The x multiplier has the same functional weight as a (row, column) cell in the inclusive list and is added on the right to complete the inclusive list. The inclusive list is appended to the right of the exclusive list and is now at the bottom of the stack. Here is the result of applying the process to the first top, which is the first element in this list. 8881, 1<, 82, 1<, 82, 2<, 83, 2<<, 882, 1<, 82, 2<, 83, 2<<, < In the following table this will look like a stack. 881, 1<, 82, 1<, 82, 2<, 83, 2<< 882, 1<, 82, 2<, 83, 2<< The top of the stack has served its purpose and is discarded. The lists can be envisioned as propagating up with each removal of a used top (or to the left in the list implementation). The general philosophy is to repeat the generation and removal of new tops until the stack consists only of x entries and a single 1. The single 1 is derived from the exclusive reduction of a single cell (see [2, 113] and the earlier use of 3, 2 = 1 + x).

A Generator of Rook Polynomials 373 The following tabulation shows the progress of the algorithm through the 17 successive stack values. 1 881, 1<, 82, 1<, 82, 2<, 83, 2<< 2 881, 1<, 82, 1<, 82, 2<, 83, 2<< 882, 1<, 82, 2<, 83, 2<< 4 882, 1<, 82, 2<, 83, 2<< 5 7 8 10 11 13 14 16 17 881<< 881<< 3 882, 1<, 82, 2<, 83, 2<< 6 9 12 15 881<<

374 Daniel C. Fielder The stacks 1, 3, 5, 7, 9, 11, 14, and 17 are stable stack configurations, while the others are stacks in transition. In particular, when top lists consist solely of x s (as in stacks 13 and 16), those lists are transferred to the bottom of the stack before normal stack operation resumes. The algebraic interpretation of the final stack is to multiply along the rows and add up the column, ignoring the list structure. {{1}} is interpreted as 1. Under these conditions, the program will convert stack 17 to the rook polynomial, 1 + 4 x + 3 x 2. Code and Program Details Here is the program for converting a list of nonrepeating (row, column) chessboard cells to a rook polynomial and its application to our small example. In[2]:= RookPolynomial@n_ListD := Module@8stacklist, top, SameColumnValues, SameRowValues, EntriesToEliminate, InclusionList, ExclusionList<, stacklist = 8Union@nD<; While@Union@Flatten@stacklistDD =!= 81, x<, top = First@stacklistD; SameColumnValues = Position@top, 8_, top@@1, 2DD<D; SameRowValues = Position@top, 8top@@1, 1DD, _<D; EntriesToEliminate = Union@SameColumnValues, SameRowValuesD; InclusionList = Append@Delete@top, EntriesToEliminateD, 8x<D; ExclusionList = Delete@top, 1D; If@Length@ExclusionListD == 0, ExclusionList = 881<<D; stacklist = Delete@ Append@Append@stacklist, ExclusionListD, InclusionListD, 1D; While@Union@Flatten@First@stacklistDDD == 8x<, stacklist = RotateLeft@stacklistDDD; Total@Apply@Times, stacklist, 2DDD In[3]:= RookPolynomial@882, 2<, 83, 2<, 83, 3<, 84, 3<<D Out[3]= 1 + 4 x + 3 x 2 When stacklist reaches {{{1}},{{x},...,{x}}} under While loop control, stacklist has reached its correct, final value. This is the only value that yields the rook polynomial directly. Also, Union[Flatten[stacklist]] equals {1,x} only for the final stacklist value. SameColumnValues uses the pattern properties of the Position command to obtain a list of positions from the top of the stack that have the same column values as the leading (row, column) entry at the top of the stack list. SameRowValÖ ues does the same for the row values. Their Union gives the list of (row, column) EntriesToEliminate in forming the next inclusion chessboard, which is completed by appending x. The exclusion chessboard list is completed by deleting the first term from the top of the stack. After that, the inclusion and exclusion chessboard strings are appended to the bottom of the stack before the old top of the stack is discarded.

A Generator of Rook Polynomials 375 The lists move up (actually over to the left) and the next list becomes the new top of the stack. If not prevented, the program will try to process any stack tops that have leading x s. Accordingly, the top of a stack list consisting entirely of x s is moved to the bottom of the stack in the last While loop. When stacklist eventually meets the condition for shutting down the main While loop, the Apply line converts stacklist to the rook polynomial. In this manner, RookPolynomial[{{row,column},...,{row,column}}] can be determined for any connected chessboard. References [1] J. Riordan, An Introduction to Combinatorial Analysis, New York: Wiley, 1958. [2] C. Liu, Introduction to Combinatorial Mathematics, New York: McGraw-Hill, 1968. About the Author Daniel C. Fielder received a Ph.D. in electrical engineering from Georgia Institute of Technology in 1957. Except for a year of teaching at Syracuse University and a summer visiting professorship at Westinghouse Research Labs, he taught continuously and performed research on discrete math applications at Georgia Tech since 1948. He was a Life Fellow of IEEE. Dr. Fielder retired in 1988 as professor emeritus, but continued to teach until the time of his death in October 2003. During WWII, he designed ship degaussing systems at the Bureau of Ships under (then) Lt. Cmdr. Hyman G. Rickover, who later founded the U.S. nuclear navy. Daniel C. Fielder School of Electrical and Computer Engineering Georgia Institute of Technology Atlanta, GA 30332-0250