[Math] Proof of Magic Constant Formula

magic square

A magic square is a NxN square grid filled with distinct positive integers in the range 1,2…$N^2$.
Each cell contains a different integer.
The sum of the integers in each row, column and diagonal is equal and called magic constant.
The Formula for magic constant is given by

Magic Constant=$\frac{N*(N^2+1)}{2}$

How to derive this formula?

Best Answer

Yes. The sum in any row must be $\frac{1}{N}$ times the sum of all the entries in the matrix (because there are $N$ rows of equal sum, and the sum of all rows' sums is equal to the sum of all entries).

Note that the sum of all the entries in the matrix is $$1+2+\cdots+N^2 = \frac{N^2 \left(N^2+1\right)}{2}.$$ Hence the Magic Constant is $$\frac{1}{N}\times \frac{N^2 \left(N^2+1\right)}{2} =\frac{N\left(N^2+1\right)}{2} .$$

Related Question