Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum...

24
Math and Sudoku Exploring Sudoku boards through graph theory, group theory, and combinatorics Kyle Oddson Under the direction of Dr. John Caughman Math 401 Portland State University Winter 2016

Transcript of Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum...

Page 1: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

MathandSudoku

ExploringSudokuboardsthroughgraphtheory,grouptheory,andcombinatorics

KyleOddson

UnderthedirectionofDr.JohnCaughman

Math401PortlandStateUniversity

Winter2016

Page 2: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

AbstractEncodingSudokupuzzlesaspartiallycoloredgraphs,westateandproveAkman’stheorem[1]regardingtheassociatedpartialchromaticpolynomial[2];wecountthe4x4 sudoku boards, in total and fundamentally distinct; we count the diagonallydistinct4x4sudokuboards;andweclassifyandenumeratethedifferentstructuretypesof4x4boards.IntroductionSudoku is a logic-based puzzle game relating to Latin squares [3]. In the mostcommon size, 9x9, each row, column, and marked 3x3 block must contain thenumbers 1 through 9. A sudoku board can be formed for any n∈ ℕ, with theresultingboardhavingnnxnblocksandtotalsize𝑛!x 𝑛!.Inthisinvestigation,wewillusen=2forourboards,for4x4sudoku.Weselectedthissize,asopposedtothestandard9x9,foreaseofcalculation:thereexistsomewhereontheorder10!"9x9boards[4].Aswillbeshown,thereexistagreatdealfewer4x4boards.I.SudokuPuzzlesandBoardsasGraphs,andPartialChromaticPolynomialsConsidering a sudoku board as a mathematical object, it is useful to encode acompletedboardasagraph:eachvertexcorrespondstoacellintheboard,andtwodistinctverticesareadjacentiffthetwocellssharearow,column,ornxnblock.

Letasudokuboardbeacompletedsudokupuzzle,sothateachofthe𝑛!cellscontainsadigit.Letasudokupuzzlebeapartiallycompletedsudokuboard:thatis,atmost𝑛! − 1cellscontaindigits.Anycellcontainingadigitcanthusbeencodedasa colored vertex. If a board is properly solved—i.e., the rules of sudoku arerespectedandeverycellcontainsadigit—thenthegraphhasapropercoloring.Anypuzzle, then,corresponds toapartialcoloringofat leastoneboard.Awell-formedpuzzle corresponds to exactly one board: a well-formed puzzle has a uniquesolution. This is not the case for every puzzle; indeed, a puzzle that is not well-formedmaynothaveasolution,andwillnotcorrespondtoanyboard.

Note:individualcellsshallbereferredtobytheir(𝑟𝑜𝑤, 𝑐𝑜𝑙𝑢𝑚𝑛)coordinates.Anequivalenceclassofa cell shall compriseall cells currentlymarkedwith,or toinclude,thesameentryasthecell.Take,forexample,thepuzzle:

2 4

3 2

2 3 4 1

4 1 2 3

Figure1:A4x4sudokupuzzle.

Page 3: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Asapartiallycoloredgraph,wehaveequivalenceclasses:"1" = 1, 1 = 1, 1 , 3, 4 ;"2" = 1, 2 = 1, 2 , 2, 4 , 3, 1 , 4, 3 ;"3" = 2, 1 = 2, 1 , 3, 2 , 4, 4 ;"4" = 1, 4 = { 1, 4 , 3, 3 , 4, 1 }.Any board correspond to this puzzle will be a completion of this puzzle. Anyproperly colored board corresponding to the coloring of this puzzle will beconsistentwiththepartialcoloringofthepuzzle.

According to the standard rules of sudoku, only𝑛!colors, or the numbers{1,… ,𝑛} may be used to complete the coloring/board. However, the onlyrequirementforapropercoloringtobeconsistentwiththepartialcoloringisthatthe already-colored vertices retain their colors (this also implies that the existingequivalenceclassesand independentsetsretaintheircurrentmembers).Thentheminimum number of colors required for a proper, consistent, completion of anypartial coloring is equal to the number of colors present in the partial coloring,which is the same as the number of distinct digits appearing in the puzzle. Themaximumnumberofcolorswhichmayappearinaproper,consistent,completionofa partial coloring is equal to thenumber of blank cells plus thenumber of colorsappearinginthepuzzle:tobeconsistent,apropercompletionmustnotchangeanyof the colors used, and so will require at least that many colors. Going beyondstandardsudokuplay,eachblankcellmayreceiveanunuseddistinctdigit.Thenthegreatestnumberof colors foranyproper, consistent completion is the sumof thenumberofdistinctcluesandthenumberofemptycells.

Anytwoverticeswiththesamecolorshareanequivalenceclass;furthertheyare in the same independent set. Note that there is a one-to-one correspondencebetween independent sets and color classes. Any un-colored vertex (empty cell)maybeplacedintoanexistingindependentset,providedthatthecoloringremainsproper (the rules of sudoku are respected), or it may be placed into a newindependent set. Call a proper completion of the partial coloring generic if it ismerely a partitioning of the vertices into independent sets: that is, no colorsassignedtotheemptycellswhiletheyareplacedintocolorclasses.

Using the technique of deletion-contraction, the chromatic polynomial of agraph can be found:𝜒(𝐺, 𝑘), where𝜒(𝐺, 𝑘)equals the number of proper vertexcoloringsofthegraphGusingatmostkcolors.Thistechniquecanalsobeusedonapartiallycoloredgraph,togeneratethepartialchromaticpolynomial.IfweobservethesamepuzzleasFig.1,weseethatcell(1, 3)mustavoidtwocolors,thoseofcolorclasses“2”and“4”.Morespecifically, thecell(1, 3)cannotshareacolorclasswithequivalenceclasses 1, 2 & [ 1, 4 ].

2 4

3 2

2 3 4 1

4 1 2 3

Page 4: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Weshallencodetheemptycellsasagraph(withtheverticeslabeledwiththeirgridcoordinates):

Weshallnowencodeitasapartiallycoloredgraph,replacingthevertexlabelswiththecolorclasseseachvertexmustavoidforapropercoloring:

When applying deletion-contraction, any vertex formed by contracting an edgesharestheadjacencies,andthusthecoloringrestrictions,ofthepreviouslydistinctvertices.Thentherestrictedcolorclassesofacontracted-edgevertexcorrespondtothe union of the restrictions of the distinct vertices. We now apply deletion-contraction to our sample partial coloring, using the recursion formula for thechromaticpolynomial,𝜒 𝐺, 𝑘 = 𝜒 𝐺 − 𝑒, 𝑘 − 𝜒(𝐺 ∙ 𝑒, 𝑘).Note:weshorten𝜒 𝐺, 𝑘 to𝜒 𝐺 .

= –

= – – +

Page 5: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

= –

– +

– + +For

,weseethatvertexCmustavoidfourcolors;thenforak-coloring, it can receive any of𝑘 − 4colors. Vertex B

mustavoidcolors“2”and“4”,aswellaswhichevercolorisplacedonvertexC;thenBcanreceiveanyof𝑘 − 3colors.VertexAmustavoidcolors“2”,“3”,and“4”,andsocan receive any of𝑘 − 3colors. Then the term for this portion of the chromaticpolynomial is 𝑘 − 4 𝑘 − 3 !. Applying this reasoning to every term,we find thatchromaticpolynomialwithrestrictionsofourpuzzleis:𝜒 𝐺, 𝑘 = 𝑘 − 3 ! − 𝑘 − 3 ! 𝑘 − 4 − 𝑘 − 4 𝑘 − 3 ! + 𝑘 − 4 !

− 𝑘 − 4 𝑘 − 3 ! + 𝑘 − 4 𝑘 − 3 + 𝑘 − 4 !𝜒 𝐺, 𝑘 = 𝑘! − 15𝑘! + 87𝑘! − 230𝑘 + 233Inorderforanycoloringtobeconsistentwiththepuzzle,kmustbeatleastaslargeasthenumberofdistinctcolorsalreadyused:here,𝑘 ≥ 4.

Page 6: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Wesee that𝜒 4 = 1; indeed, thispuzzlehasonepossiblecompletion in linewithstandardsudokurules:

Wealsoseethat𝜒 5 = 8.Thisindicatesthatif5colors,orthedigits {1,… , 5}weretobeallowed,thenthereare8possibleconsistentboards:5 2 3 4 5 2 1 4 5 2 3 4

3 4 1 2 3 4 5 2 3 4 5 2

2 3 4 1 2 3 4 1 2 3 4 1

4 1 2 3 4 1 2 3 4 1 2 3

1 2 3 4 1 2 5 4 1 2 3 4

3 5 1 2 3 5 1 2 3 4 5 2

2 3 4 1 2 3 4 1 2 3 4 1

4 1 2 3 4 1 2 3 4 1 2 3

1 2 5 4 1 2 3 4

3 4 1 2 3 4 1 2

2 3 4 1 2 3 4 1

4 1 2 3 4 1 2 3

2 4

3 2

2 3 4 1

4 1 2 3

1 2 3 4

3 4 1 2

2 3 4 1

4 1 2 3

Page 7: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Notethataproperk-coloringisapropercoloringusingatmostkcolors:allowing5colorsdoesnotpreventa4-coloring.Then𝜒(5),thenumberofcompletionsusingatmost 5 digits, is equal to𝜒(4), the number of completions using atmost 4 digits(here, there is one), plus the number of completions using exactly 5 digits (here,thereareseven).

