Mathematics of Magic Squares and Sudoku

Similar documents
A slope of a line is the ratio between the change in a vertical distance (rise) to the change in a horizontal

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

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

Whole Numbers. Whole Numbers. Curriculum Ready.

Latin Squares for Elementary and Middle Grades

Asst. Prof. Thavatchai Tayjasanant, PhD. Power System Research Lab 12 th Floor, Building 4 Tel: (02)

Chapter 1: Digital logic

INTRODUCTION TO LOGARITHMS

MATH 135 Algebra, Solutions to Assignment 7

An ordered collection of counters in rows or columns, showing multiplication facts.

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

Solutions to the European Kangaroo Pink Paper

5th Grade. Divisibility Rules. Slide 1 / 239 Slide 2 / 239. Slide 3 / 239. Slide 4 / 239. Slide 6 / 239. Slide 5 / 239. Division. Division Unit Topics

Magic Squares. Lia Malato Leite Victoria Jacquemin Noemie Boillot

SHRIMATI INDIRA GANDHI COLLEGE

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

Error Detection and Correction

Kenken For Teachers. Tom Davis January 8, Abstract

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

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

GRADE 4. M : Solve division problems without remainders. M : Recall basic addition, subtraction, and multiplication facts.

Modular Arithmetic. Kieran Cooney - February 18, 2016

Year 5 Problems and Investigations Spring

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

Georgia Department of Education

Radical Expressions and Graph (7.1) EXAMPLE #1: EXAMPLE #2: EXAMPLE #3: Find roots of numbers (Objective #1) Figure #1:

Table of Contents. Table of Contents 1

Chapter 4: Patterns and Relationships

GPLMS Revision Programme GRADE 6 Booklet

Whole Numbers WHOLE NUMBERS PASSPORT.

GAP CLOSING. Powers and Roots. Intermediate / Senior Facilitator Guide

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

Modular arithmetic Math 2320

Figurate Numbers. by George Jelliss June 2008 with additions November 2008

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

Navy Electricity and Electronics Training Series

A C E. Answers Investigation 4. Applications. Dimensions of 39 Square Unit Rectangles and Partitions. Small Medium Large

The Unreasonably Beautiful World of Numbers

Content Area: Mathematics- 3 rd Grade

Distribution of Primes

Y8 & Y9 Number Starters A Spire Maths Activity

MCAS/DCCAS Mathematics Correlation Chart Grade 4

A natural number is called a perfect cube if it is the cube of some. some natural number.

4th Grade Mathematics Mathematics CC

Permutation Groups. Definition and Notation

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

4th Grade Emphasis Standards

4 th Grade Mathematics Learning Targets By Unit

The mathematics of Septoku

COMMON CORE STATE STANDARDS FOR MATHEMATICS K-2 DOMAIN PROGRESSIONS

MANIPULATIVE MATHEMATICS FOR STUDENTS

Work: The converse of the statement If p, then q is If q, then p. Thus choice C is correct.

Public Key Cryptography

UNIT 2: RATIONAL NUMBER CONCEPTS WEEK 5: Student Packet

Using KenKen to Build Reasoning Skills 1

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

NUMBER, NUMBER SYSTEMS, AND NUMBER RELATIONSHIPS. Kindergarten:

The congruence relation has many similarities to equality. The following theorem says that congruence, like equality, is an equivalence relation.

Summer Solutions Common Core Mathematics 4. Common Core. Mathematics. Help Pages

Puzzles ANIL KUMAR C P. The Institute of Mathematical Sciences, Chennai. Puzzles for kids. Date: May 4, 2014

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

Taking Sudoku Seriously

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Math + 4 (Red) SEMESTER 1. { Pg. 1 } Unit 1: Whole Number Sense. Unit 2: Whole Number Operations. Unit 3: Applications of Operations

Grades 6 8 Innoventure Components That Meet Common Core Mathematics Standards

Pennsylvania System of School Assessment

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

In 1974, Erno Rubik created the Rubik s Cube. It is the most popular puzzle

Caltech Harvey Mudd Mathematics Competition February 20, 2010

Solutions for the Practice Final

2. Nine points are distributed around a circle in such a way that when all ( )

Addition and Subtraction of Polynomials

Dutch Sudoku Advent 1. Thermometers Sudoku (Arvid Baars)

WITH MATH INTERMEDIATE/MIDDLE (IM) GRADE 6

STEM: Electronics Curriculum Map & Standards

KenKen Strategies 17+

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

Mathematics Enhancement Programme TEACHING SUPPORT: Year 3

Math 255 Spring 2017 Solving x 2 a (mod n)

MATH CIRCLE, 10/13/2018

BIG IDEA 1: Develop an understanding of and fluency with multiplication and division of fractions and decimals BIG IDEA 1:

Class 8: Square Roots & Cube Roots (Lecture Notes)

Connected Mathematics 2, 6th Grade Units (c) 2006 Correlated to: Utah Core Curriculum for Math (Grade 6)

B 2 3 = 4 B 2 = 7 B = 14

CALCULATING SQUARE ROOTS BY HAND By James D. Nickel

n r for the number. (n r)!r!

Tennessee Senior Bridge Mathematics

MAS336 Computational Problem Solving. Problem 3: Eight Queens

Chapter 4 Number Theory

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

Mathematical Olympiads November 19, 2014

Sudoku an alternative history

2011 Summer Math Packet Students entering Fifth Grade Math

Developing Algebraic Thinking

6.2 Modular Arithmetic

Topics to be covered

ON 4-DIMENSIONAL CUBE AND SUDOKU

A Group-theoretic Approach to Human Solving Strategies in Sudoku

Exploring Concepts with Cubes. A resource book

Grade 3: PA Academic Eligible Content and PA Common Core Crosswalk

Transcription:

Mathematics of Magic Squares and Sudoku Introduction This article explains How to create large magic squares (large number of rows and columns and large dimensions) How to convert a four dimensional magic square into a two dimensional Sudoku puzzle How rotating portions of a four dimensional magic square changes the complexity of a Sudoku puzzle Explains interesting applications of these techniques to quantum computing and proteomics An appendix is provided that explains counting, exponentiation, number bases, modulo arithmetic, and tuples. Magic Squares A magic square is an arrangement of numbers in a square, cube, or multidimensional cube where the sum of each row, column, and principal diagonal is the same. The order of a magic square is the number of cells within each row and column. The name for the sum of the numbers in each row or column is the magic number. Traditionally magic squares contain the integers from 1 to n 2. The smallest nontrivial case, shown below, is of order 3. In this article, we will use the term standard (or canonical) magic square to describe a magic square which contains the integers from 0 to n 2-1. History of Magic Squares Magic squares were known to Chinese mathematicians as early as the seventh century BCE. Chinese literature dating from as early as 650 BCE tells the legend of Lo Shu "scroll of the river Lo". In ancient China there was a huge flood. The great king Yu tried to channel the water out to sea when a turtle emerged from the water with a curious figure/pattern on its shell: circular dots of numbers which were arranged in a three by three grid pattern such that the sum of the numbers in each row, column and diagonal was the same: 15. Fifteen is the number of days in each of the 24 cycles of the Chinese solar year. Magic squares were known to Islamic mathematicians, possibly as early as the 8th century, when Muslims came into contact with Indian culture, and learned Indian mathematics and astronomy, including other aspects of combinatorial mathematics. The Arab mathematician Ahmad al-buni, who worked on magic squares around 1250 CE, attributed mystical properties to them, although no details of these properties are known. There are also references to the use of magic squares in astrological

calculations, a practice that seems to have originated with the Arabs. Additional history about magic squares is available in Wikipedia at http://en.wikipedia.org/wiki/magic_square#history. Summary of Algorithm for Creating Magic Squares We can summarize the algorithm for creating a magic square as: 1. Select dimensions and order for a magic square 2. Calculate center cell for magic square 3. Calculate incidence matrix for magic square 4. For each cell in magic square a. Calculate cell offsets from center cell b. Calculate cell contents using multiplication with cell offsets and incidence matrix The steps in this algorithm are explained below. Algorithm for Creating Magic Squares Our algorithm for creating a magic square begins by calculating the contents for the center cell within a magic square and using an Incidence Matrix (defined below) to calculate the Cell Values for all of the other cells within the magic square. (Please see the Appendix for an explanation of modulo arithmetic, tuple, Cell Values, Cell Coordinates, Cell Offsets, and Differentials.) Hyper-Squares Our algorithm for creating magic squares has the ability to create magic squares in an arbitrarily large number of dimensions. Ordinary magic squares and Sudoku puzzles are two-dimensional. We say that cubes are three-dimensional. We can use either hyper-square or hyper-cube to refer to magic squares or Sudoku puzzles that have more than three dimensions. We will show below that a fourdimensional magic square can be used to create a two-dimensional Sudoku puzzle. Center Cell Suppose that we want to create a magic square that has d dimensions and has an order equal to n. Each cell within this magic square will have a tuple that contains d components. The number of components within each Cell Value tuple is always equal to the number of dimensions for a magic square. Each of the components within each Cell Value is always an integer that is expressed in a numeric base that is equal to the order of the magic square. All of the Sudoku puzzles that we will create have odd-order. Newspaper Sudoku puzzles are 9x9 and we will learn how the create Sudoku puzzles that are 25x25, 49x49, and so forth. Consequently, our algorithm for creating magic squares is restricted to odd-order. Each of the components within the Cell Value tuple for the center cell in a magic square is the same. Each of these components has the value (n-1)/2, where n is the order of the magic square. Remember that the number of components within each tuple is equal to the number of dimensions for the magic square. For example, if we are creating a four-dimension magic square then the center cell (and every other cell) will have four components in each tuple for Cell Values and for Cell Coordinates. The illustration below contains a magic square with 2 dimensions and order 5. It is displayed in TUPLE format. The content of the center cell is the n tuple {2,2} and its coordinates are [2,2].

This does not look like a traditional magic square. However, it shows the internal representation of the Cell Value tuples. Each of the components of the Cell Value tuples are represented as base 5 integers. We use base 5 because the order for the magic square is equal to 5. If we convert these base 5 representations into decimal numbers, the display will be the same as an ordinary magic square that contains the integers between 0 and 24. Note the center column in the diagram: the Cell Value tuples form a sequence ({0,0}, {1,1}...{4,4}), where all the components in each Cell Value tuple are the same. A similar sequence will exist for every magic square (or hyper-cube) that we create using our algorithm. There will always be n cells in each column, where n is equal to the order of the magic square. The range for the sequence in the center column will always be 0 to n-1, the integer components will be written in base n, and all the components in each Cell Value tuple within the central column will always be the same. The only difference between two dimensional magic squares and n dimensional hyper-cubes is that the number of components within each Cell Value tuple will be different. The formula above states the value for the components in the central cell is (n-1)/2. In the diagram above this is true: the value of the components is equal to (5-1)/2. We will use addition and subtraction operations, modulo base 5, to calculate all values other than the center cell. Note, we don't need modulo arithmetic operations to calculate the sequence in the center column. The tuples in the diagram only have two positions because the magic square has two dimensions. Note that each of the base 5 number symbols (0,1,2,3,4) appears only once within a tuple position, within any row or column. Also note that each of the base 5 number symbols appears exactly once within a tuple position, within each row and column. Important Consequence A consequence of the fact that all of the base 5 number symbols appear exactly once within each tuple position within each row and column, is that the sum of these symbols is always the same. In the

diagram above, this sum is equal to 10 in base 10. More importantly, the sum is equal to 20 base 5 (often written as 20 5). We have a simple rule for 2 dimensional magic squares for expressing this sum in base n. This rule states that the first number symbol in base n is (n-1)/2, and the second number symbol is zero. The diagram below illustrates this sum for magic squares with order 3 through 31, the first number is the order and the second number is the sum represented in a numeric base equal to the order: The same magic square that we illustrated above is illustrated below using NUMBER format. Each cell is represented as a base 10 number: Note that the magic number (sum for each row, column, and diagonal) is equal to 60. Tuple Representations and Format Conversions Base 10 integers are represented in a polynomial sum of products format, for example: 347 = 3x10 2 + 4x10 1 + 7x10 0

The n-tuple representation for numbers is a similar polynomial sum of products format, where the order of the magic square is used as the numeric base. For example, the following is a conversion from the illustration above: 22 = {4,2} 22 = 4x5 1 + 2x5 0 The base in this conversion is 5, because the order of the magic square is 5. Incidence Matrix As we are creating a magic square, we might ask the question If we know the value of a particular Cell Value tuple, what is the value of an adjacent Cell Value tuple? Surprisingly, this is a difficult question for many magic square algorithms. An incidence matrix provides an easy answer to this question. An incidence matrix is a square matrix where each entry is either 1 or 1. The size of an incidence matrix for a particular magic square is equal to the dimensions of that magic square. The diagram below illustrates examples of incidence matrices for dimensions n=2 through n=5. 1-1 Dimension n = 2 1 1 1-1 1 Dimension n = 3 1-1 -1 1 1 1 1-1 1-1 Dimension n = 4 1-1 1 1 1-1 -1-1 1 1 1 1 1-1 1-1 1 1-1 1-1 -1 Dimension n = 5 1-1 1 1 1 1-1 -1-1 -1 1 1 1 1 1 The coloring in each incidence matrix is used to separate the values for -1 and 1. This incidence matrix for n=2 was used to create the magic squares in the illustrations above. Each row in an incidence matrix corresponds with one dimension of a magic square. The top row corresponds to the first dimension and the bottom row to the last dimension. Therefore, if the first dimension is the horizontal ( X ) dimension of a magic square, and the second is the vertical ( Y ) dimension, then {1, -1} controls the differential between Cell Value tuples in the X direction and {1, 1} controls the differential in the Y direction. For example, starting with the center cell in the first magic square illustrated above: {2,2} + {1,1} = {3,3} increase 1 cell in Y direction

{3,3} + {1,-1} = {4,2} increase 1 cell in X direction {4,2} - {1,1} = {3,1} decrease 1 cell in Y direction {3,1} - {1,-1} = {3,3} decrease 1 cell in X direction Zero Cell An incidence matrix, in combination with ordinary multiplication, can be used to calculate any Cell Value tuple in a magic square. When creating magic squares by hand, or when evaluating the output of a computer program, it is convenient to calculate the contents of the zero cell (where all of the components of the Cell Coordinate tuple are equal zero). The following are the calculations used to calculate the contents of the zero cell in the first magic square illustrated above: {2,2} - 2{1,1} = {0,0} decrease 2 cells in Y direction {0,0} - 2{1,-1} = {3,2} decrease 2 cells in X direction Thus, the result of these calculations is that the Cell Value tuple in the upper left hand corner of the magic square illustrated above is {3,2}. (The reader might recognize that these separate operations can be combined into a single operation.) These operations could be read as: Beginning with the contents of the center cell {2,2} (whose coordinates are [2,2]) find the contents of the cell whose coordinates are [0,2] by multiplying the second row of the incidence matrix by 2. Add the results of this multiplication to the contents of the center cell to derive the contents {0,0}. Note: in illustrations from the computer program, rows with lowest indices are presented first (top), rows with highest indices last (bottom). Next, using the contents of the cell at [0,2] find the contents of the cell at [0,0] by multiplying the first row of the incidence matrix by 2. Add the results of this multiplication to derive the contents {3,2}. This example illustrates that calculations are performed on the n tuple representation of the Cell Value tuples modulo the order of each magic square. Thus in this example, the operations are performed modulo5. The multiplier that is used in conjunction with the incidence matrix is a Cell Offset, which is the difference between the coordinates of a cell that contains a known value, and the coordinates for the cell whose value is to be calculated. Algorithm for Creating Sudoku Puzzles We can view a Sudoku puzzle as a 4 dimensional magic square transformed into 2 dimensions. The algorithm for creating Sudoku puzzles is similar to the algorithm for creating magic squares. The following table illustrates these similarities:

Notation In the following example of creating a Sudoku puzzle, we will start with a four dimensional magic square. We will indicate the Cell Coordinates for the magic square as [w,x,y,z]. We will indicate the Cell Values for the magic square as {W,X,Y,Z}. Transform Matrix A transform matrix performs a role in the creation of a Sudoku puzzle which is similar to the role of an incidence matrix in the creation of a magic square. The following diagram represents a transform matrix: +1,-1 +1,x +1,+1 w,-1 0,0 w,+1-1,-1-1,x -1,+1 This transform matrix converts a four dimensional magic square with order equal to 3 into a newspaper style Sudoku puzzle. First we will illustrate the TUPLE version of the source magic square, then we will illustrate the Sudoku puzzle.

The source magic square is:

The resulting Sudoku puzzle is: 5 1 6 7 3 2 0 8 4 7 3 2 0 8 4 5 1 6 0 8 4 5 1 6 7 3 2 1 6 5 3 2 7 8 4 0 3 2 7 8 4 0 1 6 5 8 4 0 1 6 5 3 2 7 6 5 1 2 7 3 4 0 8 2 7 3 4 0 8 6 5 1 4 0 8 6 5 1 2 7 3 Note that numbers in this Sudoku puzzle range from 0 to 8. In contrast, the numbers in newspaper Sudoku puzzles range from 1 to 9. We can convert this canonical Sudoku puzzle to a newspaper Sudoku puzzle by adding 1 to the value in each cell of the puzzle. Interpretation of a Transform Matrix A four dimensional magic square can be separated into a group of cubes. Each of the cubes can be separated into a group of planes. If we are creating a newspaper Sudoku puzzle that is 9x9, then the source magic square will be 3x3x3x3. In this case, each of the cubes will be 3x3x3, and each of the planes will be 3x3. A transform matrix determines how the planes from a (4-dimensional) magic square are organized into a (2-dimensional) Sudoku puzzle. The following illustration shows the (4-tuple) cell contents {W,X,Y,Z} of the Sudoku puzzle illustrated above:

2102 0021 1210 0211 1100 2022 1020 2212 0101 0221 1110 2002 1000 2222 0111 2112 0001 1220 1010 2202 0121 2122 0011 1200 0201 1120 2012 1021 2210 0102 2100 0022 1211 0212 1101 2020 2110 0002 1221 0222 1111 2000 1001 2220 0112 0202 1121 2012 1011 2200 0122 2120 0012 1201 0210 1102 2021 1022 2211 0100 2101 0020 1212 1002 2221 0110 2111 0000 1222 0220 1112 2001 2121 0010 1202 0200 1122 2011 1012 2201 0120 Note the positions of the cells that contain 0000, 1111, 2222. These cells form the center column that we discussed above. Also, 1111 is the center cell. These numbers are written in base 3 and range from 0 to 80 when expressed in base 10. The algorithm for transforming the magic square into the Sudoku puzzle begins by selecting a center plane from the magic square illustrated above. In this example, the center plane contains the cells whose coordinates are [1,1,y,z] (note: Cell Contents, not Cell Coordinates, are displayed in the illustration). The corresponding Cell Contents {W,X,Y,Z} for the Sudoku puzzle are illustrated in the 4- tuple representation of the center square in this puzzle. The base 10 numbers illustrated in the newspaper version of the puzzle are a polynomial transformation of the cell contents using the X and the Z component of the cell contents. For example, the number in the upper left cell of the illustration above has an X component equal to 1 and a Z component equal to 2; therefore the transformation is performed as follows: {W, X, Y, Z} 2102 3 5 = 1x3 1 + 2x3 0 We are using base 3 in this transformation because the order of the source magic square is 3. The transformation matrix transforms planes from the magic square by performing calculations upon their Cell Coordinates. For example, the upper right square in the Sudoku puzzle corresponds to the upper right cell in the transform matrix (+1,+1). The calculation is:

Center Cell Coordinates [1,1,y,z] Transform components <1,1> Upper right coordinates [2,2,y,z] This calculation was performed by adding the Transform components to Cell Coordinate components. The y and z remain unchanged. This addition is perform modulo the order of the magic square, in this case modulo 3. The result of this addition is that the cells in the upper right square of the puzzle are the cells in the magic square that have coordinates [2,2,y,z]. The following is a similar calculation; it applies to the lower center cell: Center Cell Coordinates [1,1,y,z] Transform components <-1> Lower center coordinates [0,1,y,z] This addition shows that the cells in the lower center square of the Sudoku puzzle are the cells in the magic square that have coordinates [0,1,y,z]. Interesting Interpretation of a Sudoku Puzzle Using the transformation operations described above, Sudoku puzzles can be interpreted as a mapping from Cell Coordinates [w,x,y,z] of a magic square into Cell Contents {W,X,Y,Z} of a Sudoku puzzle. A rationale for this interpretation is to examine the discarded information in a newspaper Sudoku puzzle. Under this interpretation, the 4 tuple version of a Sudoku puzzle contains a number of cells equal to the order of the magic square raised to the fourth power. In our example this number is equal to 81 (3x3x3x3). The newspaper version discards the W and Y components of the cell contents and combines the X and Z components into a single base 10 integer. In the four-dimensional representation, each number cell is unique; in the newspaper version, uniqueness is discarded. One explanation of the enthusiasm for Sudoku puzzles is the challenge of working without the discarded information and attempting to rediscover it. The process of solving Sudoku puzzles with discarded information is similar to other mathematical processes where information is discarded, or hidden, by a transformation process, for example: Factoring Integers Solving Polynomial Equations Factoring Integers The integer 358327321042214350104101087147887 is expressed in a sum of products format (as described above, it can be expressed as a polynomial with 10 as the base). It is relatively difficult to factor. However, a product of sums representation for the same integer (which displays its factors) is: (541)(1223) 2 (1987) 3 (2741) 4 It is relatively easy to transform this representation of an integer, into the previous representation (by multiplying all of the factors with each other). The analogy to discarded information in a newspaper

Sudoku puzzle is that the prime numbers and their exponents have been discarded in the sum of products representation, and in the newspaper representation. If the 4 components of the tuple representation were presented in a newspaper Sudoku puzzle, the puzzle would contain 81 unique numbers, rather than 9 numbers that are repeated 9 times. This would be much easier to solve. Part of the fun of solving Sudoku puzzles is the challenge presented by the discarded information. However, there are many intelligence gathering tasks where the transformation operations described above may be valuable. Solving Polynomial Equations Solving polynomial equations is very similar to factoring integers. The solution process transforms a sum of products representation into a product of sums representation. As with factoring integers, it is easy to transform the product of sums into a sum of products; but the inverse operation is difficult (and in some cases impossible). For example, consider the sum of products representation of this polynomial: Y = X 4 1436X 3 5593782X 2 + 4213301116X 1 + 3603550600981 It is relatively difficult to solve this polynomial. However, the solution is the product of sums representation: Y = (X + 541)(X 1223)(X + 1987)(X 2741) It is easy to transform this solution into the sum of products representation (by multiplying each of the factors together). The analogy with discarded information in a newspaper Sudoku puzzle, is that the roots of the equation which are present in the product of sums representation, have been discarded in the sum of products representation. Difficulty of Sudoku Puzzles Newspapers and books that publish Sudoku puzzles often grade the puzzles according to difficulty. This section describes how the difficulty of a puzzle can be increased, or decreased, during the puzzle creation process. As described above, a four-dimensional magic square contains a group of cubes, each of which contains a group of planes. These cubes and planes can be rotated in a manner which is similar to rotations in a Rubik's cube. While many rotations of cubes and planes are possible, we impose constraints upon rotations to ensure the integrity of a Sudoku puzzle. It is relatively easy to understand the constraints upon rotations using the 4 dimensional Cell Coordinates [w, x, y, z]. For example, to vertically rotate squares within a puzzle (not rows within squares) change the values [w 1, x, y, z] to [w 2, x, y, z], where w 1 and w 2 are unique integers in the range 0 to order minus 1. Similarly, to horizontally rotate squares change the values [w, x 1, y, z] to [w, x 2, y, z]. In simpler terms, we perform rotations by making changes to Cell Coordinates. In these two examples, we only need to change one component of a Cell Coordinate to perform a rotation. The subscript notations indicate which components are changing during rotations.

