Mathematical Recreations and Essays
First Subsidiary Square Figure vi.
Second Subsidiary Square Figure vii.
Resulting Magic Square Figure viii.
which lie in a diagonal line sloping downwards to the right (see figure vi) according to the rule (ii) in De la Loubère’s method. The cells filled by
- Mémoires de l’Académie des Sciences for 1705, part 1, pp. 127–171.
the same number form a broken diagonal. It follows that every row and every column contains one and only one 1, one and only one 2, and so on. Hence the sum of the numbers in every row and in every column is equal to 15; also, since we placed 3, which is the average of these numbers, in the top left-hand corner, the sum of the numbers in the left diagonal is 15; and, since the right diagonal contains one and only one of each of the numbers 1, 2, 3, 4, and 5, the sum of the numbers in that diagonal also is 15.
The second of the subsidiary squares (figure vii) is constructed in a similar way with the numbers 0, 5, 10, 15, and 20, except that the mean number 10 is placed in the top right-hand corner; and the broken diagonals formed of the same numbers all slope downwards to the left. It follows that every row and every column in figure vii contains one and only one 0, one and only one 5, and so on; hence the sum of the numbers in every row and every column is equal to 50. Also the sum of the numbers in each diagonal is equal to 50.
If now we add together the numbers in the corresponding cells of these two squares, we shall obtain 25 numbers such that the sum of the numbers in every row, every column, and each diagonal is equal to , that is, to 65. This is represented in figure viii. Moreover, no two cells in that figure contain the same number. For instance, the numbers 21 to 25 can occur only in those five cells which in figure vii are occupied by the number 20, but the corresponding cells in figure vi contain respectively the numbers 1, 2, 3, 4, and 5; and thus in figure viii each of the numbers from 21 to 25 occurs once and only once. De la Hire preferred to have the cells in the subsidiary squares which are filled by the same number connected by a knight’s move and not by a bishop’s move; and usually his rule is enunciated in that form.
By permuting the numbers 1, 2, 4, 5 in figure vi we get 4! other arrangements, each of which combined with that in figure vii would give a magic square. Similarly by permuting the numbers 0, 5, 15, 20 in figure vii we obtain 4! other squares, each of which might be combined with any of the 4! arrangements deduced from figure vi. Hence altogether we can obtain in this way 576 magic squares of the fifth order.
There is yet another method of constructing odd squares which is due to Poignard, and was improved by De la Hire in the memoir already cited. I shall not discuss it, because, though for certain assigned values of it is simpler than the methods which I have given, it depends on
the form of , and particularly on the number of prime factors of . In the case of a square of the fifth order, this gives an even larger number of magic squares than the methods of De la Loubère, Bachet, and De la Hire. I may also add that it has been shown that magic squares whose order is a prime number can be constructed by a rule similar to De la Loubère’s, except that we begin by placing 1 in the bottom left-hand cell, and the subsequent consecutive numbers fill cells forming a knight’s path on the square and not a bishop’s path. A square of the fifth order of this kind is given in figure xiii on page 136. There are 2880 magic squares of the fifth order of this kind.
De la Hire showed that, apart from mere inversions, there were 57600 magic squares of the fifth order which could be formed by the methods he enumerated. Taking account of other methods, it would seem that the total number of magic squares of the fifth order is very large, perhaps exceeding 500000.
MAGIC SQUARES OF AN EVEN ORDER. The above methods are inapplicable to squares of an even order. I proceed to give two methods for constructing any even magic square of an order higher than two.
It will be convenient to use the following terms. Two rows which are equidistant, the one from the top, the other from the bottom, are said to be complementary. Two columns which are equidistant, the one from the left-hand side, the other from the right-hand side, are said to be complementary. Two cells in the same row, but in complementary columns, are said to be horizontally related. Two cells in the same column, but in complementary rows, are said to be vertically related. Two cells in complementary rows and columns are said to be skewly related; thus, if the cell is horizontally related to the cell , and the cell is vertically related to the cell , then the cells and are skewly related; in such a case if the cell is vertically related to the cell , it will be horizontally related to the cell , and the cells and are skewly related: the cells constitute an associated group, and if the square is divided into four equal quarters, one cell of an associated group is in each quarter.
A horizontal interchange consists in the interchange of the numbers in two horizontally related cells. A vertical interchange consists in the interchange of the numbers in two vertically related cells. A skew interchange consists in the interchange of the numbers in two skewly related cells. A cross interchange consists in the change of the numbers
in any cell and in its horizontally related cell with the numbers in the cells skewly related to them; hence, it is equivalent to two vertical interchanges and two horizontal interchanges.
First Method. This method is the simplest with which I am acquainted, and I believe, at any rate as far as concerns singly-even squares, was published for the first time in 1893.
Begin by filling the cells of the square with the numbers in their natural order commencing (say) with the top left-hand corner, writing the numbers in each row from left to right, and taking the rows in succession from the top. I will commence by proving that a certain number of horizontal and vertical interchanges in such a square must make it magic, and will then give a rule by which the cells whose numbers are to be interchanged can be at once picked out.
First, we may notice that the sum of the numbers in each diagonal is equal to , where ; hence the diagonals are already magic, and will remain so if the numbers therein are not altered.
Next, consider the rows. The sum of the numbers in the th row from the top is . The sum of the numbers in the complementary row, that is, the th row from the bottom, is . Also the number in any cell in the th row is less than the number in the cell vertically related to it by . Hence, if in these two rows we make interchanges of the numbers which are situated in vertically related cells, then we increase the sum of the numbers in the th row by , and therefore make that row magic; while we decrease the sum of the numbers in the complementary row by the same number, and therefore make that row magic. Hence, if in every pair of complementary rows we make interchanges of the numbers situated in vertically related cells, the square will be made magic in rows. But, in order that the diagonals may remain magic, either we must leave both the diagonal numbers in any row unaltered, or we must change both of them with those in the cells vertically related to them.
The square is now magic in diagonals and in rows, and it remains to make it magic in columns. Taking the original arrangement of the numbers (in their natural order) we might have made the square magic in columns in a similar way to that in which we made it magic in rows.
- See an article in the Messenger of Mathematics, Cambridge, September, 1893, vol. XXIII, pp. 65–69.
The sum of the numbers originally in the th column from the left-hand side is . The sum of the numbers originally in the complementary column, that is, the th column from the right-hand side, is . Also the number originally in any cell in the th column was less than the number in the cell horizontally related to it by . Hence, if in these two columns we had made interchanges of the numbers situated in horizontally related cells, we should have made the sum of the numbers in each column equal to . If we had done this in succession for every pair of complementary columns, we should have made the square magic in columns. But, as before, in order that the diagonals might remain magic, either we must have left both the diagonal numbers in any column unaltered, or we must have changed both of them with those in the cells horizontally related to them.
It remains to show that the vertical and horizontal interchanges, which have been considered in the last two paragraphs, can be made independently, that is, that we can make these interchanges of the numbers in complementary columns in such a manner as will not affect the numbers already interchanged in complementary rows. This will require that in every column there shall be exactly interchanges of the numbers in vertically related cells, and that in every row there shall be exactly interchanges of the numbers in horizontally related cells. I proceed to show how we can always ensure this, if is greater than 2. I continue to suppose that the cells are initially filled with the numbers in their natural order, and that we work from that arrangement.