Original English by Jim Hefferon — 34 validated sections. The original mathematics and supplied answers below are preserved. This is a partial-book reading edition, not the complete book or an Everyday-English rewrite.

Source, reuse and conversion details

Source revision df2262e089a02651c127f1dd12649c4622ee1383; CC BY-SA 2.5 option, with original component credits retained. This is not an Everyday-English rewrite. The complete active topic is included. The long commented-out Beardon alternative and the end-of-file marker remain in the editable source; they are not an extra exercise. Keep the preceding local Linear Maps reader for the linked rank-nullity theorem when reading offline.

Includes five exercises, five original answer containers, two numeric magic-square tables, all three source images, 203 topic mathematical expressions and two bibliography expressions. Modular-context extraction and local layout checks are complete for this section; whole-book integration remains incomplete.

AI-assisted source-preserving conversion and source checks; no human review is claimed. Current rebuild runtime is documented in the credit below; earlier intermediate work is not reattributed. Original author and image/component credits are retained.

Notes about the original source and supplied answers

These five bounded findings are separate from the unchanged text, formulas and images. Opening them may reveal answers. Exact rank computations are finite checks, not a proof for every matrix size. This is not an exhaustive mathematical audit or human review.

  1. Source note 1: The opening dimension formula says n²−n for magic squares when n≥3. The same active text gives dim M_n=1+dim M_n,0 and dim M_n,0=n²−2n−1, which instead imply n²−2n. Exact rational rank replay gives dimension 3, not 6, at n=3, and agrees with n²−2n for n=3 through 12. The finite replay is not a new proof for all n; the original formula is preserved and this warning is separate.
  2. Source note 2: The proof twice indexes inner columns by 2,…,n−2. The described first-block inner columns are 2,…,n−1: the source itself says column 2 for n=3 and columns 2 and 3 for n=4. The source coefficient arrays confirm those entries. Both occurrences are preserved unchanged.
  3. Source note 3: Exercise 2 has three inconsistencies in its displayed reduction. The swap arrow has an extra leading minus although the next matrix is an ordinary row-2/row-6 swap. The later row-3 result requires +ρ₂+ρ₃, not the printed −ρ₂+ρ₃. The row-4 result of −ρ₂+ρ₄ must be (0,0,−1,1|0), not the displayed (0,1,−1,1|0). Exact symbolic replay verifies these discrepancies; a=b=c=d=s/2 does satisfy the original six equations. Original arrows and matrices are unchanged.
  4. Source note 4: Exercise 4 defines θ(M) using Tr*(m), a lowercase variable not introduced there, while the supplied answer uses Tr*(M). The source argument should consistently refer to the matrix M. Both source versions remain unchanged.
  5. Source note 5: Exercise 1’s median explanation says “shows that” immediately followed by an extra “Thus”. This is a duplicated prose connector, preserved in the original answer.

Wide formulas scroll horizontally; focus them and use the arrow keys.

Source-preserving rebuild, navigation, source packaging and current deterministic checks: OpenAI Codex — GPT-6 Astra, Ultra effort. Jim Hefferon remains the author of the mathematics. Earlier intermediate-conversion runtime identity is not established by its retained receipts and is not reassigned to this rebuild. No human review or exhaustive proof certification is claimed.

Magic Squares

A Chinese legend tells the story of a flood by the Lo river. People offered sacrifices to appease the river. Each time a turtle emerged, walked around the sacrifice, and returned to the water. Fuh-Hi, the founder of Chinese civilization, interpreted this to mean that the river was still cranky. Fortunately, a child noticed that on its shell the turtle had the pattern on the left below, which is today called Lo Shu (“river scroll”).

Lo Shu dot pattern arranged in a three-by-three square. Reading rows from top to bottom, the dot counts are 4,9,2; 3,5,7; and 8,1,6. Lines connect the dots within each group. The adjacent numeric table gives the same entries.

4 9 2
3 5 7
8 1 6

The dots make the matrix on the right where the rows, columns, and diagonals add to 15 . Now that the people knew how much to sacrifice, the river’s anger cooled.

A square matrix is magic if each row, column, and diagonal adds to the same number, the matrix’s magic number.

Another magic square appears in the engraving Melencolia I by Dürer.

Albrecht Dürer’s engraving Melencolia I. A seated winged figure rests her head on her hand among tools, a geometric solid, scales and an hourglass. A four-by-four magic square is engraved at the upper right. A separate detail and numeric table follow.

One interpretation is that it depicts melancholy, a depressed state. The figure, genius, has a wealth of fascinating things to explore including the compass, the geometrical solid, the scale, and the hourglass. But the figure is unmoved; all of the things lie unused. One of the potential delights, in the upper right, is a 4 × 4 matrix whose rows, columns, and diagonals add to  34 .

