Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematical Analysis of a Nim-like Matrix Game Leo Livshits, Ph. D

Similar presentations


Presentation on theme: "Mathematical Analysis of a Nim-like Matrix Game Leo Livshits, Ph. D"— Presentation transcript:

1 Mathematical Analysis of a Nim-like Matrix Game Leo Livshits, Ph. D
Mathematical Analysis of a Nim-like Matrix Game Leo Livshits, Ph.D., Stephen Morse ‘14, Edward Chuang ‘14 Department of Mathematics and Statistics, Colby College, Waterville, ME 04901 The Matrix Game Our matrix game is similar to Nim, but with more structure. The game board is a square matrix with non-negative integer entries. The two players take turns reducing a non-0 entry by 1. If the resulting matrix has determinant equal to 0, then the game is over and whoever went last wins. So what is a determinant? For the purposes of this presentation, the determinant of a matrix is simply a number that is algorithmically calculated from its entries. For math nerds: the determinant is 0 iff the matrix is non- invertible Odd Sum 2x2 Matrices Odd sum matrices are those which have either 1 or 3 odd entries. If there are 3 odds entries, then there is only one even entry so one of ad or bc is even and the other is odd. Therefore ad – bc cannot be 0. So Player 1 can decrement the only even entry giving Player 2 a matrix with 4 odd entries, which must return to Player 1 with 3 odd entries again. If there is only 1 odd entry then things get more complicated. However, we showed that for any matrix with 1 odd entry, there is always a move for the next player such that the resulting matrix never has its ±determinant as an entry on the ±diagonal. Furthermore, if the sum is prime then the determinant cannot be 0 regardless of how many odds there are. If the determinant is 0, then the matrix is non-invertible and therefore one row is a multiple of the other. It is not too hard to show that in this case, the sum of the elements in the 2x2 matrix cannot be prime. Equivalent Games We define two games to be equivalent if there is a permutation of the entries of the matrices such that: The permutation changes one matrix into the other. The permutation does not change the invertibility of any game matrix. We proved that a permutation of the entries with these properties is simply a composition of row swaps, column swaps, and transpositions. It follows that the permutation can only change the sign determinant of any game matrix. Key points of the general argument: If a fixed permutation of the entries preserves invertibility for any NxN matrix, then it must leave the set of NxN permutation matrices invariant since the only invertible matrices with N 1s and 0s for all other entries are the NxN permutation matrices. 3 6 4 7 3 5 4 7 3 5 7 3 7 Computer Algorithm We implemented a computer algorithm (in Java) to help determine which games were winnable and not winnable. Some of the outputs for the 2x2 case are shown below. For the 3x3 case, the program did not prove sufficient to help us gain any intuition due to the remarkably large running time of O((n^2)!), even though the algorithm pruned all equivalent games. The last four outputs are good examples of the conclusions that we proved for matrices with odd, prime +1, and composite + 1 sums. Winner Sum P1 P2 4 1 5 6 3 7 8 9 10 13 11 20 12 29 35 14 47 15 56 16 64 17 84 18 104 19 120 145 21 165 22 183 23 220 24 256 25 286 26 318 27 364 28 398 455 30 511 Basic Strategy Understanding how each move affects the determinant is essential to formulating a strategy. In the 2x2 case, the effect of each move is easily calculated. Call the NW to SE diagonal the positive diagonal. Decrementing an element of the positive diagonal decreases the determinant by an amount equal to the other element on the positive diagonal (see below). Similarly, call the NE to SW diagonal the negative diagonal. Decrementing an element of the negative diagonal increases the determinant by an amount equal to the other element on the negative diagonal (see below). Therefore a player can only end the game on their turn if one of the following is true: The determinant of the matrix is equal to an entry on the positive determinant. The determinant of the matrix is equal to the negative of an entry on the negative determinant. Even Sum 2x2 Matrices The conclusion for even sum matrices follows from what we know about the odd sum matrices. If Player 1 starts with an even sum matrix, then Player 2 receives an odd sum matrix and will win for the reasons outlined above unless Player 1 ends the game on the first move. Even numbers are either 1 more than a prime or 1 more than a composite odd number. In the prime + 1 case, then Player 2 receives a prime sum matrix, which cannot have determinant 0. Therefore Player 1 cannot win on the first turn; so Player 2 wins. In the composite + 1 case, Player 1 can only win on the first move if the matrix has its ±determinant as an entry on the ±diagonal. How about 3x3 matrices? As was no surprise, the game becomes far more complicated when we extend our games to include 3x3 matrices. For one, the claim that matrices with elements that sum to a prime cannot have determinant 0 is no longer true. For example, the matrix below has sum 13 but has determinant 0. Acknowledgements We would like to acknowledge: Professor Leo Livshits for his guidance and support Professor Kyle Burke for introducing us to this game The research assistantship funding given to us by Colby College


Download ppt "Mathematical Analysis of a Nim-like Matrix Game Leo Livshits, Ph. D"

Similar presentations


Ads by Google