Sunday, 21 September 2014

Magic square with the position of 8 fixed




A magic square (of order 3) is a 3x3 matrix consisting of distinct numbers from 1 to 9, where the numbers in each row, column and diagonal add up to 15.



For example, the following would be a magic square:


A magic square (Source: Wikipedia)


The problem is to construct a magic square that has the position of the number 8 fixed.


A magic square with the position of 8 fixed



Answer



As Kendall mentions, it is impossible to move pieces out of a 3x3 grid in this manner. This is called the Lo Shu square, and is the only unique solution to the 3x3 magic grid puzzle.


The reason for this is actually rather simple. If you look at the Lo Shu square, you'll notice that the even numbers always appear in corners. To demonstrate why this would be, note that each row and column must sum to an odd number.



If a row contains an even number of odd numbers, then its solution is either $2(2N+1)+2N=6N+2$ or $3(2N)=6N$, both of which are divisible by two, and therefore cannot add to 15. If a row contains an odd number of odd numbers, then its solution is either $1(2N+1)+2(2N)=6N+1$ or $3(2N+1)=6N+3$, both of which are odd and therefore can equal 15.


This means that each row must contain and odd number of odd numbers. In a 3x3 grid, a row must contain either 1 or 3 odd numbers.


If the center contains an odd number, then two adjacent edges must contain an odd number. However, if two edges contain even numbers, then the corner between them must contain an even. However, if this is the case, the opposing diagonal must also contain two even numbers - but at this point, if it does, then a row contains three even numbers.


In the following grid, it is clear that the question marks indicate positions that must be, but can't be, even.


----------    ----------    ----------
| | | | | |EE| | |EE|EE|??|
---------- ---------- ----------
| |EE| | -> |EE|EE| | -> |EE|EE| |
---------- ---------- ----------
| | | | | | | | |??| | |

---------- ---------- ----------

It is trivial from this point to demonstrate that if there is an even number on an edge, then the grid is unsolvable. It is also trivial to demonstrate that if one even number is in a corner, the rest must be.


Therefore, every solution is the permutation of one solution: where the even numbers are in the corners; and if the even numbers are in the corners, then their positions are irrelevant, because a solution will always be a reflection of that position.


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...