Detail of the four-by-four magic square in Melencolia I. Its rows are 16,3,2,13; 5,10,11,8; 9,6,7,12; and 4,15,14,1. The central entries of the bottom row give the date 1514. The adjacent table presents the same numbers.

16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1

The middle entries on the bottom row give 1514 , the date of the engraving.

The above two squares are arrangements of 1 … n 2 . They are normal. The 1 × 1 square whose sole entry is 1 is normal, Exercise 2 shows that there is no normal 2 × 2 magic square, and there are normal magic squares of every other size; see [Wikipedia, Magic Square]. Finding how many normal magic squares there are of each size is an unsolved problem; see [Online Encyclopedia of Integer Sequences].

If we don’t require that the squares be normal then we can say much more. Every 1 × 1 square is magic, trivially. If the rows, columns, and diagonals of a 2 × 2 matrix

( a b c d )

add to  s then a + b = s , c + d = s , a + c = s , b + d = s , a + d = s , and b + c = s . Exercise 2 shows that this system has the unique solution a = b = c = d = s / 2 . So the set of 2 × 2 magic squares is a one-dimensional subspace of ℳ 2 × 2 .

A sum of two same-sized magic squares is magic and a scalar multiple of a magic square is magic so the set of n × n magic squares ℳ n is a vector space, a subspace of ℳ n × n . This Topic shows that for n ≥ 3 the dimension of ℳ n is n 2 − n . The set ℳ n , 0 of n × n  magic squares with magic number  0 is another subspace and we will verify the formula for its dimension also: n 2 − 2 n − 1 when n ≥ 3 .

We will first prove that dim ⁡ ℳ n = dim ⁡ ℳ n , 0 + 1 . Define the trace of a matrix to be the sum down its upper-left to lower-right diagonal Tr ( M ) = m 1 , 1 + ⋯ + m n , n . Consider the restriction of the trace to the magic squares Tr : ℳ n → ℝ . The null space 𝒩 ( Tr ) is the set of magic squares with magic number zero ℳ n , 0 . Observe that the trace is onto because for any  r in the codomain ℝ the n × n matrix whose entries are all r / n is a magic square with magic number  r . Theorem Two.II.2.14 says that for any linear map the dimension of the domain equals the dimension of the range space plus the dimension of the null space, the map’s rank plus its nullity. Here the domain is ℳ n , the range space is ℝ and the null space is ℳ n , 0 , so we have that dim ⁡ ℳ n = 1 + dim ⁡ ℳ n , 0 .

We will finish by finding the dimension of the vector space ℳ n , 0 . For n = 1 the dimension is clearly 0 . Exercise 3 shows that dim ⁡ ℳ n , 0 is also 0 for n = 2 .

That leaves showing that dim ⁡ ℳ n , 0 = n 2 − 2 n − 1 for n ≥ 3 . The fact that the squares in this vector space are magic gives us a linear system of restrictions, and the fact that they have magic number zero makes this system homogeneous: for instance consider the 3 × 3 case. The restriction that the rows, columns, and diagonals of

( a b c d e f g h i )

add to zero gives this ( 2 n + 2 ) × n 2 linear system.

a + b + c = 0 d + e + f = 0 g + h + i = 0 a + d + g = 0 b + e + h = 0 c + f + i = 0 a + e + i = 0 c + e + g = 0

We will find the dimension of the space by finding the number of free variables in the linear system.

The matrix of coefficients for the particular cases of n = 3 and  n = 4 are below, with the rows and columns numbered to help in reading the proof. With respect to the standard basis, each represents a linear map h : ℝ n 2 → ℝ 2 n + 2 . The domain has dimension  n 2 so if we show that the rank of the matrix is 2 n + 1 then we will have what we want, that the dimension of the null space ℳ n , 0 is n 2 − ( 2 n + 1 ) .

  1 2 3 4 5 6 7 8 9 ρ → 1 1 1 1 0 0 0 0 0 0 ρ → 2 0 0 0 1 1 1 0 0 0 ρ → 3 0 0 0 0 0 0 1 1 1 ρ → 4 1 0 0 1 0 0 1 0 0 ρ → 5 0 1 0 0 1 0 0 1 0 ρ → 6 0 0 1 0 0 1 0 0 1 ρ → 7 1 0 0 0 1 0 0 0 1 ρ → 8 0 0 1 0 1 0 1 0 0

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ρ → 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 ρ → 2 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 ρ → 3 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 ρ → 4 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 ρ → 5 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ρ → 6 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 ρ → 7 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ρ → 8 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 ρ → 9 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ρ → 10 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0

