3 Ways to Solve a Magic Square

Table of contents:

3 Ways to Solve a Magic Square
3 Ways to Solve a Magic Square
Anonim

Magic squares became very popular with the advent of math games like Sudoku. A magic square consists of an arrangement of whole numbers within a square grid in which the sum of each horizontal, vertical and diagonal row is a constant number, called the magic constant. This article will tell you how to solve any type of magic square, be it odd, singularly even or doubly even.

Steps

Method 1 of 3: Magic Square with Odd Number of Boxes

Solve a Magic Square Step 1
Solve a Magic Square Step 1

Step 1. Calculate the magic constant

You can find this number using a simple math formula, where n = number of rows or columns of your magic square. Being a square, the number of columns is always equal to the number of rows. So, for example, in a 3 x 3 magic square, n = 3. The magic constant is [n * (n 2 + 1)] / 2. Thus, in the 3 x 3 squares:

  • sum = [3 * (32 + 1)] / 2
  • sum = [3 * (9 + 1)] / 2
  • sum = (3 * 10) / 2
  • sum = 30/2
  • The magic constant for a 3 x 3 square is 30/2 or 15.
  • All numbers added together for rows, columns and diagonals must give this same value.
Solve a Magic Square Step 2
Solve a Magic Square Step 2

Step 2. Enter the number 1 in the center box on the top row

It always starts here when the magic square is odd, no matter how big or small the number is. So, if you have a 3 x 3 square, you will have to enter the number 1 in box 2; in one 15 x 15, you will have to put the 1 in box 8.

Solve a Magic Square Step 3
Solve a Magic Square Step 3

Step 3. Enter the remaining numbers using a “move up one box to the right” template

You will always fill in numbers in sequence (1, 2, 3, 4, etc.) by moving up one row and moving one column to the right. You will immediately notice that, in order to enter the number 2, you will have to go beyond the top row, outside the magic square. Okay - even though you will always be moving up and to the right, there are three predictable exceptions to consider:

  • If the movement takes you to a square beyond the first row of the magic square, you stay in the same column as that square, but enter the number in the bottom row.
  • If the movement brings you to the right of the magic square, you stay in the row of that box, but enter the number in the far left column.
  • If the move goes to an already occupied square, go back to the last cell you completed and place the next number directly below it.

Method 2 of 3: Individually Even Magic Square

Solve a Magic Square Step 4
Solve a Magic Square Step 4

Step 1. Try to understand what a singularly even square looks like

Everyone knows that an even number is divisible by 2, but, in magic squares, one must distinguish between singly and doubly even.

  • In a singularly even square, the number of boxes on each side is divisible by 2, but not by 4.
  • The smallest singularly even magic square possible is 6 x 6, as it cannot be decomposed into 2 x 2 magic squares.
Solve a Magic Square Step 5
Solve a Magic Square Step 5

Step 2. Calculate the magic constant

Use the same method seen for odd magic squares: the magic constant is equal to [n * (n2 + 1)] / 2, where n = number of squares per side. So, in the example of a 6 x 6 square:

  • sum = [6 * (62 + 1)] / 2
  • sum = [6 * (36 + 1)] / 2
  • sum = (6 * 37) / 2
  • sum = 222/2
  • The magic constant for a 6 x 6 square is 222/2 or 111.
  • All numbers added together for rows, columns and diagonals must give this same value.
Solve a Magic Square Step 6
Solve a Magic Square Step 6

Step 3. Divide the magic square into four equal-sized quadrants

Suppose we call A the upper left one, C the upper right one, D the lower left one, and B the lower right one. To figure out how big each square should be, simply divide the number of boxes in each row or column in half.

Thus, for a 6 x 6 square, each quadrant would be 3 x 3 boxes

Solve a Magic Square Step 7
Solve a Magic Square Step 7

Step 4. Give each quadrant a range of numbers equal to one quarter of the total number of squares in the assigned magic square

For example, with a 6 x 6 square, A should be assigned the numbers 1 to 9, B those in the range 10 - 18, C those from 19 to 27, and quadrant D the numbers 28 to 36

Solve a Magic Square Step 8
Solve a Magic Square Step 8

Step 5. Solve each quadrant using the methodology used for odd magic squares

You will need to start from quadrant A with the number 1, just as explained above. For the others, however, continuing with our example, you will have to start from 10, from 19 and from 23.

  • Treat the first number of each quadrant as if it were number one. Enter it in the middle box of the top row.
  • Treat each quadrant as if it were a magic square in its own right. Even if there is an empty box in an adjacent quadrant, ignore it and use the exception rule that fits your situation.
Solve a Magic Square Step 9
Solve a Magic Square Step 9

Step 6. Make Selections A and D

