## Intro: The Symmetrical Magic Square

This instructable will show you how to construct a magic square that is symmetrical.

The matematical truth that a key pads entered path sequence added with its own 180 degrees rotated sequence always results in n*1's and ends with a 0, inspired me into this discovery which might be known, but I thought I would share it with you because I havent seen it other places.

**Key Pad**:

- 1 2 3
- 4 5 6
- 7 8 9

**Examples**:

15 + 95 = 110

186 + 924 = 1110

1236 + 9874 = 11110

18342 + 92768 = 1111110

This can also be expressed as: __KeyPad(x,y) + KeyPad(y,x) = 10__

## Step 1: The Symmetrical Magic Square

There are many ways of constructing a magic sqaure, but I will only show you mine.

Conditions: The 2D matrix must be bigger than 3 and always be odd in size.

**The function**:

f(y) = 2*x mod Size

OR

For x = 0 to Size-1

Matrix((OffsetX + x) mod Size, (OffsetY + 2*x) mod Size) = Nr

next

Now we have a magic square, but is not symmetrical or concentric, so we rotate the matrix 180 degrees and add them together.

For x = 0 To Size - 1

For y = 0 To Size - 1

Matrix(x,y) = Matrix(x,y) + Matrix(Size - x - 1, Size - y - 1)

Next

Next

Then we mirror the original matrix and add it to the above added together.

For x = 0 To Size - 1

For y = 0 To Size - 1

Matrix(x,y) = Matrix(x,y) + Matrix(Size - x - 1, y)

Next

Next

The result is a symmetrical magic square.

You can run a new f(y) =2x*mod Size on top of the old matrix and then repeat the 180 degress and mirror operation forever.

Matrix of same size with same operations applied can be added or subtract from each others. Multplied or Divided with a constant and will still be symmetrical magic squares.

Download my Visual Basic 2010 program and source code to play around.

## Discussions