Latin Squares

12/4/2014
Ma/CS 6a
Class 28: Latin Squares
By Adam Sheffer
Latin Squares
ο‚—
A Latin square is an 𝑛 × π‘› array filled
with 𝑛 different symbols, each occurring
exactly once in each row and exactly once
in each column.
1
12/4/2014
Partial Latin Squares
ο‚—
In this class, our goal is to investigate
when we can solve partial filled Latin
squares (i.e., Latin squares that are
incomplete).
An EASY Warm-up
ο‚—
Problem. What happens when only one
row is missing?
β—¦ There is a unique way of completing each
column, and we can check whether the
additional row is valid (it always is).
2
12/4/2014
An Empty Square
ο‚—
Problem. Find an easy way of building an
𝑛 × π‘› Latin Square.
β—¦ Hint. Where have we seen Latin squares in
this course before?
β—¦ Consider a finite group 𝐺 = 𝑔1 , 𝑔2 , … , 𝑔𝑛 .
β—¦ The multiplication table of 𝐺 is a Latin square.
β—¦ For example, consider the set 𝐺 = 0,1,2,3,4
+
0 1
2
3 4
under addition π‘šπ‘œπ‘‘ 5.
0
0
1
2
3
4
1
1
2
3
4
0
2
2
3
4
0
1
3
3
4
0
1
2
4
4
0
1
2
3
Reminder: Why a Group is a Latin
Square
ο‚—
Why is the multiplication table of
𝐺 = 𝑔1 , 𝑔2 , … , 𝑔𝑛 a Latin square?
β—¦ Consider the row/column that corresponds to
𝑔𝑖 .
β—¦ If two of the elements in the row/column are
identical, we have 𝑔𝑖 𝑔𝑗 = 𝑔𝑖 π‘”π‘˜ .
β—¦ Multiplying by π‘”π‘–βˆ’1 implies
from the left yields 𝑔𝑗 = π‘”π‘˜ .
0
1
2
3
4
0
0
1
2
3
4
1
1
2
3
4
0
2
2
3
4
0
1
3
3
4
0
1
2
4
4
0
1
2
3
3
12/4/2014
Latin Rectangles
ο‚—
Problem. Consider an π‘š × π‘› Latin
rectangle with π‘š ≀ 𝑛 (i.e., no two
elements in the same row/column are
identical).
β—¦ Can we always complete the rectangle to a
Latin square?
β—¦ We already know that this is true when
π‘š = 0, 𝑛 βˆ’ 1, 𝑛.
Rephrasing the Problem
ο‚—
Claim. Every π‘š × π‘› Latin rectangle
(where π‘š < 𝑛) can be extended to an
π‘š + 1 × π‘› Latin rectangle.
ο‚—
To prove the claim, we build a bipartite
graph 𝐺 = 𝑉1 βˆͺ 𝑉2 , 𝐸 .
β—¦ 𝑉1 consists of 𝑛 vertices that correspond to
the 𝑛 symbols of the rectangle.
β—¦ 𝑉2 consists of 𝑛 vertices that correspond to
the 𝑛 entries of the new row (row π‘š + 1).
β—¦ An edge 𝑣1 , 𝑣2 ∈ 𝑉1 × π‘‰2 means that
symbol 𝑣1 can be placed in cell 𝑣2 .
4
12/4/2014
The Graph
ο‚—
Completing the additional row is
equivalent to finding a perfect matching
in the graph.
𝑉1
𝑉2
A
1
B
2
C
3
D
4
E
5
Reminder: Hall's Marriage Theorem
Theorem. Let 𝐺 = 𝑉1 βˆͺ 𝑉2 , 𝐸 be a
bipartite graph with 𝑉1 = 𝑉2 .
ο‚— There exists a perfect matching in 𝐺 if and
only if for every 𝐴 βŠ‚ 𝑉1 , we have
𝐴 ≀ 𝑁 𝐴 .
ο‚—
Philip Hall
5
12/4/2014
Degrees
Every vertex of 𝑉1 has degree 𝑛 βˆ’ π‘š.
ο‚—
β—¦ Every symbol is in π‘š columns of the rectangle.
Every vertex of 𝑉2 has degree 𝑛 βˆ’ π‘š.
ο‚—
β—¦ Every column already contains π‘š symbols.
𝑉1
𝑉2
A
1
B
2
C
3
D
E
4
5
Concluding the Proof
ο‚—
Consider a subset 𝐴 βŠ‚ 𝑉1 .
β—¦ The sum of the degrees of the vertices of 𝐴 is
π‘›βˆ’π‘š 𝐴 .
β—¦ Since every vertex of 𝑉2 has degree 𝑛 βˆ’ π‘š,
we have 𝐴 β‰₯ 𝑁 𝐴 .
ο‚—
By Hall’s theorem there exists a perfect
matching, which implies that we can
always add another row to the Latin
rectangle, as long as it is not a square.
6
12/4/2014
Partially Filled Latin Square
ο‚—
We define a partially filled Latin square of
order 𝑛 to be an 𝑛 × π‘› table such that:
β—¦ Some of the cells of the table are filled with
one of 𝑛 symbols.
β—¦ Any row and column contains each symbol at
most once.
Completing Partially Filled Latin
Squares
ο‚—
What is the minimum number of filled
entries in a partially filled Latin square of
order 𝑛, such that the table cannot be
completed into a Latin square?
7
12/4/2014
A Tight Bound
ο‚—
Theorem. Any partially filled Latin square
of order 𝑛 with at most 𝑛 βˆ’ 1 entries can
be completed to a valid Latin square.
Matrix Representation
ο‚—
An 𝑛 × π‘› Latin square can be represented
as by 3 × π‘›2 matrix.
1 2 2 4 β‹―
𝑅
𝐢= 1 3 1 1 β‹―
1 4 2 4 β‹―
𝐸
In Row 2, Column 3,
the Entry is 4
8
12/4/2014
Valid Matrix Representation
ο‚—
Claim. A 3 × π‘›2 matrix 𝑀 with entries in
𝑆𝑛 = 1,2, … , 𝑛 represents an 𝑛 × π‘›
Latin square iff when taking any two rows
of 𝑀 every element of 𝑆𝑛2 appears exactly
once.
1
1
1
2
3
4
2
1
2
2
1
4
β‹―
β‹―
β‹―
Not valid!
Proof: Valid Matrix Representation
ο‚—
Proof.
β—¦ Asking the first two rows to contain every pair
exactly once corresponds to having a unique
entry in every cell of the square.
β—¦ Asking the first and third rows to contain
every pair once corresponds to having every
symbol exactly once in every row.
β—¦ Asking last two rows to contain every pair
once corresponds to having every symbol
exactly once in every column.
9
12/4/2014
Conjugate Latin Squares
ο‚—
Two Latin squares of order 𝑛 are
conjugate if their matrix representations
are identical up to a permutation of the
rows.
β—¦ By the previous claim, permuting the rows of
such a matrix results in a different Latin
square.
A Weaker Theorem
ο‚—
We prove a weaker variant of the
theorem:
β—¦ Theorem. Any partially filled 𝑛 × π‘› Latin
square with at most 𝑛 βˆ’ 1 entries consisting
of π‘š ≀ 𝑛/2 distinct symbols, can be
completed to a valid Latin square.
10
12/4/2014
First Steps of the Proof
ο‚—
By conjugation, we may replace the
condition at most 𝑛/2 distinct symbols
with all the entries being in the first 𝑛/2
rows.
β—¦ π‘š – the number of non-empty rows (≀ 𝑛/2).
β—¦ π‘Ÿπ‘– – the number of entries in row 𝑖.
β—¦ We reorder the rows of the matrix so that
π‘Ÿ1 β‰₯ π‘Ÿ2 β‰₯ β‹― β‰₯ π‘Ÿπ‘š .
β—¦ Notice that π‘Ÿ1 + π‘Ÿ2 + β‹― + π‘Ÿπ‘š ≀ 𝑛 βˆ’ 1.
The Plan
Suffices to prove: The partial square can
be completed to an π‘š × π‘› Latin
rectangle.
ο‚— Suffices to prove #2: For every β„“ ≀ π‘š, if
we completed rows 1, . . , β„“ βˆ’ 1, we can
complete row β„“.
ο‚—
π‘Ÿ1 = π‘Ÿ2 = π‘Ÿ3 = 2
π‘Ÿ4 = 1
β„“=3
11
12/4/2014
Perfect Matchings, Yet Again
To prove that we can complete row β„“, we
again use Hall’s theorem.
ο‚— Define a bipartite graph 𝐺 = 𝑉1 , 𝑉2 , 𝐸 :
ο‚—
β—¦ Every vertex of 𝑉1 corresponds to a symbol
that is missing in the ℓ’th row.
β—¦ Every vertex of 𝑉2 corresponds to an empty
cell of the ℓ’th row.
β—¦ An edge 𝑣1 , 𝑣2 ∈ 𝐸 implies
that β€œsymbol” 𝑣1 may be
placed in β€œcell” 𝑣2 .
β—¦ We have 𝑉2 = 𝑛 βˆ’ π‘Ÿβ„“ .
The End
Good luck
with your
exams!
12