 This edition of The Critical Line is all about magic squares. Take on this challenge, brought to you by Dan Mayoh, for your chance to win a $50 Dymocks voucher! As most readers probably know, a traditional magic square takes a n*n square and arranges the natural numbers from 1 to n2 into the cells of the larger square such that every row, column and main diagonal sums to the same value, which will be (n3 + n)/2. There is only 1 unique 3*3 magic square, not counting rotations and reflections. There is a straightforward algorithm for generating magic squares for odd values of n. Start with a 1 in the middle of the bottom row. Next, move one square diagonally down-and-right, allowing for the grid to wrap from bottom to top and right to left. (So in the example above, we’d move to the location of the ‘2’ square.) If that square is empty, place the next natural number there. If that square is not empty, go back to the previous square and move one step up instead, and place the next natural number there instead. Repeat until all n2 numbers are placed. This is not the only way to generate magic squares for odd n – for example there are many unique 5*5 magic squares not counting rotations and reflections, and this approach will only yield one – but it is a simple way. Generating magic squares for even n is a different kettle of fish, and one I’m not going to get into here. ### The Critical Line challenge Let’s relax the definition so that we are no longer required to use the consecutive numbers 1 to n2, but can instead use any set of n2 distinct positive integers. We still require that all rows, columns and two main diagonals sum to the same value. Now there are an infinite number of different 3*3 squares that can be created. Our challenge is to create a 3*3 magic square under this definition, but using as many square numbers (1, 4, 9, 16,…) as we can. It is thought that a 3*3 square with all 9 numbers as square numbers is impossible. Creating one using 4 square numbers is trivial. (Just pick any 4 square numbers, place them in three of the corners and the centre, and fill in the rest of the grid. The only difficulty is making sure none of the remaining numbers need to be negative, zero or repeats in order to balance the row/column/diagonal sum). Can you find a 3*3 square using 5, 6, 7 or more square numbers? The winner will be the person who sends in a solution with the most square numbers by April 18. In the event of a tie, the lower row sum will be the tie-breaker criterion. For your chance to win$50, send your solution to the puzzle to ActuariesMag@actuaries.asn.au

#### Critical Line Solution – Volume 10. An Orderly Stroll

We had 6 correct solutions to this month’s puzzle. Congratulations to Andrew Parker, Dan Mayoh, Patrick He, Chris Barry, Marcus Burton and Jack Lam.

The winner this month, for the nicest proof, is Andrew Parker.

Along a straight line of unit length I have placed $$n$$ equally spaced cones (at $$\frac{1}{n+1}, \frac{2}{n+1}, \dots, \frac{n}{n+1}$$) and I have numbered them from $$1$$ to $$n$$. You start at position $$0$$ and walk to cone labelled $$1$$, then to the cone labelled $$2$$ and so on until you have collected all the cones, at which point you walk to point $$1$$. Given the cones were labelled at random from one of the $$n$$! different permutations, what is the expected distance that you have to walk?

#### Solution

The expected value is $$\frac{n+2}3$$

To demonstrate this, let $$X_0$$ denote the distance from position $$0$$ to the cone labelled $$1$$. Let $$X_n$$ denote the distance from the cone labelled $$n$$ to position $$1$$. Finally, for $$1 \le 2 < n$$, let $$X_j$$ denote the distance between the cones labelled $$j$$ and $$j+1$$. We need to evaluate:

$$\mathbb{E}[X_0 + X_1 + \dots + X_n] = \mathbb{E}[X_0] + \mathbb{E}[X_1] + \dots + \mathbb{E}[X_n]$$

The cone labelled $$1$$ will appear at some uniform position along the unit line, so clearly $$\mathbb{E}[X_0] = \frac{1}2$$. Similarly $$\mathbb{E}[X_n] = \frac{1}2$$.

To calculate $$\mathbb{E}[X_j]$$ for $$1 \le 2 < n$$, let $$X_j$$ (i.e. the distance between two consecutive cones), we can visualise the unit line as being curled back into a circle (so that point $$0$$ is connected to point $$1$$). Then point $$0$$ and the two consecutive cones represent three points that are uniformly distributed around a circle. The average distance between the points will therefore be $$\frac{1}3$$. Summing up these expected values gives us the total expected distance walked of $$\frac{n+2}3$$

CPD: Actuaries Institute Members can claim two CPD points for every hour of reading articles on Actuaries Digital.