5

I am trying to prove that the determinant of a magic square, where all rows, columns and diagonal add to the same amount, is divisible by 3.

I proved it for magic squares which have entries $1,\ldots, 9$, but it turns out I need to show it for magic squares which can have any entries, e.g. \begin{pmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{pmatrix}

or \begin{pmatrix} 3 & 1 & 2 \\ 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix}

How can I do this? I tried working out the determinant using $a, b,\ldots, i$ as entries but could not find it.

Thank you!

tjsp
  • 105
  • 2
    Idea (I don't know if this works): The determinant is the product of eigenvalues. If all the rows sum to the same number, then $(1, 1, 1)^T$ is an eigenvector with that sum as eigenvalue. Does the full magic-square requirement (including diagonals) mean this sum must be divisible by $3$? – Arthur Mar 26 '19 at 13:06
  • @Arthur Also had this idea, but the other two eigenvalues may not be integers. Or we must prove they are. – M. Vinay Mar 26 '19 at 13:08
  • 1
    @M.Vinay Not a problem. If the sum is $s$, then the characteristic polynomial factors as $(\lambda - s)g(\lambda)$ where $g$ is a (quadratic) polynomial with integer coefficients. So it doesn't matter what its roots are; the constant term of $g$ is an integer and therefore the constant term of the entire polynomial (which is the determinant with a sign) is divisible by $s$. – Arthur Mar 26 '19 at 13:10
  • @Arthur Ah, right. Perfect! – M. Vinay Mar 26 '19 at 13:10
  • 1
    So the only thing I'm uncertain of is whether the sum $s$ must be divisible by $3$. Because without the diagonal requirement, you can just increase each $3$ in your second example to a $4$, and $s = 7$ and the determinant is $-49$. – Arthur Mar 26 '19 at 13:13
  • 2
    @Arthur Let $s$ be the sum along one row etc, $c$ the value in the center. Then the sum along both diagonals and the row and column through the center is equal $4s$ and equal $3s+ 3c$ (because it contains sum of all elements in square plus $3c$). Hence $c=s/3$, and $s$ is divisible by $3$. – daw Mar 26 '19 at 14:35

3 Answers3

5

Let the three rows of the magic square be $r_1$, $r_2$, and $r_3$. Since the determinant is unchanged by row operations that add a multiple of one row to another, the matrix with rows $r_1$, $r_2$ and $r_1+r_2+r_3$ has the same determinant. The entries in $r_1 + r_2 + r_3$ are the column sums of the original magic square, which are all equal to the magic constant. The magic constant is three times the central entry of the magic square, so every entry in this new row is multiple of three; therefore the determinant is, too.

FredH
  • 4,368
4

Collecting from all the comments above:

Let $s$ be the sum of one row. This $s$ must be divisible by $3$: Since the sum of the two diagonals along with the row and the column going through the center equals $4s$, but it is also the sum of every element in the matrix, along with the center value $c$ an additional three times, which is $3s + 3c$. Equating these two gives $s = 3c$.

Since all the rows have the same sum, the vector $(1, 1, 1)^T$ is an eigenvector of the matrix with eigenvalue $s$. The determinant is (up to a sign) equal to the constant term of the characteristic polynomial. Since we know the characteristic polynomial has $s$ as a root, it must factor as $$ (\lambda - s)g(\lambda) $$ for some polynomial $g$ with integer coefficients. Particularily, this means that the constant term of $g$ must be an integer, which means that the constant term of the characteristic polynomial (and therefore the determinant) must be divisible by $s$.

Arthur
  • 204,511
0

Render the elements $\bmod3$. Then the sum of every row and every column is three times the central element, but this is $\equiv0\bmod3$. To make all the column sums zero you then need the last row to be $\equiv$ the sum of the first two rows $\bmod3$, a linear dependence that then forces the determinant to be $\equiv0\bmod3$.

Oscar Lanzi
  • 48,208