The Shattered Urn: Rebuilding Objects with Linear Algebra
Total Page:16
File Type:pdf, Size:1020Kb
The Shattered Urn: Rebuilding Objects with Linear Algebra John Burkardt Department of Mathematics University of South Carolina 15 November 2018 1 / 99 The Shattered Urn: Rebuilding Objects with Linear Algebra Colloquium and Seminar Series sponsored by: Society of Industrial and Applied Mathematics Pi Mu Epsilon Mathematics Honor Society ... 12:00-1:00, 15 November 2018 138 McKenna Hall University of Pittsburgh at Greensburg References: http://people.math.sc.edu/burkardt/presentations/polyominoes 2018 upg.pdf Marcus Garvie, John Burkardt, A New Mathematical Model for Tiling Finite Regions of the Plane with Polyominoes, submitted. 2 / 99 The Portland Vase 25AD - A Reconstruction Problem 3 / 99 Ostomachion - Archimedes, 287-212 BC 4 / 99 Tangrams - Song Dynasty, 960-1279 5 / 99 Dudeney - The Broken Chessboard (1919) 6 / 99 Golomb - Polyominoes (1965) 7 / 99 Puzzle Statement 8 / 99 Tile Variations: Reflections, Rotations, All Orientations 9 / 99 Puzzle Variations: Holes or Infinite Regions 10 / 99 Is It Math? \One can guess that there are several tilings of a 6 × 10 rectangle using the twelve pentominoes. However, one might not predict just how many there are. An exhaustive computer search has found that there are 2339 such tilings. These questions make nice puzzles, but are not the kind of interesting mathematical problem that we are looking for." \Tilings" - Federico Ardila, Richard Stanley 11 / 99 Is it \Simple" Computer Science? 12 / 99 Sequential Solution: Backtracking 13 / 99 Is it \Clever" Computer Science? 14 / 99 Simultaneous Solution: Linear Algebra? 15 / 99 Exact Cover Knuth: \Tiling is a version of the exact cover problem." Select rows of a 0/1 matrix so every column has a 1: 0 0 0 1 0 1 1 0 1 B 1 0 0 1 0 0 1 C B C B 0 1 1 0 0 1 0 C B C B 1 0 0 1 0 0 0 C B C @ 0 1 0 0 0 0 1 A 0 0 0 1 1 0 1 Solution: 0 0 0 1 0 1 1 0 1 @ 1 0 0 1 0 0 0 A 0 1 0 0 0 0 1 Column Sums: 1 1 1 1 1 1 1 16 / 99 Exact Cover Transposed Transposed problem: select columns of A so every row has a 1: 0 0 1 0 1 0 0 1 B 0 0 1 0 1 0 C B C B 1 0 1 0 0 0 C B C A = B 0 1 0 1 0 1 C B C B 1 0 0 0 0 1 C B C @ 1 0 1 0 0 0 A 0 1 0 0 1 1 Vector x selects columns 1, 4, and 5, solving Ax = b: 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1 B C 0 B C B 1 0 0 C B C B 1 C B C B 0 C B C A(:,[1,4,5])= B 0 1 0 C x = B C b = B 1 C B C B 1 C B C B 1 0 0 C B C B 1 C B C B 1 C B C B 1 0 0 C @ A B 1 C @ A 0 @ A 0 0 1 1 17 / 99 Equations: A Cell Is Covered Once By Some Tile L U P I z T 18 / 99 Variables: X Pentomino Example v1 v3 v5 v2 v4 v6 19 / 99 Constraints: Depending on the problem and how we think about it, we may need to add some constraints, which will be either additional linear equations, or linear inequalities. Thus, for the 4 × 5 tiling problem just mentioned, in which the X pentomino has 6 possible placements: Use the X pentomino exactly twice: v1 + v2 + v3 + v4 + v5 + v6 = 2 Use the X pentomino no more than twice: v1 + v2 + v3 + v4 + v5 + v6 ≤ 2 Use a total of 4 pentominoes of any kind: v1 + v2 + ::: + vn = 4 Every pentomino placement must be used once or not at all: vi 2 f0; 1g 20 / 99 Linear System Logic 0 V 1 V 2 V 3 V 4 V 5 V 6 1 0 cover? 1 0 use 1 C1 0 1 0 1 0 0 1 B C 1 B C B C2 0 0 1 0 1 0 C B C B 1 C B C B 0 C B C B C3 1 0 1 0 0 0 C B C B 1 C B C B 0 C = B C B C4 0 1 0 1 0 1 C B C B 1 C B C B 1 C B C B C5 1 0 0 0 0 1 C B C B 1 C B C B 1 C B C B C6 1 0 1 0 0 0 C @ A B 1 C @ A 0 @ A C7 0 1 0 0 1 1 1 21 / 99 The Reid Polygon to Be Tiled 22 / 99 The Reid Polygon Cells 23 / 99 The Reid Equations: e1 : e8 e1 e2 e3 e4 e5 e6 e7 e8 24 / 99 The Reid Variables x1 : x10 x1 x3 x2 x4 x5 x6 x7 x8 x9 x10 We start to see how the equations and variables combine: x1 + x6 =1 Cell 1 must be covered once x3 + x6 =1 Cell 2 must be covered once x1 + x2 + x7 =1 Cell 3 must be covered once :::::: 25 / 99 The Reid Equations: 8 Equations, 10 Unknowns x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 b e1 : x1 +x6 = 1 e2 : +x3 +x6 = 1 e3 : x1 +x2 +x7 = 1 e4 : x3 +x4 +x7 +x8 = 1 e5 : x5 +x8 = 1 e6 : x2 +x9 = 1 e7 : x4 +x9 +x10 = 1 e8 : x5 +x10 = 1 26 / 99 The Reid Linear System: 8 Equations, 10 Unknowns A x = b 0 1 x1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 B x2 C 1 B C B 0 0 1 0 0 1 0 0 0 0 C B x3 C B 1 C B C B C B C B 1 1 0 0 0 0 1 0 0 0 C B x4 C B 1 C B C B C B C B 0 0 1 1 0 0 1 1 0 0 C B x5 C B 1 C B C B C = B C B 0 0 0 0 1 0 0 1 0 0 C B x6 C B 1 C B C B C B C B 0 1 0 0 0 0 0 0 1 0 C B x7 C B 1 C B C B C B C @ 0 0 0 1 0 0 0 0 1 1 A B x8 C @ 1 A B C 0 0 0 0 1 0 0 0 0 1 @ x9 A 1 x10 27 / 99 Reduced Row Echelon Form of Reid Linear System Notice that variables 7, 9 and 10 are free! x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 b e1 : 1 1 −1 = 0 e2 : 1 1 = 1 e3 : 1 1 −1 = 0 e4 : 1 1 1 = 1 e5 : 1 1 = 1 e6 : 1 −1 1 = 0 e7 : 1 1 = 0 e8 : = 0 28 / 99 Drop Zero Row, Add Degrees of Freedom We add placeholder equations for variables 7, 9 and 10. x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 b e1 : 1 1 −1 = 0 e2 : 1 1 = 1 e3 : 1 1 −1 = 0 e4 : 1 1 1 = 1 e5 : 1 1 = 1 e6 : 1 −1 1 = 0 f1 :1=? e7 : 1 1 = 0 f2 :1=? f3 :1=? 29 / 99 Solutions for 8 Binary Right Hand Sides x1 : 0 0 1 1 −1 −1 0 0 x2 : 1 1 0 0 1 1 0 0 x3 : 0 0 1 1 −1 −1 0 0 x4 : 1 0 0 −1 1 0 0 −1 x5 : 1 0 1 0 1 0 1 0 x6 : 1 1 0 0 2 2 1 1 x7 :00001111 x8 : 0 1 0 1 0 1 0 1 x9 :00110011 x10 :01010101 30 / 99 The Reid Tilings (Labeled) x6 x6 x8 x2 x4 x5 x2 x10 x6 x1 x3 x7 x5 x5 x9 x9 31 / 99 A Universal Algorithm for Polyomino Tiling? 1 Number the cells in the polygon (equations); 2 Number every placement of a polyomino in the polygon (variables); 3 Construct the linear system; 4 Solve the linear system. Formally OK, but what's hard here? What could go wrong? 32 / 99 A More Realistic Algorithm for Polyomino Tiling 1 Number the cells in the polygon (equations); 2 If multiple polyomino shapes, add constraint equations; 3 Generate every rotation or reflection of each polyomino; 4 Number every placement of a polyomino in the polygon (variables); 5 Construct the (rectangular) linear system; 6 Expand to a square system, including degrees of freedom; 7 Generate every possible right hand side; 8 Exact solution required (integer system, rational answers!); 9 Only accept \binary" solutions. 10 Count, plot, analyze solutions. In some cases, thousands of solutions may be found. 33 / 99 4x5 Example: Region R 34 / 99 4x5 Example: Tiles P 35 / 99 MATLAB Programs Go to http://people.sc.fsu.edu/∼jburkardt Choose the MATLAB examples Look for polyomino monohedral example reid Many more polyomino codes available. 36 / 99 4x5 Example: Discussion of coding % % Step 1: Define Region: % r m = 4 ; r n = 5 ; r shape = ones ( r m , r n ) ; r shape(3,3:4) = 0; r s h a p e 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 37 / 99 4x5 Example: Discussion of coding % % Step 2: Define Polyomino Shapes: % p num = 3 ; p shapes = zeros ( r m , r n , p num ) ; p shapes(1,1:3,1) = 1; p shapes(2,1:2,1) = 1; p shapes(1:2,1:2,2) = 1; p shapes(1,3,3) = 1; p shapes(2,1:3,3)= 1; 38 / 99 4x5 Example: Discussion of coding % % Step 3: Check Polyomino Shapes: % p shapes(1:2,1:3,1) 1 1 1 1 1 0 p shapes(1:2,1:2,2) 1 1 1 1 p shapes(1:2,1:3,3) 0 0 1 1 1 1 % % Step 4: Indicate multiplicity.