Monday, 6 February 2012

Puzzle: Magic Square

I'm not entirely sure if this puzzle already has a name... it probably does, but I haven't found it. I think it's probably fair to call it a magic square, since the idea is to use a set of numbers in a square to achieve the same total in the rows, columns and long diagonals.  The difference here is that the numbers are four sets of the numbers 1-4, in four different colours (white, grey, black and yellow), and there's an additional condition that no row, column or long diagonal must have a colour repeated.


To make it easier to explain, here is a set of blocks, showing the four digits 1-4 in their four colours (sixteen blocks in total).



There are a number of solutions to this puzzle, and I have no intention of calculating the number.  Instead, I'm going to look at an example solution, and discuss my thoughts on it, so that - hopefully - you'll be able to solve similar problems in the future.

I was going to insert a few line breaks here, just in case you're included to try and solve the problem without the solution.  

However, I suspect the answer is complicated enough that you won't solve it just by glancing at the answer!

Here's one solution, then:


There are a number of comments I'd like to make on this solution, but before I do, I'd like to introduce (or re-introduce, if you've seen it before) a distance that I call the knight-move.  In Chess, the knight moves by going one square forwards, backwards, or left or right, followed by two squares left, right, or backwards or forwards (at 90o to the original direction) .  Again, it's easier to show with a diagram, so here goes:




This motif shows up a number of times in the magic square puzzle here, and in many other puzzles of the type, "Arrange the numbers so that such-and-such don't appear in the same row or column."  Let's look at the solution again; firstly, here are all the 4s.


Can you see how the 4s are all connected by a knight-move, starting from the four in the top corner?  The sequence grey-yellow-white-black is a series of three knight-moves.

The same applies for any of the other numbers, for example, the 2s start from the bottom right.  The whole solution has rotational symmetry - if you imagine moving the grid around by a quarter turn, then you find the same solution for a different number (1, 4 , 2, 3 in this example).



The same also applies for the coloured numbers - in the next diagram I've highlighted the white numbers.  Starting in the lower right corner with 2, the white numbers are all connected by knight-moves (one across and two up, or two across and one down, etc).



Notice here that one knight move from the white 2 gives the white sequence (shown above), while the other knight move from that 2 gives the sequence for all the other 2s.



So, whenever you encounter any puzzle of the form, "Put the objects into the grid so that each row and column only contains one of each type of object" - whether it's numbers, letters, or shapes, remember the knight-move as a short cut towards the solution!

No comments:

Post a Comment