It is slightly more difficult to rotate rows and columns within squares inside a Sudoku puzzle while maintaining Sudoku constraints. For example, to rearrange rows within squares, change the values [w 1, x, y 2, z] to [w 1, x, y 3, z]. Similarly, to rearrange columns within squares, change the values[w, x 1, y, z 2 ] to[w, x 1, y, z 3 ]. As a general rule, increasing the number of rotations in the canonical magic square used to create a Sudoku puzzle increases the difficulty of the Sudoku puzzle. Interesting Applications This article used a 4 dimensional magic square to generate a 2 dimensional Sudoku puzzle. The article examined the constraints that a Sudoku puzzle imposes upon rotating a magic square to form new Sudoku puzzles. This work can be generalized to generating an n dimensional Sudoku puzzle from a 2n dimensional magic square. A possible application of this generalization is using the resulting n dimensional data structure as the domain of a multi-variable function, with constraints on rotations as constraints on valid values for the domain. Possible application areas are: Proteomics Quantum Computation Proteomics Using the data structures as domains for multi-variable functions might be applicable to protein folding, where proteins form primary structures such as an alpha-helix and a beta-sheet. For example, proteins with very long polypeptide chains tend to have a tertiary structure imposed by attraction among chemical groups such as amino acids that contain sulfur. Complex proteins such as hemoglobin take on quaternary structures based upon binding non-protein groups (for example iron atoms). The constrained position of these binding groups might correspond to rotational constraints imposed upon multi-dimensional squares/puzzles. Using these squares/puzzles as domains in multi-variable functions might permit calculation of energy values where proteins de-nature ( break bonds ) at the points that correspond to constrained rotations ( foldings ). Quantum Computation Current electronic computers are built upon 2 state electrical devices embedded within semiconductors. The concept of bits is used to interpret the state of these devices. Higher level interpretations of bits include integer, floating point, and character. Boolean algebra is used as a theoretical foundation for computations using bits, when the state of a bit is interpreted as TRUE or FALSE. Quantum computation uses the concept of qubit (quantum bit). A quantum register with 3 qubits based upon 2 state quantum mechanical devices can concurrently store eight numbers based upon quantum superposition. This implies that eight computations can be performed in parallel. Using the techniques in this article, the qubits can be interpreted as constrained domains and the parallel computations represented as results of multi-variable functions using these domains.

Closing Magic squares are interesting puzzles in their own right. Sudoku puzzles are transformations of magic squares. These transformations may have applications in several fields. Apart from the utility of these transformations, solving Sudoku puzzles is fun. Appendix This appendix explains background information for creating magic squares and Sudoku puzzles: Counting Exponentiation Number Bases Modulo Arithmetic Tuples Counting Understanding counting is necessary for creating magic squares and Sudoku puzzles. If someone asks you to count up to 3, a typical response might be 1, 2, 3. However, for creating Sudoku puzzles you need to start counting from zero, and your response will be 0, 1, 2, 3. Exponentiation Exponentiation is also necessary for creating magic squares and Sudoku puzzles. In the diagram below, exponents are the small numbers that are written in superscript above the base number. In this diagram, 10 is the base number: 1 = 10 0 10 = 10 1 100 = 10 2 1,000 = 10 3 10,000 = 10 4 The exponent represents the exponentiation operation which says multiply the base number by itself, this number of times. For example, 1,000 is represented in the diagram by 10 exponentiated to the third power, which is equivalent to saying multiply 10 by itself, three times. By convention, any number exponentiated to the zero power is equal to 1. Using this convention, the first entry in the diagram is 10 exponentiated to the zero power, which is equal to 1. Number Bases Another concept that you need to learn is counting in number bases. Ordinary numbers are expressed in base 10, which is referred to as decimal. If you studied computer science, or have worked with lowlevel computer code you may be familiar with base 2, which is referred to as binary and base 16, which is referred to as hexadecimal. There is a close relationship between integers (whole numbers) and polynomial equations. For example, the following equation expresses the decimal number 341: 341 = 3x10 2 + 4x10 1 + 1x10 0

