Lecture 6: Latin Squares and the n-queens Problem

Similar documents
N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February

Solutions to Exercises Chapter 6: Latin squares and SDRs

MATHEMATICS ON THE CHESSBOARD

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015

LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE

Which Rectangular Chessboards Have a Bishop s Tour?

Asymptotic Results for the Queen Packing Problem

Senior Math Circles February 10, 2010 Game Theory II

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

Taking Sudoku Seriously

Notes on 4-coloring the 17 by 17 grid

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

arxiv: v1 [math.co] 24 Nov 2018

How Many Mates Can a Latin Square Have?

Constructing pandiagonal magic squares of arbitrarily large size

Sudoku an alternative history

Notes for Recitation 3

A year ago I investigated a mathematical problem relating to Latin squares. Most people, whether knowing it or not, have actually seen a Latin square

Lecture 1, CS 2050, Intro Discrete Math for Computer Science

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

Latin squares and related combinatorial designs. Leonard Soicher Queen Mary, University of London July 2013

An Exploration of the Minimum Clue Sudoku Problem

GEOGRAPHY PLAYED ON AN N-CYCLE TIMES A 4-CYCLE

Edge-disjoint tree representation of three tree degree sequences

12th Bay Area Mathematical Olympiad

arxiv: v2 [math.ho] 23 Aug 2018

arxiv: v2 [math.gt] 21 Mar 2018

Week 1. 1 What Is Combinatorics?

18.204: CHIP FIRING GAMES

Odd king tours on even chessboards

Ivan Guo. Broken bridges There are thirteen bridges connecting the banks of River Pluvia and its six piers, as shown in the diagram below:

Tile Number and Space-Efficient Knot Mosaics

Lecture 18 - Counting

Latin Squares for Elementary and Middle Grades

Lower Bounds for the Number of Bends in Three-Dimensional Orthogonal Graph Drawings

Reflections on the N + k Queens Problem

Chapter 1. The alternating groups. 1.1 Introduction. 1.2 Permutations

Using KenKen to Build Reasoning Skills 1

MAGIC SQUARES KATIE HAYMAKER

14th Bay Area Mathematical Olympiad. BAMO Exam. February 28, Problems with Solutions

Final exam. Question Points Score. Total: 150

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

Kenken For Teachers. Tom Davis January 8, Abstract

Math236 Discrete Maths with Applications

Determinants, Part 1

arxiv: v1 [math.co] 24 Oct 2018

Section 2.1 Factors and Multiples

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

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

Symmetric Permutations Avoiding Two Patterns

Logic Masters India Presents. April 14 16, 2012 April 2012 Monthly Sudoku Test INSTRUCTION BOOKLET

0:00:07.150,0:00: :00:08.880,0:00: this is common core state standards support video in mathematics

PARITY, SYMMETRY, AND FUN PROBLEMS 1. April 16, 2017

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

TILLING A DEFICIENT RECTANGLE WITH T-TETROMINOES. 1. Introduction

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

Intriguing Problems for Students in a Proofs Class

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.

Twenty-sixth Annual UNC Math Contest First Round Fall, 2017

Staircase Rook Polynomials and Cayley s Game of Mousetrap

SOLITAIRE CLOBBER AS AN OPTIMIZATION PROBLEM ON WORDS

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

Permutation Groups. Definition and Notation

The patterns considered here are black and white and represented by a rectangular grid of cells. Here is a typical pattern: [Redundant]

CSE 573 Problem Set 1. Answers on 10/17/08

Modular Arithmetic. Kieran Cooney - February 18, 2016

Permutation Groups. Every permutation can be written as a product of disjoint cycles. This factorization is unique up to the order of the factors.

Static Mastermind. Wayne Goddard Department of Computer Science University of Natal, Durban. Abstract

FOR THE CONSTRUCTION OF SAMAGARBHA AND VIṢAMA MAGIC SQUARES

Constructions of Coverings of the Integers: Exploring an Erdős Problem

Math 127: Equivalence Relations

Minimal tilings of a unit square

Canadian Mathematics Competition An activity of The Centre for Education in Mathematics and Computing, University of Waterloo, Waterloo, Ontario

Counting Things. Tom Davis March 17, 2006

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

UK JUNIOR MATHEMATICAL CHALLENGE. April 25th 2013 EXTENDED SOLUTIONS

ACM ICPC World Finals Warmup 2 At UVa Online Judge. 7 th May 2011 You get 14 Pages 10 Problems & 300 Minutes

POKER (AN INTRODUCTION TO COUNTING)

Combinatorial Proofs

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

Analyzing Games: Solutions

CSCI3390-Lecture 8: Undecidability of a special case of the tiling problem

Ideas beyond Number. Teacher s guide to Activity worksheets

NIM Games: Handout 1

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Algorithms and Game Theory Date: 12/4/14

