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

Similar documents
T H E M A T H O F S U D O K U

of Nebraska - Lincoln

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

arxiv: v2 [math.ho] 23 Aug 2018

Taking Sudoku Seriously

A Group-theoretic Approach to Human Solving Strategies in Sudoku

Zsombor Sárosdi THE MATHEMATICS OF SUDOKU

The remarkably popular puzzle demonstrates man versus machine, backtraking and recursion, and the mathematics of symmetry.

Sudoku. How to become a Sudoku Ninja: Tips, Tricks and Strategies

Some results on Su Doku

DEVELOPING LOGICAL SKILLS WITH THE HELP OF SUDOKU. Radost Nicolaeva-Cohen, Andreea Timiras, Adrian Buciu, Emil Robert Rudi Wimmer

Sudoku Squares as Experimental Designs

Latin Squares for Elementary and Middle Grades

Research Article The Structure of Reduced Sudoku Grids and the Sudoku Symmetry Group

Sudoku an alternative history

YORK College of Staten Island Department of Mathematics

Comparing Methods for Solving Kuromasu Puzzles

Mobile SuDoKu Harvesting App

Enumerating 3D-Sudoku Solutions over Cubic Prefractal Objects

Applications of Advanced Mathematics (C4) Paper B: Comprehension INSERT WEDNESDAY 21 MAY 2008 Time:Upto1hour

Sudoku: Is it Mathematics?

Applications of Advanced Mathematics (C4) Paper B: Comprehension WEDNESDAY 21 MAY 2008 Time:Upto1hour

SUDOKU Colorings of the Hexagonal Bipyramid Fractal

The mathematics of Septoku

An Exploration of the Minimum Clue Sudoku Problem

ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand

It Stands to Reason: Developing Inductive and Deductive Habits of Mind

Yet Another Organized Move towards Solving Sudoku Puzzle

OR II Project Definition

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

SUDOKU X. Samples Document. by Andrew Stuart. Moderate

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

Three of these grids share a property that the other three do not. Can you find such a property? + mod

Using KenKen to Build Reasoning Skills 1

Techniques for Generating Sudoku Instances

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

Slicing a Puzzle and Finding the Hidden Pieces

Investigation of Algorithmic Solutions of Sudoku Puzzles

Kenken For Teachers. Tom Davis January 8, Abstract

Taking the Mystery Out of Sudoku Difficulty: An Oracular Model

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

Sudoku Mock Test 5. Instruction Booklet. 28 th December, IST (GMT ) 975 points + Time Bonus. Organized by. Logic Masters: India

ON 4-DIMENSIONAL CUBE AND SUDOKU

MthSc 103 Test #1 Spring 2011 Version A JIT , 1.8, , , , 8.1, 11.1 ANSWER KEY AND CUID: GRADING GUIDELINES

Take Control of Sudoku

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

MAGIC SQUARES KATIE HAYMAKER

Physical Zero-Knowledge Proof: From Sudoku to Nonogram

Welcome to the Sudoku and Kakuro Help File.

28,800 Extremely Magic 5 5 Squares Arthur Holshouser. Harold Reiter.

Python for education: the exact cover problem

A JIGSAW SUDOKU GENERATOR AND SOLVER

isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris

Spring 06 Assignment 2: Constraint Satisfaction Problems

Overview. Initial Screen

Logic Masters India Presents

Spring 06 Assignment 2: Constraint Satisfaction Problems

WPF SUDOKU/PUZZLE GRAND PRIX 2014 WPF SUDOKU GP 2014 COMPETITION BOOKLET ROUND 4. Puzzle authors: Russia Andrey Bogdanov, Olga Leontieva.

EXTENSION. Magic Sum Formula If a magic square of order n has entries 1, 2, 3,, n 2, then the magic sum MS is given by the formula

Serbian round at Logic Masters India

A B O U T T H E S E P U Z Z L E S

UN DOS TREZ Sudoku Competition. Puzzle Booklet for Preliminary Round. 19-Feb :45PM 75 minutes

expert sudoku C08AF111E38FF93DB6AF118C2DC9B2A6 Expert Sudoku 1 / 6

Solution Algorithm to the Sam Loyd (n 2 1) Puzzle

Round minutes. Best results:

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

Mathematics of Magic Squares and Sudoku

Spiral Galaxies Font

IN THIS ISSUE

Preview Puzzle Instructions U.S. Sudoku Team Qualifying Test September 6, 2015

Beyond Sudoku: Using Puzzles to Develop Students Logical-Thinking Skills. Jeffrey J. Wanko Miami University - Oxford, OH

Indian Sudoku Championship 2015

ON THE ENUMERATION OF MAGIC CUBES*

Sudoku: More Than 200 Fun And Challenging Japanese Number Puzzles By Tammy Seto READ ONLINE

LMI Monthly Test May 2010 Instruction Booklet

SudokuSplashZone. Overview 3