If you tried to add the columns, rows and diagonals now, you would notice that the result is not yet your magic constant. To complete the magic square you have to swap a few squares between the left, upper and lower quadrants. We will call those zones Selection A and Selection D.

  • With a pencil, mark all the boxes in the top row up to the position of the middle box of quadrant A. Thus, in a 6 x 6 square, you should mark only the first box (which would contain the 8), but, in a 10 x 10 square, you should highlight the first and second boxes (with the numbers 17 and 24 respectively).
  • Trace the edges of a square using the boxes you just marked as the top row. If you have marked only one square, the square will only contain that. We will call this area Selection A -1.
  • Thus, in a 10 x 10 magic square, Selection A -1 would consist of the first and second boxes of the first and second rows, which would create a 2 x 2 square within the upper left quadrant.
  • In the row directly below Selection A -1, ignore the number in the first column, then mark as many boxes as you marked in Selection A - 1. We will call this middle row Selection A - 2
  • Selection A-3 is a square identical to A -1, but it is placed in the lower left.
  • Together, zones A - 1, A - 2 and A - 3 form Selection A.
  • Repeat this same process in quadrant D, creating an identical highlighted area called Selection D.
Solve a Magic Square Step 10
Solve a Magic Square Step 10

Step 7. Swap Selection A and Selection D between them

It is a one-to-one exchange; simply replace the boxes between the two highlighted areas without changing their order. Once this is done, all the rows, columns and diagonals of your magic square, added together, should give the calculated magic constant.

Method 3 of 3: Double Even Magic Square

Solve a Magic Square Step 11
Solve a Magic Square Step 11

Step 1. Try to understand what is meant by a doubly even square

A singularly even square has a number of squares per side that is divisible by 2. If, on the other hand, it is doubly even, then it is divisible by 4.

The smallest doubly even square is the 4 x 4 square

Solve a Magic Square Step 12
Solve a Magic Square Step 12

Step 2. Calculate the magic constant

Use the same method as for the odd or singly even magic square: the magic constant is [n * (n2 + 1)] / 2, where n = number of squares per side. So, in the example of the 4 x 4 square:

  • sum = [4 * (42 + 1)] / 2
  • sum = [4 * (16 + 1)] / 2
  • sum = (4 * 17) / 2
  • sum = 68/2
  • The magic constant for a 4 x 4 square is 68/2 = 34.
  • All numbers added together for rows, columns and diagonals must give this same value.
Solve a Magic Square Step 13
Solve a Magic Square Step 13

Step 3. Make Selections A-D

In each corner of the magic square, highlight a small square with sides of length n / 4, where n = the side length of the starting magic square. Call these squares Selection A, B, C and D counterclockwise.

  • In a 4 x 4 square, you should simply mark the boxes at the four corners.
  • In an 8 x 8 square, each Selection would be a 2 x 2 area placed in each of the four corners.
  • In a 12 x 12 square, each Selection would consist of a 3 x 3 area at the corners, and so on.
Solve a Magic Square Step 14
Solve a Magic Square Step 14

Step 4. Create the Central Selection

Mark all the boxes in the center of the magic square in a square area of length n / 2, where n = the length of one side of the whole magic square. The Center Selection should not overlap the A-D Selections, but touch them at the corners.

  • In a 4 x 4 square, the Central Selection would be an area of 2 x 2 squares in the center.
  • In an 8 x 8 square, the Central Selection would be a 4 x 4 area in the center, and so on.
Solve a Magic Square Step 15
Solve a Magic Square Step 15

Step 5. Fill in the magic square, but only in the highlighted areas

Start filling in the numbers in your magic square from left to right, but only write the number if the box falls into a Selection. So, taking a 4 x 4 square for example, you should fill in the following boxes:

  • 1 in the upper left box and 4 in the upper right box
  • 6 and 7 in the middle boxes of row 2
  • 10 and 11 in the middle boxes of row 3
  • 13 in the lower left box and 16 in the lower right box.
Solve a Magic Square Step 16
Solve a Magic Square Step 16

Step 6. Fill in the rest of the magic square by counting backwards

Essentially this is the reverse of the previous step. Start with the top left square again, but this time, skip all the squares that fall into the area occupied by a Selection and fill in the non-highlighted squares by counting backwards. Start with the highest number available. For example, in a 4 x 4 magic square, you should do the following:

  • 15 and 14 in the middle boxes of row 1
  • 12 in the left-most box and 9 in the right-most box of row 2
  • 8 in the left-most box and 5 in the right-most box of row 3
  • 3 and 2 in the middle boxes of row 4
  • At this point, all the columns, rows and diagonals, adding the numbers contained in each of them, should give your magic constant.

Recommended: