0% found this document useful (0 votes)
103 views7 pages

Magic Squares

This document discusses magic squares, which are n×n tables filled with distinct numbers such that the sums of each row, column, and diagonal are equal. It proves that the n-order magic squares form a vector space over the real numbers. For n=2 the dimension is 0, but for n>2 the dimension is n^2 - 2n - 1. The document will determine a basis for this vector space of magic squares.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
103 views7 pages

Magic Squares

This document discusses magic squares, which are n×n tables filled with distinct numbers such that the sums of each row, column, and diagonal are equal. It proves that the n-order magic squares form a vector space over the real numbers. For n=2 the dimension is 0, but for n>2 the dimension is n^2 - 2n - 1. The document will determine a basis for this vector space of magic squares.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 7

Magic Squares by Massimiliano Patassini

0.1 Introduction

In this rst chapter we'll study one of the most common mathematical games,
namely the magic square.
A magic square is a nxn-square table, in which we put the rst n2 natural
numbers (beginning form 1), without repetitions, in such a way that the sum of
each row, of each column and of each main diagonal is the same.
In the 3x3 case we have:
8 1 6
3 5 7
4 9 2
But if we take away the limitation imposed by the use of only natural number
and we establish to insert elements of a eld (e.g. R) then we can study this
objects in a better way.

0.2 The vector subspace of n-Order Magic Square

Definition 0.2.1 Characteristic Sum The Characteristic Sum of a magic


square is the sum of the elements that belong to a square's row. Notice that this
sum is equal to the sum of the elements that are in each other row, column and
main diagonal.

Lemma 0.2.1 The n-order magic squares (i.e. the magic squares that have n
rows and n columns) are a vector space on R.

Proof. Let us consider the n-order magic squares as square matrices with
coecients in R.
- The identically zero matrix is a magic square.
- If we sum two magic squares of characteristic sum respectively S and S 0 we
obtain again a magic square of characteristic sum S + S 0 .
- If we multiply a magic square by a ∈ R (it's the same that we multiply a
matrix by a scalar) we obtain again a magic square of characteristic sum
a times the rst one.

Then, the magic squares are a vector subspace of square matrices; since the
last one is a nite dimensional space, then the rst one has a nite dimension.
The aim of this article is to determine the dimension of these subspaces.

First of all, there are some conventions that will be used.


As we said, the magic squares are matrices and so we can represent them in
this way:
Magic Squares by Massimiliano Patassini

 
a11 a12 ··· a1n
 a21 a12 ··· a1n 
 .. .. .. .. 
 
 . . . . 
an1 an2 ··· ann
The matrix's rows are denoted with R1 , ..., Rn , the columns with C1 , ..., Cn
and the main diagonals with D1 , D2 .

0.3 2-Order Magic Squares

This is a very trivial case: in fact, if we x the sum S , we can see that the magic
squares are a 0-dimensional subspace, because the only square is:
 
S/4 S/4
S/4 S/4

0.4 Superior-Order Magic Squares

To analize the following cases, we'll formulare the problem in a better way.
Let's consider the linear system with 2n + 2 equation and n2 unknowns that
is obtained imposing the conditions of the n-order magic square with a xed
sum S . An homomorphism is associated to this system:
2
f : Rn → R2n+2
in such a way that the solutions of the system are:
2n+2
X
f −1 (S ei )
i=1

First of all, let's notice that this linear system is not indipendent because
there's at least an equation that is a linear combination of the other one. In
fact, we have:
n
X n
X
Ri (a) = Cj (a)
i=1 j=1

in which X
Ri (a) = aik
1≤k≤n

(i-th row equation)


and X
Cj (a) = akj
1≤k≤n

(j -th column equation).


Magic Squares by Massimiliano Patassini

Let's prove that the remaining equations are linearly indipendent.


The linear system C1 (a), ..., Cn (a), R2 (a), ..., Rn (a), D1 (a), D2 (a) is represented
by the matrix (for n = 4):
 
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0

 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 


 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 


 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 


 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 


 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 


 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 

 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0
Using the Gauss reduction, let's substitute to D1 (a):
n
X n
X
C1 (a) − D1 (a) − R2 (a) = (ai1 − aii − a2i ) = −2a22 + (ai1 − aii − a2i )
i=1 i=3

The rst not-0-term of the last expression is the coecient of a22 .


In the same way, instead of D2 (a) let's place:

n
X n
X
Cn (a) − D2 (a) = (ain − ai(n−i+1) ) = −a2(n−1) + a2n + (ain − ai(n−i+1) )
i=1 i=3

that has as rst not-0-term the coecient of a2(n−1) .


Now, exchanging the rows (placing the second last one and the last one after
R2 (a)), we obtain (for n = 4):

 
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0

 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 

 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 

 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 

 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 

 0 0 0 0 0 −2 −1 −1 1 0 −1 0 1 0 0 −1 


 0 0 0 0 0 0 −1 1 0 −1 0 1 −1 0 0 1 
 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1

In general, we have that:


- The rst n + 2 columns are linearly indipendent;
- The columns form n + 3 to 2n − 2 (if n ≥ 5) are linear combinations of the
preceding ones;
Magic Squares by Massimiliano Patassini

- The 2n − 1-th column is linearly indipendent (in comparison with all the
preceding ones);
- The columns that have kn + 1 index, with 2 ≤ k ≤ n − 1, are linearly
indipendent form the other ones;
- All the columns that have an index greater than 2n − 1 and not in the form
kn + 1, with 2 ≤ k ≤ n − 1, are linear combinations of the preceding ones.

The system has the greatest rank (2n + 1) and so if we want to describe the
magic squares subspace, we need n2 − 2n − 1 parameter, and then the dimension
of this space is n2 − 2n − 1 (for n > 2).

0.4.1 Subspace's Basis

Now, we'll nd a magic squares basis.


We can try to solve the linear system (it's enough (!!) to calculate the kernel
of the homomorphism...)
A direct (but equivalent) method is to see how the magic square is now:
 
∗ ∗ ∗ ··· ∗ ∗ ∗

 ∗ ∗ ∗ 


 ∗ 


 ∗ 

 ∗ 
 ..
 
 .



If we assign a xed characteristic sum s and we substitute an hole with a
number a and the remaining holes with 0, the positions denoted with ∗ are
univocaly denited for what we said before.
The simplest way to proceed is to suppose that s = 0 and a = 1.
The strategy is to nd out the position where there are not-0 coecients
(because we know that there are few) and to determimate their values.
For example, let's assign 1 to a2i with 3 ≤ i ≤ (n − 2). First of all ak1 = 0
for 3 ≤ k ≤ n and a1j = 0 for 3 ≤ j ≤ n and j 6= i, n − 1. Then:
 
∗ ∗ 0 ··· ∗ ··· 0 ∗ 0

 ∗ ∗ 0 ··· 1 ··· 0 ∗ 0  

 0 0 0 ··· 0 ··· 0 0 0  

 0 0 0 ··· 0 ··· 0 0 0  
 0 0 0 ··· 0 ··· 0 0 0 
 .. .. .. .. .. .. .. .. .. 
 
 . . . . . . . . . 
0 0 0 ··· 0 ··· 0 0 0
Magic Squares by Massimiliano Patassini

Notice that a2(n−1) = 0 because it's in the second diagonal, then also
a1(n−1) = 0. The remaining is easily dened: a11 = a12 = 1/2, a21 = a22 =
−1/2, a1i = −1.
After an accurate analysis, we'll see that:

- If a2i = 1 with 3 ≤ i ≤ (n − 2), then


1/2 1/2 0 ··· −1 ··· 0
 
 −1/2 −1/2 0 ··· 1 ··· 0 
0 0 0 ··· 0 ··· 0
 
 
0 0 0 ··· 0 ··· 0
 
 
0 0 0 ··· 0 ··· 0
 
 
 
 . . . . . . . 
. . . . . . .
 . . . . . . .

0 0 0 ··· 0 ··· 0

- If a2n = 1 then
1 1 0 ··· 0 −1 −1
 
 −1 −1 0 ··· 0 1 1 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
 
 . . . . . . . 
. . . . . . .
 . . . . . . .

0 0 0 ··· 0 0 0
- If aj2 = 1 with 3 ≤ j ≤ n − 2 then

1/2 −1/2 ···


 
0 0 0 0
 1/2 −1/2 0 ··· 0 0 0 
 
 0
 0 0 ··· 0 0 0 

 . . . . . . . 
 . . . .
.
. . . 
 . . . . . . 

 −1

1 0 ··· 0 0 0 

 
 .. .
.
.
.
.
.
.
.
.
.
. 
. 
 . . . . . . .

0 0 0 ··· 0 0 0

- If a(n−1)2 = 1 then