a b c d e f g h i j k l m n

MULTIPLES, FACTORS AND POWERS

1st UKPA Sudoku Championship

completing Magic Squares

Fast Sorting and Pattern-Avoiding Permutations

1.6 Congruence Modulo m

Pattern Avoidance in Unimodal and V-unimodal Permutations

Sequential Dynamical System Game of Life

Diagonal Vision LMI March Sudoku Test

MAT Modular arithmetic and number theory. Modular arithmetic

ECON 2100 Principles of Microeconomics (Summer 2016) Game Theory and Oligopoly

Crossing Game Strategies

UK JUNIOR MATHEMATICAL CHALLENGE. April 26th 2012


Transcription:

Latin Squares Instructor: Padraic Bartlett Lecture 6: Latin Squares and the n-queens Problem Week 3 Mathcamp 01 In our last lecture, we introduced the idea of a diagonal Latin square to help us study magic squares As it turns out, this idea of a diagonal Latin square is useful for more than just magic squares; we can use a similar and stronger concept to study the n-queens problem, a classical question from chess and mathematics that we discuss in this lecture 1 The n-queens Problem If you haven t played chess, here s a quick summary of the things you will need to understand for this lecture: A n n chessboard is simply a n n array of cells A queen in the game of chess is a piece, shaped like In the game of chess, when moved, a queen (when placed in a given cell in a chessboard) can go to any cell within the same row, any cell within the same column, or any cell along the two diagonals through the cell that it starts from We illustrate this here: Given this terminology, we can now state the n-queens problem, which is the following: Question Take a n n chessboard Can you place n distinct queens on this chessboard, so that no queen can capture any other (ie so that there is no way to move any one queen into a cell currently occupied by another queen?) Again, like last time, we can decide whether or not this problem is doable for small values of n by just trying to do it for small values For n = 1, this is pretty trivial to do: behold! 1

For n =, it s also pretty easy to see that this is impossible Any one queen in a board can move to any other square; therefore, it is impossible to place a second queen into our grid For n = 3, it s also not too hard to see that this is impossible When you place a on a 3 3 board, it either goes on in the center (in which case it can move to any other square) or one of the side/corner squares, in which case there are precisely two squares to which it cannot move Any second queen placed in either of those spaces can move to the other space; therefore, we cannot place a third queen,, For n = 4, however, we can do it! Consider the following arrangement: The above pattern you can find by just exhaustively searching through possible ways to place queens on a 4 4 chessboard In general, however, we want a systematic approach; ie a pattern that we can follow to always solve the n-queens problem, or tell us that no such solution exists Surprisingly enough, it turns out that we already have a solution! Well, at least, for infinitely many values of n Consider the following definition: Definition A broken right diagonal, or wraparound right diagonal, in a Latin square L is the set of n cells acquired by starting from one of the cells in our top row and repeatedly taking the cell that s one below and one to the right of this cell, wrapping around our square if we hit the last column, until we get to the last row A broken left diagonal is the same kind of object, except wrapping around to the left instead of the right Given these definitions, a Latin square L is called pandiagonal (alternately, diabolic, or perfect, depending on the author) if every broken diagonal contains no repeated symbols

Pandiagonal Latin squares should feel like a much stronger version of the diagonal Latin squares we studied earlier; as opposed to just requiring that the main diagonal and antidiagonal contain no repeats, we now require every diagonal, including the broken ones, to not have any repeats The reason we care about these is the following observation: Proposition Suppose that L is a n n pandiagonal Latin square Choose any symbol s occuring in L Take a n n chessboard, and place a queen on every cell containing s Then this is a solution to the n-queens problem Proof Because L is pandiagonal, there are no repeated symbols s in any row, column, or broken diagonal: therefore, in particular, if we place a queen at every cell containing a symbol s, none of these queens can move to a cell containing another queen So: we care about pandiagonal Latin squares! The next natural question we could ask is whether these even exist; but, as it turns out, we already constructed a ton of these yesterday! Recall the following construction: Construction Take any value of n, and any two numbers a, b {0, n 1} Consider the following square populated with the elements {0, 1 n 1}: L = 0 a a 3a (n 1)a b b + a b + a b + 3a b + (n 1)a b b + a (b + a) b + 3a b + (n 1)a 3b 3b + a 3b + a 3(b + a) 3b + (n 1)a (n 1)b (n 1)b + a (n 1)b + a (n 1)b + 3a (n 1)(b + a) In other words, L s (i, j)-th cell contains the symbol given by taking the quantity ai + bj Yesterday, we showed that this was a diagonal Latin square whenever a, b, a + b, a b were relatively prime to n However, we actually have much more! Consider any broken right diagonal If we re careful with how we write it, we can see that it s actually of the form ka + (n k)(a + b) ka ka + (a + b) ka + (n k 1)(a + b) ka + (n 1)(a + b) Therefore, all of these entries are distinct if a + b is relatively prime to n Similarly, all of the entries in any broken left diagonal are also distinct if a b is relatively prime to n; 3