We want to show that the rank of the matrix of coefficients, the number of rows in a maximal linearly independent set, is 2 n + 1 . The first n  rows of the matrix of coefficients add to the same vector as the second n  rows, the vector of all ones. So a maximal linearly independent must omit at least one row. We will show that the set of all rows but the first { ρ → 2 … ρ → 2 n + 2 } is linearly independent. So consider this linear relationship.

c 2 ρ → 2 + ⋯ + c 2 n ρ → 2 n + c 2 n + 1 ρ → 2 n + 1 + c 2 n + 2 ρ → 2 n + 2 = 0 → ( ∗ )

Now it gets messy. Focus on the lower left of the tables. Observe that in the final two rows, in the first  n columns, is a subrow that is all zeros except that it starts with a one in column  1 and a subrow that is all zeros except that it ends with a one in column  n .

First, with ρ → 1 omitted, both column  1 and column  n contain only two ones. Since the only rows in ( ∗ ) with nonzero column  1 entries are rows ρ → n + 1 and ρ → 2 n + 1 , which have ones, we must have c 2 n + 1 = − c n + 1 . Likewise considering the n -th entries of the vectors in ( ∗ ) gives that c 2 n + 2 = − c 2 n .

Next consider the columns between those two— in the n = 3 table this includes only column  2 while in the n = 4  table it includes both columns  2 and  3 . Each such column has a single one. That is, for each column index j ∈ { 2 … n − 2 } the column consists of only zeros except for a one in row  n + j , and hence c n + j = 0 .

On to the next block of columns, from n + 1 through  2 n . Column  n + 1 has only two ones (because n ≥ 3 the ones in the last two rows do not fall in the first column of this block). Thus c 2 = − c n + 1 and therefore c 2 = c 2 n + 1 . Likewise, from column  2 n we conclude that c 2 = − c 2 n and so c 2 = c 2 n + 2 .

Because n ≥ 3 there is at least one column between column  n + 1 and column  2 n − 1 . In at least one of those columns a one appears in ρ → 2 n + 1 . If a one also appears in that column in ρ → 2 n + 2 then we have c 2 = − ( c 2 n + 1 + c 2 n + 2 ) since c n + j = 0 for j ∈ { 2 … n − 2 } . If a one does not appear in that column in ρ → 2 n + 2 then we have c 2 = − c 2 n + 1 . In either case c 2 = 0 , and thus c 2 n + 1 = c 2 n + 2 = 0 and c n + 1 = c 2 n = 0 .

If the next block of n -many columns is not the last then similarly conclude from its first column that c 3 = c n + 1 = 0 .

Keep this up until we reach the last block of columns, those numbered ( n − 1 ) n + 1 through  n 2 . Because c n + 1 = ⋯ = c 2 n = 0 column  n 2 gives that c n = − c 2 n + 1 = 0 .

Therefore the rank of the matrix is 2 n + 1 , as required.

The classic source on normal magic squares is [Ball & Coxeter]. More on the Lo Shu square is at [Wikipedia, Lo Shu Square]. The proof given here began with [Ward].

