Magic Square Calculator

Choose build or check, then enter a size or a square.

A whole number from 3 to 15.

Try

Result

You enteredn=3n = 3

[816357492]\displaystyle \begin{bmatrix} 8 & 1 & 6 \\ 3 & 5 & 7 \\ 4 & 9 & 2 \end{bmatrix}

Magic constant

15\displaystyle 15

Method

Siamese method\displaystyle \text{Siamese method}
Show the work
  1. Magic constant

    The numbers 11 to n2n^2 add up to n2(n2+1)/2n^2(n^2 + 1)/2, and shared out over nn rows that gives the sum every row, column and diagonal must have.

    M=n(n2+1)2=3(32+1)2=3×102=15\begin{aligned} M &= \dfrac{n\left(n^{2} + 1\right)}{2} \\ &= \frac{3\left(3^{2} + 1\right)}{2} \\ &= \frac{3 \times 10}{2} \\ &= 15 \end{aligned}
  2. Construction by the Siamese method

    Put 11 in the middle of the top row. Then keep moving one cell up and one to the right, wrapping round the edges, to place the next number; if that cell is already filled, drop one cell straight down instead.

  3. Checking the sums

    Adding along each of the 33 rows gives 1515 every time, and the columns and both diagonals agree.

    15, 15, 1515,\ 15,\ 15
  4. Result

    The 3 by 3 magic square has constant 1515.

Worked examples