The sum the numbers must add up to is determined mathematically, i.e. every number to be used is added together, and the grand sum is divided by the number of squares per side in the grid.Thus, ( 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45) & ( 45 / 3 = 15 ) so each line in the square, horizontally, vertically & diagonally in the finished square must equal 15 for it to be a proper Magic Square. One solution is shown below:
The next level of difficulty would of course be an Order 4 Magic Square, which must have a grid of 4 cells per side, for a total of 16, thus necessitating the use of numbers 1 through 16. Again, the grid would look like this:
If we now add all the numbers to be used in this grid, 1 through 16, we obtain a total of 136, which must be divided by 4 (the number of cells per side), to obtain 34. Thus, each line of numbers must add up to this last total for the completed square to be a magic square.Of course, one can solve the Order 4 square by the usual trial & error method, but several people have endeavored to find a more 'elegant' solution. One such method is to write the 16 numbers out in sequence, as shown in the box, below left, and then to transpose the middle groups top & bottom, left & right, as shown. Finally, diagonally switch the 4 numbers at the heart of the grid and you come up with a working magic square.
Albrecht Durer's haunting engraving titled 'Melancholia' shows an intellectual struggling with near despair at the complexities of some problem, and a Magic Square of Order 4 is shown on the wall. It is a mirror image of the one above, but has lines swapped and probably was altered to better show the date the engraving was made, AD 1514, as the numbers 15 & 14 appear at bottom centre.
One particular Order 4 Magic square is the 'diabolic' square, where not only is the whole a true Magic square, but indeed any 4 adjacent cells total 34! Very unusual and outside of the reversed forms, quite unique in my opinion. I've shown 4 adjacent cells in yellow, and 4 adjacent ones in blue which both total the required 34, but you can see that all possible combinations fulfill the requirement.
Of course, these diabolic squares may be extended ad infinitum in all directions and many different forms of Magic Squares can be thus created. In the following I show the above diabolic square at upper left, and other examples below to the right, (one in blue, one in green.) Bear in mind that this grid could be extended horizontally as well as vertically - might make a nice lampshade for a mathematician.
The next step in Magic squares is obviously the Order 5,which would fit into a grid of 25 cells and contain the numbers 1 through 25. These first 25 numbers add up to 325, and since the grid has 5 cells per side, the magic constant here would be 65.
I present one such Order 5 Magic Square but realise that a large range of arrangements are indeed possible which satisfy the conditions.
May I suggest you try to come up with one or two of these Order 4 or 5 Magic Squares? I would be glad to hear of your successes, of course, but look forward to some of my readers who can shed insight into the math in their construction.For the readers who stuck it out this long, the question surely must be if there are Order 6, 7, 8 , etc. Magic Squares. The answer of course is yes, and I can show one example of an Order 6 below, but space on this blog precludes further adventures beyond.

As one can see in the sample Order 6 above, all the numerals from 1 through 36 are inserted in the 36 cells to obtain a constant of 111 for the horizontal, vertical and diagonal lines. By now, those of you who still haven't finished the bottle should be able to calculate what the constants for the upper level Magic Squares are, or indeed, whether they are even possible.








