URL http://www.mast.queensu.ca/~helena/linal11s3.html

Assignment 6, Solution to problem 3


Problem 3

A magic square of size 3 by 3 looks like:

abc
def
ghk
where we have the conditions:
a+b+c=d+e+f=g+h+k=a+d+g=b+e+h=c+f+k=a+e+k=g+e+c

(i) The set of all three by three magic squares is a vector space:

Here is a check of the first four conditions:

1: If

a1b1c1
d1e1f1
g1h1k1
and
a2b2c2
d2e2f2
g2h2k2
are magic sqaures, then so is their sum:
a1+a2b1+b2c1+c2
d1+d2e1+e2f1+f2
g1+g2h1+h2k1+k2
We will have that if all the rows and columns and diagonals of the first one add up to M, and for the second everything adds up to N, then for their sum, everything will add to N+M.

2:

If

abc
def
ghk
is a magic square, with all the rows, columns, diagonals, adding to M, and L is a real number, then
L
abc
def
ghk
is also a magic square, and everything adds to LM.

3

000
000
000
is a magic square, with all the rows, columns, diagonals, adding to 0.

4:

If

abc
def
ghk
is a magic square, with all the rows, columns, diagonals, adding to M, then
-
abc
def
ghk
=
-a-b-c
-d-e-f
-g-h-k
is also a magic square, and the sums of rows, cols, diags, will be -M

(ii) Write the conditions as 7 linear equations, and use an augmented matrix and row reduction to find a general solution:

There are various ways of thinking about how to get 7 conditions. One way is to take each equal sign to give an equation. You have seven equal signs, so there are seven equations:

We have to rewrite these so all the constants are on one side, and variables on the other side, and then write as an augmentend matrix, with columns corresponding to a,b,c,d,e,f,g,h,k:

/1 1 1 -1-1-10 0 0 |0\
|0 0 0 1 1 1-1-1-1|0|
|-10 0 -10 0 0 1 1 |0|
|1 -10 1 -10 1 -10 |0 |
|0 1 -10 1 -10 1 -1|0|
|-10 1 0 -110 0 0 |0|
\1 0 -10 0 0 -1 0 1 |0/

To find what (a,b,c,d,e,f,g,h,k) have to be, you can use MatLab to reduce the matrix, or do it by hand:

/1 0 0 0 0 0 -2/3 -2/3 1/3 |0\
|0 1 0 0 0 0 -2/3 1/3 -2/3 |0|
|0 0 1 0 0 0 1/3 -2/3 -2/3 |0|
|0 0 0 1 0 0 2/3 -1/3 -4/3 |0 |
|0 0 0 0 1 0 -1/3 -1/3 -1/3 |0|
|0 0 0 0 0 1 -4/3 -1/3 2/3 |0|
\0 0 0 0 0 0 0 0 0 |0/

(iii) Write a basis for the space of 3 by three magic squares

From the reduced matrix we get the following:

/a \ /2/3g 2/3h -1/3k \/2/3 \/2/3 \/-1/3 \
|b | |2/3g -1/3h +2/3k ||2/3 ||-1/3 ||2/3 |
|c | |-1/3g +2/3h +2/3k ||-1/3 ||2/3 ||2/3 |
|d | |-2/3g +1/3h +4/3k ||-2/3 ||1/3 ||4/3 |
|e |=|1/3g +1/3h +1/3k |=g|1/3 |+h|1/3 |+k|1/3 |
|f | |4/3g +1/3h -2/3k ||4/3 ||1/3 ||-2/3 |
|g | |1g 0h 0k ||1 ||0 ||0 |
|h | |0g 1h 0k ||0 ||1 ||0 |
\k / \0g 0h 1k /\0 /\0 /\1 /

So these three vectors give a basis for the space of three by three magic squares. If we write them as magic squares, we have a basis;

{
2/32/3-1/3
-2/31/34/3
100
,
2/3-1/32/3
1/31/31/3
010
,
-1/32/32/3
4/31/3-2/3
001
}

Check, these really are magic squares, and all the rows, columns, diagaonals, have sums of 1.

Note that other basis are possible; if we'd had more time we could have talked more about change between different basis. For instance, the following is also a basis, and it might be considered nicer since it's more symmetric:

B2= {
102
210
021
,
201
012
120
,
120
012
201
}

To check this is also a basis, check that they are magic squares, check that they are linearly independent (the third is not a combination of the first two), then since there are three of them, and the space of magic squares has dimension 3, they must span the space, and so they are a basis.

There are other possible basis. You only needed to find one for this question, and as long as it's a basis, it doens't matter which one you found.


Solution 1 Back to the Lecture 11 Notes. Solution 2

Please send comments, questions, suggestions, corrections, ideas, to me.



• Welcome Home • Origami •

Queen's Mathematics and Statistics
Queen's University