Note 1: Algebraic Conditions on 3x3 Magic Square

We seek a 3x3 magic square where we have arranged the 
numbers 1,2,..,9 in an array like this

 a b c
 d e f
 g h i

such that each row, column, and main diagonal to sums 
to the same value.  To simplify, subtract 5 from each
number, so the square consists of some arrangement of
the numbers -4,-3,-2,..,3,4.  In these terms we know
the sum of all the numbers is zero, so each row, column
and diagonal sums to zero, giving us the linear 
conditions

rows       columns    diagonals

a+b+c=0    a+d+g=0    a+e+i=0
d+e+f=0    b+e+h=0    c+e+g=0
g+h+i=0    c+f+i=0

This is eight linear equations in nine unknowns, but the
equations are not all linearly independent.  Solving the 
row constraints for a, d, and g, and inserting into the 
column and diagonal equations, we see that the equation 
a+d+g=0 is redundant to the other two column equations,
so we discard that, and we are left with four equations
in six unknowns

  b+e+h=0    c+f+i=0     e+i=b+c    c+e=h+i

So, given two if them, say, h and i, we can solve for 
the other four.  The result is

         b=-h   c=h+i   e=0   f=-h-2i

We also know the sum of the squares of the nine numbers

 a^2 + b^2 + c^2 + d^2 + e^2 + f^2 + g^2 + h^2 + i^2 = 60

and we can express each of the parameters in terms of h 
and i, so if we substitute these expressions this equation 
reduces to
             2i^2 + 2hi + h^2  =  10

Return to Solving Magic Squares.

Return to MathPages Main Menu