Letnnowbethenumberofverticesinthegraphencodingofthesudokugrid(for9x9,𝑛 = 81; for4x4,𝑛 = 16); lettbethenumberverticesalreadycolored(orthenumberofcluesappearinginthepuzzle);let𝜆!bethenumberofdistinctcolorsin the partial coloring (or the number of distinct digits among the clues). In ourexample, ,𝑛 = 16; 𝑡 = 12; 𝜆! = 4.WenowstateAkman’s theorem[1]: “LetG beagraphwithn vertices, andC beapartialpropercoloringoftverticesofGusingexactly𝜆!colors.Define𝑝!,!(𝜆)tobethenumberofwaysCcanbecompletedtoaproper𝜆-coloringofG.Thenfor𝜆 ≥ 𝜆!,theexpression𝑝!,!(𝜆)isamonicpolynomialofdegree𝑛 − 𝑡.”Proof:Followingourearlierdiscussion,thepartialpropercoloring,C,oftvertices,isthepuzzlewithtclues,𝜆!ofwhicharedistinctdigits.For𝜆 = 𝜆!,nonewcolorsmaybeadded (nonewdigitsmaybeused).That is, thereshall remainexactly𝜆!colorclassesinthecompletedboard;sincethesecolorsarealreadyassigned,thereisonewaycolorassignment. If theboardhas𝜆 = 𝜆! + 1independentsets, thensincethepuzzlealreadyhas𝜆!independentsets,allcellsbelongingtoanyexistingcolorclassmustretain thealready-assignedcolor;anycellsbelongingto thenewcolorclasswillreceivethe𝜆 − 𝜆! = 1newcolor.

Aspreviouslydiscussed,themaximumnumberofcolorclassesappearinginany board is the sum of the number of already appearing color classes and thenumberofemptycells.Thenthetotalnumberofcolorclasses/independentsets ishere𝜆! ≤ 𝜆 ≤ 𝑛 − 𝑡 + 𝜆!. If we let𝑟 = 𝜆 − 𝜆!, the number of new color classes,then0 ≤ 𝑟 ≤ 𝑛 − 𝑡.

We apply induction to𝜆 > 𝜆! : for each additional new color class, allpreviously assigned colors must be avoided, and we find a falling factorial ofpossiblecolorchoicesforeachoftheadditionalrcolorclasses,upto𝑟 = 𝑛 − 𝑡.Since𝑟 = 0is included (and applies to nonew colors), then there are 𝜆 − 𝜆! (𝜆 − 𝜆! −1) ∙∙∙ (𝜆 − 𝜆! − 𝑟 + 1)ways of applying colors to the color classes for the boardpartitionwhereineachblankcellisinitsowncolorclass.

Then we have determined the number of ways of assigning colors to the𝜆! + 𝑟color classes of a given partition of the board. Call the number of ways of

2 4

3 2

2 3 4 1

4 1 2 3

Page 8: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

partitioning the𝑛 − 𝑡empty cells into exactly r color classes𝑚!(𝐺,𝐶). For eachdistinct partitioning of the puzzle and empty cells into color classes, there are𝜆 − 𝜆! (𝜆 − 𝜆! − 1) ∙∙∙ (𝜆 − 𝜆! − 𝑟 + 1)waysofassigningcolors.Thenwhere𝜒(𝑘),the chromatic polynomial evaluated at k, indicates the number of complete,consistent coloringsof a𝜆!-partial-coloringusingatmostk colors,𝜒(𝑘)equals thesum of the number of completions using exactly𝜆!colors, exactly𝜆! + 1colors,…,exactly k colors. Then 𝜒 𝑘 = 𝑚! 𝐺,𝐶 𝜆 − 𝜆! 𝜆 − 𝜆! − 1 ∙∙∙ 𝜆 − 𝜆! − 𝑟 +!!!

!!!1 = 𝑝!,!(𝜆). Each term is a polynomial of degree r; the last term is of degree𝑟 = 𝑛 − 𝑡 , and correspoinds to the complete colorings using exactly𝑛 − 𝑡 newcolors, or partitioning the empty cells into exactly𝑛 − 𝑡new color classes. Sincethereareexactly𝑛 − 𝑡emptycells/un-coloredvertices,thenthereisonlyonesuchpartition.Andsinceeachtermofdegreer, for0 ≤ 𝑟 ≤ 𝑛 − 𝑡, thesumoftheterms,𝑝!,! ,ismonicofdegree𝑛 − 𝑡,andcorrespondsdirectlytothechromaticpolynomialofthesudokugraphwithinitialcoloringrestraintsontheemptycells.◊II.Enumerationof4x4SudokuBoardsA.TotalEnumeration:Claim:∃288total4x4sudokuboards.Proof:Pickanarbitraryfilling-inoftheupperleft2x2block:Turningtowardthelowerrightblock,werecognizethat“d”mustappearinoneofthe4spots{(3,3),(3,4),(4,3),(4,4)}.Weconditionfourcases:

I 1 2 3 4

II 1 2 3 4

1 a b

1 a b

2 c d

2 c d

3 d

3 d

4

4

1 2 3 4

1 a b

2 c d

3

4

Page 9: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

III 1 2 3 4

IV 1 2 3 4

1 a b

1 a b

2 c d

2 c d

3

3

4 d

4 d

Foreachcase,wesubscriptthepossibleentriesforallremainingemptycells:

I 1 2 3 4

II 1 2 3 4

1 a bc d

1 a bd c

2 c dab ab

2 c dab ab

3b ac

dac

3b ac ac

d

4d ac ab abc

4d ac abc ab

III 1 2 3 4

IV 1 2 3 4

1 a bc d

1 a bd c

2 c dab ab

2 c dab ab

3d ac ab abc

3d ac abc ab

4b ac

dac

4b ac ac

d

Wenotethatforeachcase,thereisasinglecellwiththreepossibleentries:{I:(4,4),II:(4,3),III:(3,4),IV:(3,3)}.Anycellwithasingleoptionisfilled,andweconditionsubcases:

Page 10: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Ia 1 2 3 4

Ib 1 2 3 4

Ic 1 2 3 4

1 a b c d

1 a b c d

1 a b c d

2 c dab ab

2 c dab ab

2 c dab ab

3 bac

dac

3 bac

dac

3 bac

dac

4 dac ab

a

4 dac ab

b

4 dac ab

c

IIa 1 2 3 4

IIb 1 2 3 4

IIc 1 2 3 4

1 a b d c

1 a b d c

1 a b d c

2 c dab ab

2 c dab ab

2 c dab ab

3 bac ac

d

3 bac ac

d

3 bac ac

d

4 dac

aab

4 dac

bab

4 dac

cab

IIIa 1 2 3 4

IIIb 1 2 3 4

IIIc 1 2 3 4

1 a b c d

1 a b c d

1 a b c d

2 c dab ab

2 c dab ab

2 c dab ab

3 dac ab

a

3 dac ab

b

3 dac ab

c

4 bac

dac

4 bac

dac

4 bac

dac

IVa 1 2 3 4

IVb 1 2 3 4

IVc 1 2 3 4

1 a b d c

1 a b d c

1 a b d c

2 c dab ab

2 c dab ab

2 c dab ab

3 dac

aab

3 dac

bab

3 dac

cab

4 bac ac

d

4 bac ac

d

4 bac d

ac

Page 11: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Recognizing that these cases limit the options for the remaining cells, we fill outaccordingtotherules:Ia 1 2 3 4

Ib 1 2 3 4

Ic 1 2 3 4

1 a b c d

1 a b c d

1 a b c d

2 c d a b

2 c d b a

2 c d a b

3 b a d c

3 b a d c

3 b c d a

4 d c b a

4 d c a b

4 d a b c

IIa 1 2 3 4

IIb 1 2 3 4

IIc 1 2 3 4

1 a b d c

1 a b d c

1 a b d c

2 c d b a

2 c d a b

2 c d b a

3 b a c d

3 b a c d

3 b c a d

4 d c a b

4 d c b a

4 d a c b

IIIa 1 2 3 4

IIIb 1 2 3 4

IIIc 1 2 3 4

1 a b c d

1 a b c d

1 a b c d

2 c d a b

2 c d b a

2 c d a b

3 d c b a

3 d c a b

3 d a b c

4 b a d c

4 b a d c

4 b c d a

IVa 1 2 3 4

IVb 1 2 3 4

IVc 1 2 3 4

1 a b d c

1 a b d c

1 a b d c

2 c d b a

2 c d a b

2 c d b a

3 d c a b

3 d c b a

3 d a c b

4 b a c d

4 b a c d

4 b c a d

Page 12: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Weseethateachofthe4casesresultsin3singularoutcomes,basedonanarbitraryorderingoftheupperleftblock.As(a,b,c,d)canrepresentanypermutationofthenumbers1 through4, thereare4! = 24possibleorderingsof theupper leftblock,eachwith12distinctoutcomes. ∴ ∃ 4! ∙ 12 = 24 ∙ 12 = 288completed4x4sudokuboards.◊