therefore, our construction from before actually creates not just diagonal Latin squares, but pandiagonal Latin squares! We can use such a grid to solve the 5-queens problem: 0 4 1 3 1 3 0 4 4 1 3 0 3 0 4 1 4 1 3 0 However, this construction only worked when n was neither even nor a multiple of 3 Consequently, we initially would want to try to extend our construction to these cases; either by trying to modify our construction to somehow work on even values of n, or just by trying new constructions that maybe would become pandiagonal Latin squares After a while of this, we d probably get frustrated As mathematicians, the most fun thing to do when you re frustrated with proving something is to turn around and prove that it s impossible! Let s do that: Claim 1 No pandiagonal Latin squares exist of even order We prove this claim via the following observations and definitions: Definition A transversal in a Latin square is a way to pick out n cells so that every row, column, and symbol is represented by exactly one cell An example is highlighted below: 1 3 4 4 1 3 4 3 1 3 1 4 Lemma If a Latin square L has an orthogonal mate, its cells can be broken up into n disjoint transversals Proof Take L and its orthogonal mate M Given any symbol k occuring in M, look at all of the cells containing k in M These cells in L cannot contain any repeated symbols, because L and M are orthogonal; furthermore, because M is a Latin square, they do not repeat any rows or columns Therefore, each symbol used in k corresponds to a different transversal of L, and we ve proven our claim Lemma 3 The circulant Latin square M = 0 1 n 1 1 0 n 1 0 n does not have any transversals, if n is even 4

Proof Suppose that we had a transversal of M Label its cells {(a i, b i )} ; by construction, we know that the symbol contained within any cell (a i, b i ) is a i + b i Then, on one hand, because this is a transversal, we know that every symbol occurs exactly once in our transversal, and therefore that (a i + b i ) i n(n 1) n n n n, where we used the fact that n is even to justify pulling the n out of the n term In particuar, we know that this sum is not zero However, if we look at our sum another way, we can instead think of it as the sum of all of the rows and all of the columns: ( ) ( ) (a i + b i ) a i + b i ( ) i + ( ) i n(n 1) n(n 1) + n(n 1) 0 This is a contradiction! Therefore, no such transversal can exist Given this observation, we can now prove our claim from earlier: Proposition No pandiagonal Latin squares exist of even order Proof Suppose that we had a pandiagonal Latin square L of even order Consider the circulant Latin square M = 0 1 n 1 1 0 n 1 0 n We claim that M and L are orthogonal To see this, simply notice that the broken left diagonals of M are just the same symbol repeated, while (by definition) the broken left diagonals of L contain every symbol exactly once Therefore, when these two squares are superimposed, we will see every pair occur exactly once: to see any given pair, just pick 5

the M-coordinate you re looking for, go to the broken diagonal that contains all of M s instances of that symbol, and search through the corresponding broken diagonal in L until you find the right L-coordinate But this is impossible, because L has no transversal while any square with an orthogonal mate contains a transversal, as we proved with our lemmas Therefore, we cannot have a pandiagonal Latin square of order L This settles the case for even-order pandiagonal Latin squares The only other case where we haven t either constructed a pandiagonal Latin square or shown they re impossible is when n is a multiple of 3: on your HW, there are a pair of questions that walk you through the proof that there is in fact no pandiagonal Latin square with order divisible by 3 Latin Squares Homework 6: Latin Squares and Chess Instructor: Padraic Bartlett Week 3 Mathcamp 01 Attempt all of the problems that seem interesting, and let me know if you see any typos! (+) problems are harder than the others (++) problems are currently open 1 Construct a pandiagonal Latin square of order 7, and use it to solve the 7-queens problem While in class we said that pandiagonal Latin squares exist only when n is neither divisible by or 3, it turns out that solutions to the n-queens problem exist for every value of n 4 Using symmetry arguments, how many solutions can you find for n = 5? How about n = 6? (Hint: if you ve done this problem correctly, there should be more solutions for n = 5 than n = 6 This is the only pair of numbers where this happens; in general, as n increases, the number of solutions to the n-queens problem grows exponentially, though it is an open question to how fast this exponential growth precisely is) 3 Prove the claim we made in class, that there are no pandiagonal Latin squares with order divisible by 3 Do this via the following outline: (a) A superdiagonal of a n n grid is a collection of n cells within this grid that contains exactly one representative from each row and column, as well as exacty one representative from each broken left diagonal and exactly one representative from each broken right diagonal Show that a pandiagonal Latin square of order n exists if and only if it is possible to break the cells of a n n grid up into n disjoint superdiagonals (b) Show that a n n array cannot have a superdiagonal if n is a multiple of or 3 6