Math Lab
Home/Class VII/Ch 6/Magic squares and number arrangements

Magic squares and number arrangements

A magic square is a square grid filled with numbers so that every row, every column, and both diagonals add up to the same total , called the magic sum.

Idea

The smallest interesting magic square is order 33, using numbers 11 to 99 once each:

2 7 6
9 5 1
4 3 8

Every row, every column, and each diagonal sums to 1515. (Quick check: 2+7+6=152+7+6 = 15; 2+9+4=152+9+4=15; 2+5+8=152+5+8=15, etc.)

The magic sum equals n(n2+1)2\frac{n(n^2+1)}{2} for an n×nn \times n square filled with 11 to n2n^2. So for n=3n=3: 3×102=15\frac{3 \times 10}{2} = 15. For n=4n=4: 4×172=34\frac{4 \times 17}{2} = 34.

Symmetries. A magic square can be reflected and rotated , giving up to 88 "different-looking" arrangements of the same numbers. So in some sense there is only one essential 3×33\times 3 magic square using 1199.

Hardest task. Filling a magic square from scratch. For n=3n=3, one trick: place 55 in the middle (it must be, since it's the average), then balance pairs around it.

Magic squares have appeared in Indian, Chinese, Arabic and European traditions for over 20002000 years , both as puzzles and as charms. Mathematicians study them because they connect arithmetic, algebra and combinatorics.

Worked examples

Example 1. Find the missing number in this partly-filled magic square (sum =15= 15):

4 9 ?
3 5 7
? 1 6

Row 1: 4+9+?=15?=24 + 9 + ? = 15 \Rightarrow ? = 2. Row 3: ?+1+6=15?=8? + 1 + 6 = 15 \Rightarrow ? = 8. Check column 1: 4+3+8=154+3+8=15 ✓.

Example 2. Why must the centre of a 3×33\times 3 magic square (using 1199) be 55?

Add all four lines through the centre: 22 diagonals + middle row + middle column = 4×15=604 \times 15 = 60. Each of these counts the centre 44 times and every other cell exactly once (the centre is on all four lines; other cells are on exactly one). Total of all 99 cells once: 1++9=451+\dots+9 = 45. So 4c+45c=604c + 45 - c = 60? Let me re-do: 60=3c+4560 = 3 \cdot c + 45 (because each line contains the centre and two others, and the four lines cover the centre 44 times and the other 88 cells exactly... actually a clean version: middle row + middle column + diag1 + diag2 = 4×15=604 \times 15 = 60, and this counts the centre 44 times plus the other 88 cells once = 4c+(45c)4c + (45 - c)? That's wrong because every non-centre cell is on exactly one of the four lines... Actually middle row has 33 cells (centre and 22 others), same for middle column, and each diagonal has 33 cells too. Sum of cells in these lines (with multiplicities) is 43=124 \cdot 3 = 12 cells worth. The centre is in all 44 lines (counted 44 times); the 44 corners each lie on 22 lines (counted twice); the 44 edge-midpoints each lie on 11 line. So 4c+2(corner sum)+(edge-mid sum)=604c + 2(\text{corner sum}) + (\text{edge-mid sum}) = 60. With corner sum+edge-mid sum=45c\text{corner sum} + \text{edge-mid sum} = 45 - c, eliminating gives 3c+(45c)+corner sum=603c + (45 - c) + \text{corner sum} = 60, i.e., corner sum =15+2c45=2c30= 15 + 2c - 45 = 2c - 30 ... too messy. Simpler reasoning: middle column + middle row sum =30= 30; this counts centre twice and the other 44 middle-cells once. So 2c+(sum of edge-mids)=302c + (\text{sum of edge-mids}) = 30. By symmetry, the edge-mids sum to 2020 (because the four corners sum to 2020 too, and corners + edge-mids =45c=40= 45 - c = 40). So 2c+20=30c=52c + 20 = 30 \Rightarrow c = 5. ✓

Example 3. What is the magic sum for a 4×44\times 4 magic square using 11 to 1616?

4(42+1)2=4×172=34\frac{4(4^2+1)}{2} = \frac{4 \times 17}{2} = 34.

Example 4. Build a magic square using 1111 to 1919 (instead of 11 to 99).

Add 1010 to every cell of the standard square. Each row sum becomes 15+30=4515 + 30 = 45. Confirmed: now magic sum is 4545 with entries 11111919.

Try it yourself

  1. Fill the empty cells (magic sum 1515):
    ? ? 4
    ? 5 ?
    8 ? ?
    
  2. What is the magic sum of a 5×55\times 5 magic square using 11 to 2525?
  3. Make a magic square using 2,4,6,,182, 4, 6, \dots, 18 (the first 99 even numbers). What is its magic sum?
  4. Verify that the standard 3×33\times 3 magic square also has equal diagonal sums.
  5. Add 77 to each cell of the standard 3×33\times 3 magic square. Is the new square still magic?
  6. Multiply each cell of the standard 3×33\times 3 magic square by 22. Magic sum?
  7. Find the centre of a 5×55\times 5 magic square using 11 to 2525. Is it the average?
  8. Show that no 2×22\times 2 magic square exists using 1,2,3,41, 2, 3, 4.

Activity

Take a 3×33\times 3 grid. Try to fill it from scratch using digits 11 to 99 so that every line sums to 1515. Try multiple times to convince yourself the centre must be 55.

Find a magic square in a temple, building, or book. (The Khajuraho temple has a famous 4×44\times 4 magic square.) Photograph and verify.

Practice quiz

Quick check on this topic.

Quiz
Quick check : Magic squares
5 questions · pick the best answer
Q1

Magic sum of 3×33\times 3 magic square using 1199:

Q2

Centre of 3×33\times 3 magic square with 1199:

Q3

Magic sum of 4×44\times 4 using 111616:

Q4

If we add 77 to every cell, the new magic sum is:

Q5

Does a 2×22\times 2 magic square using 1,2,3,41, 2, 3, 4 exist?