Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can I find all the different possibilities for the sum of rows/columns/diagonals for a $4\times4$ magic square? I am not sure how to proceed, except by brute force, which is entirely inelegant.

I should mention that I am looking at a $4\times 4$ magic square with symbols from $0$ to $15$ inclusive.

share|improve this question
Do you really mean that you want the possibilities for the sum of the rows? If a magic square contains the integers 1–16, then there is only one possibility, namely $\frac14(1+\ldots+16) = 34$; if the square is allowed to contain any positive integers, then any sum is possible. And do you mean a magic square, or a Latin square? They are not the same thing. –  MJD Jul 18 '12 at 22:08
See the edit on the question. As I said I could not find he magic square tag. –  Xuan Huang Jul 18 '12 at 22:34
Also how might we go about proving that 34 is the only possibility? –  Xuan Huang Jul 18 '12 at 22:38
The numbers from 0 to 15 add up to 120. In a magic square, all the rows have the same sum. The four row sums must add up to that 120, so each must be 30. As noted, a Latin square is an entirely different thing. –  Gerry Myerson Jul 18 '12 at 22:52
@DanielleHuang Count the same thing two different ways: if the row sum is $r$, then the sum of all the entries in the square must be the sum of row 1, row 2, row 3, and row 4: $r+r+r+r=4r$. Meanwhile, if the square contains each of the numbers from 0 through 15 (or 1 through 16) exactly once, then the sum of all the entries is... –  Steven Stadnicki Jul 18 '12 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.