0 −1 0 ··· 0 1 0
 
 1 0 0 ··· 0 −1 0 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
 
 . . . . . . . 
 .. .
.
.
.
.
.
.
.
.
.
. 
. 

1

 −1 0 ··· 0 0 0 
0 0 0 ··· 0 0 0
- If an2 = 1 then
1 0 0 ··· 0 −1 0
 
 0 −1 0 ··· 0 1 0 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
 
 . . . . . . . 
. . . . . . . 
. . . . . . . 


 0 0 0 ··· 0 0 0 
−1 1 0 ··· 0 0 0
Magic Squares by Massimiliano Patassini

- If aij = 1 with 3 ≤ i ≤ n − 1, 3 ≤ j ≤ n, i 6= j, n − j + 1 then

 
1/2 1/2 0 ··· −1 ··· 0 0
 1/2 −1/2 0 ··· 0 ··· 0 0 
 
 0
 0 0 ··· 0 ··· 0 0 

 0
 0 0 ··· 0 ··· 0 0 

 . . . . . . . . 
 . . . .
.
. . . . 
 . . . . . . . 

 −1

0 0 ··· 1 ··· 0 0 

 
 .. .
.
.
.
.
.
.
.
.
.
.
.
. 
. 
 . . . . . . . .

0 0 0 ··· 0 ··· 0 0

- If anj = 1 with 3 ≤ j ≤ n − 2 then

1 1 0 ··· −1 ··· −1 0
 
 0 −1 0 ··· 0 ··· 1 0 
 0 0 0 ··· 0 ··· 0 0
 

 0 0 0 ··· 0 ··· 0 0
 

 0 0 0 ··· 0 ··· 0 0
 

 
 . . . . . . . . 
 .. .
.
.
.
.
.
.
.
.
.
.
.
.
.

−1 0 0 ··· 1 ··· 0 0

- If an(n−1) = 1 then

1 1 0 ··· 0 −2 0
 
 0 −1 0 ··· 0 1 0 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
 
 . . . . . . . 
. . . . . . .
 . . . . . . .

−1 0 0 ··· 0 1 0
- If ann = 1 then
1 2 0 ··· 0 −2 −1
 
 0 −2 0 ··· 0 2 0 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
0 0 0 ··· 0 0 0
 
 
 
 . . . . . . . 
. . . . . . .
 . . . . . . .

−1 0 0 ··· 0 0 1
- If aii = 1 with 3 ≤ i ≤ n − 1, i 6= n − i + 1 then

 
0 1 0 ··· −1 ··· 0 0
 1
 −1 0 ··· 0 ··· 0 0 

 0
 0 0 ··· 0 ··· 0 0 

 . . . . . . . . 
 . . . .
.
. . . . 
 . . . . . . . 

 −1

0 0 ··· 1 ··· 0 0 

 
 .. .
.
.
.
.
.
.
.
.
.
.
.
. 
. 
 . . . . . . . . 

 0 0 0 ··· 0 ··· 0 0 
0 0 0 ··· 0 ··· 0 0
Magic Squares by Massimiliano Patassini

- If ai(n−i+1) = 1 with 3 ≤ i ≤ n − 2, i 6= n − i + 1 then

 
0 0 0 ··· −1 ··· 1 0
 1
 0 0 ··· 0 ··· −1 0 

 . . . . . . . . 
 . . . .
.
. .
.
. . 
 . . . . . . 

 −1 0 0

··· 1 ··· 0 0 

 
 .. .
.
.
.
.
.
.
.
.
.
.
.
. 
. 
 . . . . . . . . 

 0
 0 0 ··· 0 ··· 0 0 

 0 0 0 ··· 0 ··· 0 0 
0 0 0 ··· 0 ··· 0 0

- If ai(n−i+1) = 1 withi = n − i + 1 then

−1/2 ··· −1 ···


 
1/2 1 0
 3/2
 −1/2 · · · 0 ··· −1 0 

 . . . . . . . 
. . . . . . . 
. .

 . . . . . 

 −1

0 ··· 1 ··· 0 0 

 
. . . . . . . 
. . . . . . . 

 . . . . . . . 

 0 0 ··· 0 ··· 0 0 
0 0 ··· 0 ··· 0 0

In the case n = 3, the dimension is 2 and then the matrices that constitute
a basis are 2. For example, they are:
 
0 −1 1
 1 0 −1 
−1 1 0
 
−1 0 1
 2 0 −2 
−1 0 0

You might also like