# Latin Squares in Practice and in Theory II

## 4. Orthogonal Latin Squares and Magic Squares

Euler was interested in magic squares, square arrays of size n, containing all the numbers from 1 to n2, and such that each row and each column add up to the same number (which must be n(n2+1)/2). In his article he shows how to derive an ``ordinary'' magic square from a pair of orthogonal latin squares. We can see the process with our 7 x 7 pair:
We make a square of numbers from the ``ranks'' square by setting King=0, Queen=7, Rook=14, Bishop=21, Knight=28, Pawn=35, Joker=42 and another one from the ``regiments'' square by setting black=1, red=2, blue=3, green=4, purple=5, brown=6, yellow=7. Then we add the two tables together:

 ``` 0 7 14 21 28 35 42 1 2 3 4 5 6 7 1 9 17 25 33 41 49 14 21 28 35 42 0 7 2 3 4 5 6 7 1 16 24 32 40 48 7 8 28 35 42 0 7 14 21 3 4 5 6 7 1 2 31 39 47 6 14 15 23 42 0 7 14 21 28 35 + 4 5 6 7 1 2 3 = 46 5 13 21 22 30 38 7 14 21 28 35 42 0 5 6 7 1 2 3 4 12 20 28 29 37 45 4 21 28 35 42 0 7 14 6 7 1 2 3 4 5 27 35 36 44 3 11 19 35 42 0 7 14 21 28 7 1 2 3 4 5 6 42 43 2 10 18 26 34 ```

Since all 49 combinations must appear, all the numbers from 1 to 49 will be in final square. Since the same numbers appear in every row of each of the latin squares, the row sums will always be the same, and so will the column sums. Finally, since the assignment of numbers to ranks and regiments is completely arbitrary, a great number of different magic squares can be constructed by this method.