Matrix multiplication algebra · 4.1
Magic, charming, and semimagic squares
Ordinary matrix multiplication takes us from the three-dimensional space of magic squares into the five-dimensional algebra of semimagic matrices. This page derives explicit product laws, a complete classification, and exact decompositions.
1. A product of two magic squares
We use the previously proved general form of a magic square:
Set s₀=M(1,0,0), s₁=M(0,1,0), and s₂=M(0,0,1). Then M(E,x,y)=Es₀+xs₁+ys₂. Direct multiplication of these three basis matrices shows that a product of two magic squares generally loses the diagonal conditions while retaining equal row and column sums.
The last matrix has zero row and column sums, but its main diagonal sums to 6. Hence the space of magic squares is not closed under matrix multiplication.
2. Standard theory and our terminology
A matrix is semimagic when all of its row sums and column sums agree. For a 3×3 matrix we write this common sum as 3E. Let P denote the central-reversal matrix and 𝟙 the all-ones matrix:
In standard terminology, a semimagic matrix A of weight E is associated when A+PAP=2E𝟙, and balanced, or centrosymmetric, when PAP=A.
Correspondence theorem
Over a field of characteristic other than 2 or 3, the associated semimagic 3×3 matrices are exactly the magic squares M(E,x,y). The balanced semimagic 3×3 matrices are exactly the matrices C(E,z,w), called charming squares in this project.
Proof for the associated component
In M(E,x,y), every centrally opposite pair sums to 2E, so M+PMP=2E𝟙. Conversely, the associated condition gives central entry E and sum 2E for every opposite pair. Both principal diagonals therefore sum to 3E; together with the semimagic conditions, the matrix is magic.
Proof for the balanced component
A centrosymmetric matrix with equal row and column sums first has the form on the left. Comparing its first row with its first column forces d=b, and equality of sums gives e=a+c−b:
Setting E=(a+b+c)/3, z=(a−b)/3, and w=(c−b)/3 gives the unique form
3. The four product laws
Expanding products in the basis gives four exact formulas. They are polynomial identities and require no division:
Thus MM lands in C, MC and CM land in M, and CC lands in C. Factor order matters: the second coordinates in the MC and CM formulas differ. In particular, every product of an odd number of magic squares is magic, while every product of an even number is charming.
The last statement follows by induction on the number of factors using the four inclusions, rather than by checking individual products.
4. The complete semimagic form
Adding a magic component and a charming component with a single shared parameter E gives five coordinates:
Classification theorem
Over a field of characteristic other than 2 or 3, the map (E,x,y,z,w)↦S(E,x,y,z,w) is a bijection from K⁵ to the set of semimagic 3×3 matrices.
Forward direction
Every row and column of M(E,x,y) sums to 3E, while every row and column of C(0,z,w) sums to 0. Hence every row and column of S(E,x,y,z,w) sums to 3E.
Reverse direction and uniqueness
Let A be semimagic with common sum T. If its upper-left block is denoted by a,b,d,e, the equations for the first two rows and columns force every remaining entry in succession:
The last row and last column then automatically sum to T. Thus the five quantities T,a,b,d,e describe every semimagic matrix uniquely. When division by 2 and 3 is available, the same five degrees of freedom translate into our coordinates:
Substituting the forced form of A into these expressions and then into S recovers all nine entries of A. The recovery formulas prove both existence and uniqueness of E,x,y,z,w.
5. The unique even–odd decomposition
The complete form already contains the canonical decomposition
The charming part contains the common center and serves as the even component; the zero-center magic part serves as the odd component. Their intersection is zero: if C(E,z,w)=M(0,x,y), equality of common sums gives E=0, and uniqueness of the five coordinates gives x=y=z=w=0.
By the four product laws, the degree of a product of homogeneous components is the sum of their degrees modulo 2. Thus the five-dimensional semimagic algebra is ℤ/2ℤ-graded.
6. Generation by magic squares
Exact formula
The first product law gives M(0,1,0)M(0,z,−w)=C(0,z,w), so the right-hand side is exactly the definition of S. Therefore every rational semimagic 3×3 square is a sum of a magic square and a product of two magic squares.
This does not claim that the three magic factors are unique. What is unique is the decomposition into the charming part C(E,z,w) and the zero-center magic part M(0,x,y).
7. Why S=M₁(I+M₂) is not universal
The identity matrix belongs to the charming component:
If S(E,x,y,z,w) is represented as M(a,x,y)(I₃+M(b,u,v)), comparison of the magic and charming parts gives
Over ℚ the first equation is solvable for every E, for example with a=1. Thus the only obstruction lies in the second system, whose determinant is y²−x².
If x²≠y², the system matrix is invertible and permits all z,w. If x=y≠0, both output coordinates equal x(u−v); if x=−y≠0, they equal x(u+v) and −x(u+v). Each resulting condition is sufficient: the required value is obtained by setting one of u,v to zero. When x=y=0, the image consists only of the zero pair. Hence the exact classification is:
| Magic component | Exactly covered charming component |
|---|---|
| All z,w | |
For example, S(0,1,1,1,0) has no such representation: x=y would force z=w, whereas here z=1 and w=0. This is an exact counterexample to universality, and the table describes the maximal domain of the formula.
8. Scope of this article
This page proves the classification and product laws over fields in which 2 and 3 are invertible, while the product identities themselves are integral polynomial identities. Over ℤ a full semimagic matrix may have common sum not divisible by 3, so the coordinates S(E,x,y,z,w) do not cover the entire integral lattice. That boundary requires a separate article.
The next article constructs the isomorphism with K⊕M₂(K), isolates the four-dimensional zero-sum ideal, and gives an explicit split-quaternion basis 1,i,j,k inside it.