Itisinterestingtonotethatofthe576order4Latinsquares[3],exactlyhalfofthemare4x4sudokuboards.B.DistinctEnumeration:Claim:∃2fundamentallydifferent4x4sudokuboards.Proof:LetSbethesetofall2884x4sudokuboards.Any𝑥,𝑦 ∈ 𝑆willbeconsideredequivalent if anygroupactionorcombinationofgroupactionson𝑥yield(s)𝑦. Let𝐺 = < 𝐵,𝐶, 𝑟!, 𝑟!, 𝑐!, 𝑐!,𝐷! > ∪ 𝑆!,thegroupgeneratedbythelistedactionsandthegroupofpermutationson{1,… , 4},thelistedactionsdefinedthusly:–Bplacesthefirsttworows(inorder)inthepositionofthelasttworows,andthelasttworows(inorder)inthepositionofthefirsttworows;–Cplaces the first twocolumns(inorder) in thepositionof the last twocolumns,andthelasttwocolumns(inorder)inthepositionofthefirsttwocolumns;–𝑟!swapstherowpositionsofrows1and2;–𝑟!swapstherowpositionsofrows3and4;–𝑐!swapsthecolumnpositionsofrows1and2;–𝑐!swapsthecolumnpositionsofcolumns3and4;–𝐷!indicatesthesymmetriesofthesquare:{𝐼,𝑅,𝑅!,𝑅!,𝐹,𝐹𝑅,𝐹𝑅!,𝐹𝑅!}Itcanbeobservedthat,givenalegalsudokuboard,thelegalityispreservedbyeachoftheseactions:forthesymmetriesofthesquare,allrows,columns,and2x2blocksarepreserved,whilecolumnsmaybecomerowsandviceversa,andtheorderofallrows and/or columnsmay be reversed; for the first six actions, any 2x2 block ispreserved, and if the permutation of a row or column is altered, so too are thepermutations of all intersecting rows/columns. Further, given that functioncompositionisassociative,anycombinationoftheseactionsalsopreserveslegality. Weconsideranytwosudokuboardsequivalentiffanycompositionoftheseactions and/or𝑆!transforms one to the other. Of the 288 total boards, we foundthat a boardwith any given upper left blockwas permutable to 24 others. Thenthereareatmost288÷24=12non-equivalentboards.Weexaminethe12subcasesfound,andfindthatsomeareindeedtransformationsofothers:

Page 13: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

=IIa=IIIa

=IVa

=IIb

Ia 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d a b

𝑐!→ 2 c d b a

3 b a d c

3 b a c d

4 d c b a

4 d c a b

Ia 1 2 3 4

1 2 3 4

1 a b c d

1 a b c d

2 c d a b 𝑟!→

2 c d a b

3 b a d c

3 d c b a

4 d c b a

4 b a d c

IIIa 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d a b 𝑐!→

2 c d b a

3 d c b a

3 d c a b

4 b a d c

4 b a c d

Ib 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d b a 𝑐!→

2 c d a b

3 b a d c

3 b a c d

4 d c a b

4 d c b a

Page 14: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

=IIIb

=IVb

=IIc=IIIc

Ib 1 2 3 4

1 2 3 4

1 a b c d

1 a b c d

2 c d b a 𝑟!→

2 c d b a

3 b a d c

3 d c a b

4 d c a b

4 b a d c

IIIb 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d b a 𝑐!→

2 c d a b

3 d c a b

3 d c b a

4 b a d c

4 b a c d

Ic 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d a b 𝑐!→

2 c d b a

3 b c d a

3 b c a d

4 d a b c

4 d a c b

Ic 1 2 3 4

1 2 3 4

1 a b c d

1 a b c d

2 c d a b 𝑟!→

2 c d a b

3 b c d a

3 d a b c

4 d a b c

4 b c d a

Page 15: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

=IVc

Wehavethusfoundthatthereareatmostthreeequivalenceclassesofboards.Byrepresentative,theyare:

A 1 2 3 4

B 1 2 3 4

C 1 2 3 4

1 a b c d

1 a b c d

1 a b c d

2 c d a b

2 c d b a

2 c d a b

3 b a d c

3 b a d c

3 b c d a

4 d c b a

4 d c a b

4 d a b c

We note that our transformations are actions of a group, with the operation offunction composition; then combinations of transformations are themselves validtransformations:

B 1 2 3 4

1 2 3 4

1 2 3 4

1 a b c d

1 a c b d 1 a b c d

2 c d b a 𝐹𝑅!→

2 b d a c 𝑏𝑐 →

2 c d a b

3 b a d c

3 c b d a 3 b c d a

4 d c a b

4 d a c b 4 d a b c

=C

IIIc 1 2 3 4

1 2 3 4

1 a b c d

1 a b d c

2 c d a b 𝑐!→

2 c d b a

3 d a b c

3 d a c b

4 b c d a

4 b c a d

Page 16: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Thenweseethatthereareatmosttwoequivalenceclassesof4x4boards:

A 1 2 3 4

B 1 2 3 4

1 a b c d

1 a b c d

2 c d a b

2 c d b a

3 b a d c

3 b a d c

4 d c b a

4 d c a b

NoticethattheonlydifferencesbetweenboardsAandBarethecellpairsin

row2,columns3&4,androw4,columns3&4.InordertotransformfromAtoB(and since G is a group, if such a transformation exists then an inversetransformation exists from B to A), we need to make the following cell changes:2, 3 ↔ 2, 4 ; 4, 3 ↔ (4, 4) . If this is a valid transformation, then it is acombination of the generating actions; further, if it is a valid action, then whenapplied to a legal board, legality is preservedunder the action.However, observethat this action, performed on a legal board, renders the board illegal (observecolumns3and4):

1 2 3 4

1 2 3 4

1 a c b d

1 a c b d

2 b d a c →2 b d c a

3 c b d a

3 c b d a

4 d a c b

4 d a b c

Thenthisactionisnotalegaltransformation,andthusnotacombinationofanyofthegenerationactions,andthusnotatransformationbelongingtoourgroup.Thentheredonotexistanytransformations 𝐴 ↔ [𝐵].∴ ∃ 2fundamentallydifferent4x4sudokuboards.◊

Wealsoseethat 𝐴 = 24 ∙ 4 = 96, and 𝐵 = 24 ∙ 8 = 192.

Page 17: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

III.Diagonal4x4SudokuBoardsA:DistinctEnumeration:We turnourattention todiagonallydistinct sudokuboards: thosewith theaddedconstraintthateachofthemaindiagonalsmustalsocontainthenumbers{1,2,3,4}.(SeeAkman [1] for a proof of existence of diagonally distinct boards for any sizesudoku.)Claim:Thereisonlyonedistinctdiagonal4x4sudokuboard.Proof:Giventhattherearetwodistinctboardsoverall,thentheremustbeatmost2distinctdiagonalboards.WeseethatboardIIIa,of[A],satisfies:

IIIa 1 2 3 4

1 a b c d

2 c d a b

3 d c b a

4 b a d c

However,[B]doesnotreadilypresentsuchaboard.Observethatdiagonality

is a structural feature, and does not change under permutation: For any diagonalwherenotallof{a,b,c,d}arepresent,nopermutation{a,b,c,d}→ 𝑆!canaddanyof themissing element(s) (aspermutations are one-to-one). Equivalence class [B]wasfoundbycollapsing8subcases,alltransformabletoeachother.The8subcaseseachrepresented24boards,allachievablebypermutation.Thensincenoneofthe8subcasesare themselvesnotdiagonal, thennoneof thepermutations representedbythe8subcasesarethemselvesdiagonal.Thereare288boardstotal;96arein[A],leaving192in[B].Asobserved,thereare8boardsstructurallynon-diagonal,eachrepresenting 24 non-diagonal permutations. Then [B] contains8 ∙ 24 = 192non-diagonal boards⇒[B] contains no diagonal boards. Then since a single diagonalboardhasbeenfoundin[A],allotherdiagonalboardsmustbereachablebysomecombinationoftransformationsandpermutations.∴ ∃ 1fundamentallydistinct4x4sudokuboard.◊

Page 18: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

B.TotalEnumeration:Claim:∃ 48totaldiagonal4x4sudokuboards.Proof:ObservethatboardsIIaandIIIa,ofequivalenceclass[A],arebothdiagonal,whereas boards Ia and IVa are not. Each of IIa and IIIa represent 24 boards bypermutation;thenthereareatleast24 ∙ 2 = 48diagonalboards.

In order to prove that there are atmost 48 diagonal boards, we turn ourattention to the different structures of the 4x4 boards, and which group actionspreserveorbreakthosestructures.C.Structuresof4x4BoardStructuresandGroupActions:Itisobviousthatallof𝑆!aswellastheactionsof𝐷!preservediagonalityofaboard.We focus on{𝐵,𝐶, 𝑟!, 𝑟!, 𝑐!, 𝑐!}. Observe that underR, a 90º clockwise rotation, allrows become columns and all columns become rows. Then under R,𝐵 ≡ 𝐶, 𝑟! ≡𝑐!, 𝑟! ≡ 𝑐!.Thenwemayfocusonlyon{𝐵,𝐶, 𝑟!, 𝑟!}.ConsiderthediagonalboardIIIa:

IIIa 1 2 3 4

1 a b c d

2 c d a b

3 d c b a

4 b a d c

Under𝑟!,thisistransformedthusly:

IIIa

a b c d

c d a b

c d a b 𝑟!→

a b c d

d c b a

d c b a

b a d c

b a d c

Clearly,diagonalityisnotpreserved.Andunder𝑟!:

Page 19: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

IIIa

a b c d

a b c d

c d a b 𝑟!→

c d a b

d c b a

b a d c

b a d c

d c b a

Again,diagonalityisnotpreserved.However,diagonality ispreservedunderB (andthusunderC):Forthetwo

cells (4, 1), (3, 2), in diagonal board these are two of the four distinct digits. Theothertwoofthefourmustbepresent,insomeorder,incells(1,4)and(2,3).Thesameistrueoftheothertwoblocks, fortheupperleft- lowerrightdiagonal.Thenthedigits inthefourcells(3,1),(4,2),(1,3),(2,4),mustalsobethefourdistinctdigits.UndertheactionB,thecells(3,1)and(4,2)becomethetoptwodigitsoftheupper-leftlowerrightdiagonal,whilecells(1,3)and(2,4)becomethelowertwodigits of the diagonal. Similarly for the upper right- lower left diagonal. Then Bpreservesdiagonality;byRor𝑅!,sotoodoesC.

Considerthetwonon-diagonalrepresentativesofequivalenceclass[A]:

Ia

IVa

a b c d

a b d c

c d a b

c d b a

b a d c

d c a b

d c b a

b a c d

Justas{𝐷!, 𝑆!,𝐵,𝐶}preservediagonality,thesameargumentholdsfortheseactionspreserving non-diagonality. Indeed, the actions{𝑟!, 𝑟!, 𝑐!, 𝑐!}are the only actionswhichwilltransformdiagonalboardstonon-diagonalboardsandviceversa.

Consider the diagonal entries of the two boards above. Board Ia has asentriesonitsmaindiagonals{a,d};boardIvahasentries{ad},{bc}.Wewillclassifyboardstructuresbasedontheirdiagonalentries.BoardIaandits24permutationshave a total of 2 distinct digits along the main diagonals. Board IVa and its 24permutationshave2distinctdigitsalongeachofitsmaindiagonals.BoardsIIaandIIIa,beingthediagonalboards,ofcoursehaveallofthedistinctdigitsalongeachoftheir main diagonals. We see, then that equivalence class [A] can be furtherstructuredintothreeequivalencesubclasses:[Ia],whichcontains24boards,eachofwhichhaveatotalof2diagonaldigits;[IIa]=[IIIa],whichcontains48boards,eachof which are diagonal; and [IVa], which contains 24 boards, each of which has 2distinctdigitsalongeachofitsdiagonals.

Page 20: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Theseaccountforall96oftheboardsof[A];astherearenodiagonalboardsin [B], then there are at most 48 diagonal boards; given the lower bound foundearlier,thenthereareexactly48diagonal4x4boards.◊Wehaveseenboardstructures,allofequivalenceclass[A],whichcontaineither2or4distinctdigitsalongthediagonals.Whatoftheboardsof[B]?Indeed,alloftheboardsof[B]eachcontain3distinctdigitsalongeachdiagonal. Itcanbeseen(attheendofsectionII.A)thateachofthe8representativesofequivalenceclass[B]=[C]havethreedistinctdigitsalongeachmaindiagonal.Itisclear that no permutation of𝑆!will change the number of distinct digits along adiagonal.Here,weshowthatthese8boards(andtheirpermutations)areallofthepossible4x4sudokuboardswith3distinctdigitsacrossthediagonals. Weconditionboardsbasedon theupper left- lowerrightdiagonal.Givenasequence _ _ | _ _,we see that there are four structural possibilities: the first cellmatchesthethird,thefirstcellmatchesthefourth,thesecondcellmatchesthethird,the second cellmatches the fourth;with each of the two remaining cells distinct.Withoutlossofgenerality,wenotethepossibilities:

1) a 2) a

b b

a c

c a

3) a 4) a

b b

b c

c b

Recognizing that these cases limit the options for the remaining cells, we fill outaccordingtotherules:

Page 21: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

1) acd bcd bd

2) acd bd bcd

cd

bcd

a cd

b acd

bcd

cd abd

bd

a cbd

bd

abd

c bcd cd bd

a

3) acd cd

b 4) acd

bcd

cd

bacd ad

cd

bad acd

acd acd

bad

bad

cad

bad ad

c cd acd ad

b

Wepickanarbitrarysinglecellwithtwooptions,condition,andfillout:

1a) a c b d 1b) a d c b

d b c a c b d a

c d a b b c a d

b a d c d a b c

2a) a c d b 2b) a d b c

d b a c c b a d

b a c d d a c b

c d b a b c d a

Page 22: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

3a) a c d b 3b) a d c b

d b c a c b a d

c a b d d c b a

b d a c b a d c

4a) a c b d 4b) a d b c

d b a c c b d a

b d c a b a c d

c a d b d c a b