An improved strategy for solving Sudoku by sparse optimization methods

Weighted Polya Theorem. Solitaire

UKPA Presents. March 12 13, 2011 INSTRUCTION BOOKLET.

Wythoff s Game. Kimberly Hirschfeld-Cotton Oshkosh, Nebraska

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

Automatically Generating Puzzle Problems with Varying Complexity

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1

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

Math 3012 Applied Combinatorics Lecture 2

Grade 6 Math Circles March 7/8, Magic and Latin Squares

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

Solving Sudoku Using Artificial Intelligence

On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case

Exploring Concepts with Cubes. A resource book

Daily Sudoku Answers. Daily Sudoku Answers

Grade 7/8 Math Circles. Visual Group Theory

Complete and Incomplete Algorithms for the Queen Graph Coloring Problem

Cracking the Sudoku: A Deterministic Approach

This Report is brought to you by...

1st UKPA Sudoku Championship

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

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

Reflections on the N + k Queens Problem

Solutions to Exercises Chapter 6: Latin squares and SDRs

Transcription:

The Mathematics Behind Sudoku Laura Olliverrie Based off research by Bertram Felgenhauer, Ed Russel and Frazer Jarvis Abstract I will explore the research done by Bertram Felgenhauer, Ed Russel and Frazer Jarvis on the mathematics behind sudoku. Specifically, I dive into their method on enumerating the number of distinct Sudoku grids, the use of computer algorithms to solve puzzles, and the application of abstract algebra and graph theory to enumerate essentially different sudoku grids. Introduction to Sudoku Sudoku is a logic-based number placement-puzzle typically presented on a 9x9 grid (but there are many variations). Numbered puzzles appeared in French newspapers as early as the late 19 th century. Howard Garns is credited with the invention of Sudoku, which was originally named Number Place. The first puzzle appeared in the magazine Dell Pencil Puzzles and Word Games in 1979. Sudoku was introduced in Japan by Nikoli in the 1980s as Sūji wa dokushin ni kagiru and later abbreviated to sudoku which means single number (and is now a registered trademark of a Japanese puzzle publishing company). It first appeared in a US newspaper and The Times in 2004 due in large part to Wayne Gould who created a computer program to rapidly produce distinct puzzles. One Rule To complete a sudoku puzzle, players insert the numbers 1,2,3,4,5,6,7,8,9 into a 9x9 grid (81 cells) subdivided into nine 3x3 blocks in such a way that each column, row, and 3x3 block has exactly one occurrence of each number. A certain amount of numbers is provided (known as givens) on the grid for each player to aid in starting the puzzle. There is no basic arithmetic required in completely a puzzle, but logical deduction can prove to be very useful in solving the puzzle. Sudoku is a fun puzzle game that gained widespread recognition throughout the world. Since the introduction of sudoku in a magazine, anyone can now have a new sudoku puzzle to play at the