The following equations are similar to our representation of 341, but instead of using 10 as the base, we use a variable X: Y = 3X 2 + 4X 1 + 1X 0 Y = 3X 2 + 4X 1 + 1 The first of these equations conforms to our representation of 341, the second uses the convention that variables exponentiated to the zero power are not written. In the diagram below, we evaluate this equation for the values of X between 5 and 10. The first number represents the value of X ( the number base ), and the second number represents the value of Y: You can interpret this table as saying if you express 341 in the number base in the left hand column, the base 10 equivalent is expressed in the same row in the right hand column. For example, if we use 5 as the numeric base, we have: 96 = 3x5 2 + 4x5 1 + 1x5 0 Modulo Arithmetic The concepts for modulo arithmetic are based upon ordinary division where we have a divisor, dividend, quotient, and remainder. For example: 17 5 = 3 remainder 2 In this example the divisor is 5, the dividend is 17, the quotient is 3, and the remainder is 2. We can express this symbolically as: dividend = quotient, remainder divisor Modulo operations use the remainder from division. While creating magic squares and Sudoku puzzles, we will perform addition and subtraction modulo a particular number base. However, you are already familiar with performing addition and subtraction modulo base 10. For example, when you add 8+7 and obtain 15, you implicitly recognize that base 10 has only ten symbols for representing numbers (the digits 0 through 9). If you were counting on your fingers starting with 8, you would reach 9 and say oops, I've run out of single-digit symbols; I better start using two-digit symbols starting with 10). If you are working in base 5, you have 5 number symbols (0,1,2,3,4). In this example, we add base 5 numbers that have 2 symbols and the result has three symbols (the decimal equivalent is presented below):

102 5 = 14 5 + 33 5 27 = 9 + 18 When we create magic squares, we will use a base which is equal to the order of the magic square. The order of a magic square is the number of cells in each row, or column, of a magic square. Tuple When writing computer software to create magic squares or Sudoku puzzles, it is convenient to use tuples. Tuple is a term from mathematics that describes a group of numbers. A 2 tuple contains two numbers, a 3 tuple contains three numbers, and an n tuple contains n numbers. We describe the contents of each cell in a magic square as a n tuple, where n corresponds to the number of dimensions for that magic square. The contents of the numbers in each tuple will be integers that are expressed in the numeric base that corresponds to the order of that magic square. We will use four types of tuples for creating magic squares: Name Example Description Cell Values {2,42,} Value displayed in a cell Cell Coordinates [0,2,5] Index system for numbering cells within a magic square Cell Offsets <2,3,1> Difference obtained by subtracting Cell Coordinates Differentials {1,4,7} Difference obtained by subtracting Cell Values Each of the tuples in this diagram contain 3 components, therefore each is a 3 tuple. Distinguishing among type of tuples enhances the explanations in this article. It greatly enhances design when we use object oriented programming to implement algorithms for magic squares and Sudoku puzzles. Tuple Examples If we subtract the value of one Cell Coordinate from another Cell Coordinate, we obtain a Cell Offset. This offset represents the distance between two cells in a magic square. It is similar to finding the difference between two Cartesian coordinates in an ordinary X-Y graph. For example: In this example, the first coordinate is [4,2,3]. Although we won't speak about an X axis, Y axis, or Z axis, you can think of this coordinate as located at 4 along the X axis, 2 along the Y axis, and 3 along the Z axis. In contrast to Cartesian coordinates that may have negative values, all Cell Coordinates are nonnegative. The Cell Offset in the example represents the distance between the two Cell Coordinates; in this example it is <2,1,1>. We will use both Cell Coordinates and Cell Offsets to provide rapid methods for calculating Cell Values. Another example of working with tuples is calculating a Differential by subtracting one Cell Value from another Cell Value:

In this example, the Cell Values represent integers that will be displayed within a cell in a magic square. The difference between these values is represented as a Differential. Addition and subtraction operations using Cell Values and Cell Coordinates is performed modulo the order of the magic square. (Module arithmetic is explained above.)