Thoughtheseboardsdonotinitiallyseemfamiliar,weseethatunderthefollowingpermutations, these boards are, in fact, the exact representatives of equivalenceclass[B]:1a): 𝑏𝑑𝑐 →IIc; 1b): 𝑏𝑑 →IIIb; 2a): 𝑏𝑑𝑐 →IIIC; 2b): 𝑏𝑑 →IIB;3a) 𝑏𝑑𝑐 →IB; 3b): 𝑏𝑑 →IC; 4a): 𝑏𝑑𝑐 →IVB; 4b): 𝑏𝑑 →IVC.

Thenwehave8boardstructures,eachrepresenting24permutations; thenweseethatthereareexactly192possibleboardswithexactlythreedistinctdigitsalongeachmaindiagonal.Asthisistheexactsizeof[B],werecognizethestructureinherenttotheequivalenceclass.

Wenowseethereasonforthetwoequivalenceclasses:nopermutation∈ 𝑆!can change the number of digits along a diagonal, and any of the group actiontransformations must change an even number of digits when counting along thediagonals.Further,wenowseeadistinctivewaytoclassifyboards:thatofcountingthedistinctdigitsalongeachmaindiagonal.◊

Page 23: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

ConclusionAvariationonLatinsquares,Sudokuasapuzzlewasinventedinthelate1970s[5].Aswithmanyplayfuldiversions,thoughitsoriginswerenotmathematical,sudokuboards as mathematical objects hold great opportunities for study. Indeed, it issurprisinghowmuchcanbefoundinasudokuboard,andthemanywaysitcanbestudied. Certainly the puzzle maker(s) who created “Number Place” had nointention that aboardbe encodedas a graph, or that chromaticpolynomialsmayindicatethenumberofvalidsolutionsforagivenpuzzle. Regardingthechromaticpolynomialasrelatestosudokugraphs,thepartialchromaticpolynomialisanobjectdeservingfurtherstudy.Whileithasbeenshownthatthispolynomialismonicofknowndegree,ourinvestigationhasnotshedlightonitsfurtherproperties,thosesharedwithordifferentfromtheclassicchromaticpolynomial.For instance, iseverypowerof𝜆present(uptothedegree)?Mustthesignsofthetermsalternate?Whatisthemeaning,ifany,oftheconstantterm?Whydoes this polynomial have a constant term at all? These questions, beyond ourscope,piquethecuriosity. We have used 4x4 boards as our object of study; in the world of sudoku,thesearesmallboards,andinthemathematicalstudyofsudoku,4x4isthetrivialcase.Givenanopportunity, this author intends to study sudoku further, including9x9boards;inthemeantime,weshallnotforgetthatthisfascinatingmathematicalobjectisalsoanenjoyablepuzzle.

Page 24: Math and Sudoku - Portland State Universityweb.pdx.edu/~caughman/Oddson-Math and Sudoku.pdfminimum number of colors required for a proper, consistent, completion of any partial coloring

Sources[1]Akman,Fusun."PartialChromaticPolynomialsandDiagonallyDistinctSudokuSquares."[0804.0284]PartialChromaticPolynomialsandDiagonallyDistinctSudokuSquares.ArXiv.org,2July2008.Web.26Feb.2016.[2] West, Douglas Brent. Introduction to Graph Theory. Upper Saddle River, NJ:PrenticeHall,2001.Print.[3]Weisstein,EricW."LatinSquare."FromMathWorld--AWolframWebResource.http://mathworld.wolfram.com/LatinSquare.html[4]Felgenhauer,Bertram,andFrazerJarvis."MathematicsofSudokuI-Universityof Sheffield." Mathematics of Sudoku I. University of Sheffield, UK, 25 Jan. 2006.Web.26Feb.2016.[5]Smith,David."SoYouThoughtSudokuCamefromtheLandoftheRisingSun..."TheGuardian.GuardianNewsandMedia,14May2005.Web.26Feb.2016.FurtherReadingDavis, Tom. "The Mathematics of Sudoku." The Mathematics of Sudoku. 13 Sept.2012.Web.26Feb.2016.<http://www.geometer.org/mathcircles/sudoku.pdf>.Herzberg, Agnes M., and H. Ram Murty. "Sudoku Squares and ChromaticPolynomials."NoticesoftheAMS54.6(2007):708-17.Web.26Feb.2016.Rosenhouse, Jason, and Laura Taalman.TakingSudokuSeriously:TheMathbehindtheWorld'sMostPopularPencilPuzzle.Oxford:OxfordUP,2011.Print."Sudoku Variations (puzzles)." Web log post. Grandmaster Puzzles. Ed. ThomasSnyder.Web.26Feb.2016.<http://www.gmpuzzles.com/blog/category/sudoku/>.