Exercises

  1. Exercise 1 Supplied answer

    Let M be a 3 × 3 magic square with magic number  s .

    1. Prove that the sum of M ’s entries is 3 s .

    2. Prove that s = 3 ⋅ m 2 , 2 .

    3. Prove that m 2 , 2 is the average of the entries in its row, its column, and in each diagonal.

    4. Prove that m 2 , 2 is the median of M ’s entries.

    Back to Exercise 1

    Answer.

    1. The sum of the entries of M is the sum of the sums of the three rows.

    2. The constraints on entries of M involving the center entry make this system.

      m 2 , 1 + m 2 , 2 + m 2 , 3 = s m 1 , 2 + m 2 , 2 + m 3 , 2 = s m 1 , 1 + m 2 , 2 + m 3 , 3 = s m 1 , 3 + m 2 , 2 + m 3 , 1 = s

      Adding those four equations counts each matrix entry once and only once, except that we count the center entry four times. Thus the left side sums to 3 s + 3 m 2 , 2 while the right sums to 4 s . So 3 m 2 , 2 = s .

    3. The second row adds to s so m 2 , 1 + m 2 , 2 + m 2 , 3 = 3 m 2 , 2 , giving that ( 1 / 2 ) ⋅ ( m 2 , 1 + m 2 , 3 ) = m 2 , 2 . The same goes for the column and the diagonals.

    4. By the prior exercise either both m 2 , 1 and m 2 , 3 are equal to m 2 , 2 or else one is greater while one is smaller. Thus m 2 , 2 is the median of the set { m 2 , 1 , m 2 , 2 , m 2 , 3 } . The same reasoning applied to the second column shows that Thus m 2 , 2 is the median of the set { m 1 , 2 , m 2 , 1 , m 2 , 2 , m 2 , 3 , m 3 , 2 } . Extending to the two diagonals shows it is the median of the set of all entries.

  2. Exercise 2 Supplied answer

    Solve the system a + b = s , c + d = s , a + c = s , b + d = s , a + d = s , and b + c = s .

    Back to Exercise 2

    Answer. For any k we have this.

    ( 1 1 0 0 s 0 0 1 1 s 1 0 1 0 s 0 1 0 1 s 1 0 0 1 s 0 1 1 0 s ) ⟶ − ρ 1 + ρ 5 − ρ 1 + ρ 3 ( ( 1 1 0 0 s 0 0 1 1 s 0 − 1 1 0 0 0 1 0 1 s 0 − 1 0 1 0 0 1 1 0 s ) ⟶ − ρ 2 ↔ ρ 6 ( ( 1 1 0 0 s 0 1 1 0 s 0 − 1 1 0 0 0 1 0 1 s 0 − 1 0 1 0 0 0 1 1 s ) ⟶ − ρ 2 + ρ 4 ρ 2 + ρ 5 − ρ 2 + ρ 3 ( ( 1 1 0 0 s 0 1 1 0 s 0 0 2 0 s 0 1 − 1 1 0 0 0 1 1 s 0 0 1 1 s )

    The unique solution is a = b = c = d = s / 2 .

  3. Exercise 3 Supplied answer

    Show that dim ⁡ ℳ 2 , 0 = 0 .

    Back to Exercise 3

    Answer. By the prior exercise the only member is Z 2 × 2 .

  4. Exercise 4 Supplied answer

    Let the trace function be Tr ( M ) = m 1 , 1 + ⋯ + m n , n . Define also the sum down the other diagonal Tr ∗ ( M ) = m 1 , n + ⋯ + m n , 1 .

    1. Show that the two functions Tr , Tr ∗ : ℳ n × n → ℝ are linear.

    2. Show that the function θ : ℳ n × n → ℝ 2 given by θ ( M ) = ( Tr ( M ) , Tr ∗ ( m ) ) is linear.

    3. Generalize the prior item.

    Back to Exercise 4

    Answer.

    1. Where M , N ∈ ℳ n × n we have Tr ( c M + d N ) = ( c m 1 , 1 + d n 1 , 1 ) + ⋯ + ( c m n , n + d n n , n ) = ( c m 1 , 1 + ⋯ + c m n , n ) + ( d n 1 , 1 + ⋯ + d n n , n ) = c ⋅ Tr ( M ) + d ⋅ Tr ( N ) where all numbers are real, so the trace preserves linear combinations. The argument for Tr ∗ is similar.

    2. It preserves linear combinations: where all numbers are real, θ ( c M + d N ) = ( Tr ( c M + d N ) , Tr ∗ ( c M + d N ) ) = ( c ⋅ Tr ( M ) + d ⋅ Tr ( N ) , c ⋅ Tr ∗ ( M ) + d ⋅ Tr ∗ ( N ) ) = c ⋅ θ ( M ) + d ⋅ θ ( N ) .

    3. Where h 1 , … , h n : V → W are linear then so is g : V → W n given by g ( v → ) = ( h 1 ( v → ) , … , h n ( v → ) ) . The proof just follows the proof of the prior item.

  5. Exercise 5 Supplied answer

    A square matrix is semimagic if the rows and columns add to the same value, that is, if we drop the condition on the diagonals.

    1. Show that the set of semimagic squares ℋ n is a subspace of ℳ n × n .

    2. Show that the set ℋ n , 0 of n × n  semimagic squares with magic number  0 is also a subspace of ℳ n × n .

    Back to Exercise 5

    Answer.

    1. The sum of two semimagic squares is semimagic, as is a scalar multiple of a semimagic square.

    2. As with the prior item, a linear combination of two semimagic squares with magic number zero is also such a matrix.

References cited in this section

Wikipedia, Magic Square

Magic square, http://en.wikipedia.org/wiki/Magic_square, 2012-Feb-17.

Online Encyclopedia of Integer Sequences

Number of different magic squares of order n that can be formed from the numbers 1 , …, n 2 , http://oeis.org/A006052, 2012-Feb-17.

Ball & Coxeter

W.W. Rouse Ball, Mathematical Recreations and Essays, revised by H.S.M. Coxeter, MacMillan, 1962.

Wikipedia, Lo Shu Square

Lo Shu Square, http://en.wikipedia.org/wiki/Lo_Shu_Square, 2012-Feb-17.

Ward

James E. Ward III, Vector Spaces of Magic Squares, Mathematics Magazine, vol 53 no 2 (Mar 1980), p 108–111.