Bachet’s magic square

In the category of mathematical games, I ask for the famous magic square! The principle is simple and known to many: take a square grid on side n and place all the numbers from 1 to n x n in it, so that the sum on the lines, columns, and diagonals of this square are the same.

Humanicus
5 min readJan 30, 2020

Simple to state, is this problem also to solve? Do not hesitate to think before moving on …

In 1612, Claude-Gaspar Bachet de Méziriac proposed a method of building a magic square for any square grid of odd order (that is to say with an odd number of boxes on the side).

Bachet de Méziriac’s method for building a magic square.
  • The first step is to extend the square you want to complete into an “inclined” grid.
  • We then place the numbers progressing along the diagonals of this grid, starting from the top and going down to the right.
  • Once this is done, we move all the numbers that are outside the base square. Those on the left are moved to the right, those from top to bottom and so on to fill in the empty boxes.

This method always works… But why? This is what interests us here. I will not make a rigorous demonstration of this construction, I leave the leisure to the most relentless: the idea is simply to present the key arguments of this principle.

Diagonals

Before we start, let’s look at the diagonals, already filled by this method. They all have the same amount — and that’s happy! In fact, the diagonal from the top left to the bottom right has numbers that progress from 1 to 1, with the number 25 in the middle.

The other diagonal shows numbers that increase from 7 to 7, always with 25 in the middle. There is also talk of arithmetic progression, but that is of little importance.

What is important, on the other hand, is that on the one hand, this configuration is only possible because we fill an odd-order grid — otherwise, the two diagonals of the square do not intersect!.

Also, the sum on these two diagonals is 7 x 25, or 175. 25 is indeed the median of all the numbers to be written in the square — the number in the middle if you prefer. In short, everything starts for the better.

diagonals sum both at 175

Rethink the problem

We will now rewrite all the numbers arranged on our square. Here is our new writing:

Decomposition of grid numbers

You will notice then that on the diagonals that go down to the left — or that go up to the right, it depends — all the first numbers are the same. For the diagonals that descend to the bottom right,it’s the second one who is in common.

Each box of our grid can, therefore, be translated by a couple of numbers, the first being chosen from 1, 2, 3, 4, 5, 6, 7, the second from 0, 7, 14, 21, 28, 35, 42 We will call these two numbers the identifiers of the starting number. The number 41 to be placed in the square is identified by the couple (6.35).

The idea is therefore as follows: complete the empty squares of the square so that, on each row and each column, the squares all have a first and a second different identifier, like sudoku. For example, we could align (3.21) and (2.14). On the other hand, it is impossible to place (1,7) and (5,7) on the same row or column, since their second identifier is the same.

Let’s start by looking at the interior square, the one we want to complete. On each line, none of these boxes carry either the first or the second identifier in common. So there is no problem at the moment.

Let’s move on to the numbers above the square, and look for example (1,7). All the numbers with 1 as the first identifier are on the diagonal which descends to the left from this box, while all the numbers which have 7 as the second identifier are on the diagonal which descends to the right. However, these two diagonals cannot go down more than 6 boxes! Going down (1.7) by 7 boxes, it is therefore certain that no box on the new line will carry a common identifier.

The red box cannot have any identifier in common with the boxes of its row and column.

This reasoning is also valid for all the numbers above and below the square.

Remain to deal with the numbers on the left and on the right now. The reasoning is very similar, except that some boxes have already been moved and we must be careful that this does not generate new obstacles.

These are all our numbers placed! All that remains is to verify.

On each row and each column, all the first identifiers and all the second identifiers are different. However, there are only 14 possible places, for as many existing identifiers, it is therefore that they all appear on this line / column. In other words, the sum on each row or column is the sum of all possible identifiers, namely the value 1 + 2 + 3 + 4 + 5 + 6 + 7 + 0 + 7 + 14 + 21 + 28 + 35 + 42 , or 175.

--

--

Humanicus

Please follow me since now we need 100 min follower on medium