snap of a finger. Sudoku puzzles can be found in newspapers, puzzle-based books, and online sudoku games. With so many puzzles readily available for mass consumption, I wanted to investigate the mathematics behind two questions: (1) Approximately how many distinct sudoku grids are there? And (2) How many sudoku grids are essentially different? 4x4 Case Let s begin by exploring the case of a 4x4 grid (Cornell University Department of Mathematics). By learning tricks to enumerate a 4xr grid, we can later use the basis of these ideas to understand Felgenhauer and Jarvis work on enumerating the classic 9x9 grid. To count the number of valid 4x4 sudoku grids (applying the One Rule), we must first begin by filling the top left block in standard form, where the first four cells are filled in consecutive order from 1 to 4. We can quickly realize that there 4! ways to relabel the digits in Block 1, thus there are currently 24 distinct grids for a 4x4 grid. The order in which we can enter 3 & 4 in the first row and 2 & 4 in the first column does not matter since swapping the numbers will preserve the One Rule. Since 1 & 3 occur in the first column of the grid already, 2 & 4 must be placed in the third and fourth cells of that column. Likewise, 3 & 4 must be placed in the third and fourth cells of the first row since 1 & 2 are occupying the first and second cells of row 1. Considering swapping is acceptable, there are 2 ways to order 1 & 2 and 3 & 4 each, so we must account for this in our formula to enumerate the number of distinct cells a 4x4 grid holds. Thus, we have now enumerated 4!*2*2 = 96 distinct grids. We quickly conclude that 4 must be placed in the (3,3) [1] position since the only possibilities are 1 & 4, and 4 occurs in the fourth row, fourth column, and bottom right block already. 1 To signify the position of a number on the grid, I will use a parenthetical notation to represent the rows and cells in a grid. For example, (1,3) will signify the first row of the grid and the third column (row #, column #).

Now, there are 3 possible entries for the cell in the (4,4) position: 1, 2 and 3. To complete the formula for the 4x4 case, we find that there are 4!*2*2*3 = 288 distinct 4x4 sudoku solutions. If we are to fill in the three possible grids from above, placing 1, 2, & 3 in the (4,4) position respectively, we find that the third grid is equivalent to the second grid. By reflection across the diagonal from the upper left to the bottom right and relabeling by interchanging 2 and 3, we find a symmetry between the second and third. Thus, there are 2 essentially different 4x4 Sudoku grids. 9x9 Case I will apply Bertram Felgenhauer and Frazer Jarvis method to the count the number of valid 9x9 sudoku grids (following the One Rule). Firstly, I will address the terminology that Felgenhauer and Jarvis use in Mathematics of Sudoku I. 3 rows of blocks will be called a band, 3 columns of blocks will be called a stack, and N will represent the number of distinct sudoku grids. Once the top left block is filled in standard form, we find there are 9! = 362880 ways of filling B1 [2] and N = N1*9!. Then, Felgenhauer and Jarvus found that we must consider all possible ways to fill in blocks B2, B3, given that B1 is in the standard form above. Felgenhauer and Jarvis found that there are 20 ways to fill in B1 and B2. A pure top row would consist of B2 and B3 containing cells of {4, 5, 6} {7, 8, 9} or {7, 8, 9} {4, 5, 6}, where each block has a top row of numbers in consecutive order. A mixed top row would be the remaining 2 Each B represents each block.

18 ways to fill B2 and B3. Mathematically, there are (3!) 6 possible configurations to complete the first band starting with the pure top row (each set of three numbers can be written in 3! = 6 different ways), and 3 (3!) 6 possible configurations to complete the mixed top rows. Once they put together their mathematical findings, they reported that there are 2 (3!) 6 + 18 3 (3!) 6 = 56 (3!) 6 = 2612736 possible completions to the top three rows. Therefore, the number of possibilities for the top three rows of a Sudoku grid is 9! 2612736 = 948109639680. How many distinct sudoku grids are there? Through lexicographical reduction, permutation reduction, and column reduction, Felgenhauer and Jarvis found that they could reduce the number of possibilies to improve calculations. They, with the aid of work done by Ed Russel, found that there are 44 distinct completions for blocks B1-B3. By setting the variable N = number of distinct Sudoku grids and letting the variable C = 1 of the 44 possibilities, the enumeration of ways that C can be completed to a full Sudoku grid (nc) and possibilities for B1, B2, and B3 that are equivalent to C (mc) was formalized as N=Σcmcnc. Felgenhauer programmed a backtracking algorithm, a depth-first search that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it determines that the candidate cannot possibly be completed to a valid solution. The run tim was considerable low and they found that 6,670,903,752,021,072,936,960 (6.67 x 1021) grids are possible by using logic and brute-force computation. How many sudoku grids are essentially different? Jarvis and Russel wrote a second paper researching the symmetries involved in Sudoku grids. Distinct solutions were regarded as different even when they could become equivalent through some form of transformation. The symmetry group G of a Sudoku grid consists of all the transformations of the square and more, 1. Relabeling the nine digits. 2. Permuting the three stacks. 3. Permuting the three bands. 4. Permuting the three columns within a stack. 5. Permuting the three rows within a band. 6. Any reflection or rotation (from the list of symmetries of a square). Russel and Jarvis, in Mathematics of Sudoku II, regard two grids as equivalent if one can be transformed into the other by relabeling. If there are no such symmetries to be used, the grids are essentially different. Thus, an enumeration of the number of grids which are fixed up to equivalence by a given symmetry, that is, the grids which are transformed by the symmetry into an equivalent grid must be done. Russel and Jarvis used a program named GAP to work with

groups arising by permuting sets. When symmetries such as rotation, reflection, permutation, and relabeling are factored in, there are only 5,472,730,538 essentially different grids. Computing There are many forms of computing to compute the symmetries of grids. One such way is bruteforce search which is problem-solving technique that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. Another way is backtracking which is the algorithm that Felgenhauer used. Large sets of solutions can be discarded without being explicitly enumerated. Often much faster than brute force enumeration. Solving puzzles of n 2 n 2 grids of n n blocks Conclusion Felgenhaur, Jarvis, and Russel found utilized many aspects of rudimentary and advanced mathematics such as factorization and abstract algebra to answer two interesting questions on the mathematics behind Sudoku.

References Bertram Felgenhauer, Frazer Jarvis, Mathematics of Sudoku I, submitted to Mathematical Spectrum, http://www.afjarvis.staff.shef.ac.uk/sudoku/felgenhauer_jarvis_spec1.pdf Ed Russekk, Frazer Jarvis, Mathematics of Sudoku II, http://www.afjarvis.staff.shef.ac.uk/sudoku/russell_jarvis_spec2.pdf Cornell University Department of Mathematics, The Math Behind Sudoku, http://pi.math.cornell.edu/~mec/summer2009/mahmood/intro.html