Mathematical workbench

Square laboratory

Control an arbitrary square through E, x, and y, or obtain these coordinates from a parametric family.

Red–yellow

BEFGJ

E625x96y−525
Matrix 3 × 3 · valuesΣ = 1 875
A721
B4
C1 150
D1 054
E625
F196
G100
H1 246
J529

a brick-red frame marks a value that is a perfect square

Magic invariantall 8 line sums agree
Declared maskBEFGJ · confirmed
Actual result5/9 squares
Nondegeneracy9 pairwise-distinct entries

Family BEFGJ

Theorem and complete proof

General theory of the 4/9 and 5/9 orbits

Statement

Under the assumptions below, the formulas define an integral magic square of order 3 in which at least all 5 cells of the BEFGJ mask are squares of integers. Other cells are allowed to be squares as well.

{B,E,F,G,J}{P:MP(E,x,y)=rP2}\{B,E,F,G,J\}\subseteq\{P:\mathcal M_P(E,x,y)=r_P^2\}

The parameters a, b, c, and d are arbitrary integers. The theorem guarantees that B, E, F, G, and J are squares, but allows additional cells to become squares as well.

Initial system and elimination of E, x, y

For every marked cell, introduce an integral root and substitute the corresponding Magic3 linear form. This gives the system:

{Ex+y=b02,E=e02,E+x+y=f02,E+y=g02,Ex=j02.\left\{\begin{aligned}E-x+y&=b_0^2,&E&=e_0^2,&E+x+y&=f_0^2,\\E+y&=g_0^2,&E-x&=j_0^2.\end{aligned}\right.

The coefficient matrix of E, x, and y has rank 3. Eliminating them therefore leaves 2 independent homogeneous quadratic equations in the roots. The equations are derived and parametrized below.

Derivation of the root parametrization

Introduce the following auxiliary integers:

r=a2+2ab+b2,s=a2+b2,t=a2+2abb2r=-a^2+2ab+b^2,\qquad s=a^2+b^2,\qquad t=a^2+2ab-b^2r2+t2=2s2,K=t2s2r^2+t^2=2s^2,\qquad K=t^2-s^2λ=2cd,b0=λr,g0=λs,f0=λt\lambda=2cd,\qquad b_0=\lambda r,\quad g_0=\lambda s,\quad f_0=\lambda te0=Kd2+c2,j0=Kd2c2e_0=Kd^2+c^2,\qquad j_0=Kd^2-c^2

Define the declared cell values as the following explicit squares:

(B,E,F,G,J)=(b02,e02,f02,g02,j02)(B,E,F,G,J)=(b_0^2,e_0^2,f_0^2,g_0^2,j_0^2)

The red quadric is parametrized by r, s, t. For the second quadric, use a difference of squares: choose (e₀−j₀)(e₀+j₀)=λ²(t²−s²). This is the rational parametrization of the compatibility hyperbola after denominators are cleared.

B+F=λ2(r2+t2)=2λ2s2=2GB+F=\lambda^2(r^2+t^2)=2\lambda^2s^2=2Ge02j02=(2c2)(2Kd2)=4c2d2(t2s2)=f02g02e_0^2-j_0^2=(2c^2)(2Kd^2)=4c^2d^2(t^2-s^2)=f_0^2-g_0^2E+G=F+JE+G=F+JB+EGJ=(B+F2G)+(E+GFJ)=0B+E-G-J=(B+F-2G)+(E+G-F-J)=0B+E=G+JB+E=G+J

The inverse algorithm first parametrizes B+F=2G. Next, at the root level, E−J=F−G becomes (e₀−j₀)(e₀+j₀)=(f₀−g₀)(f₀+g₀). If at least one of E and J is nonzero, choose root signs with e₀−j₀≠0; after a common rescaling, the two factors give rational c and d. The branch E=J=0 is handled separately in the coverage section.

Reconstruction of the magic square

Use the standard three-coordinate form:

M(E,x,y)=(E+xEx+yEyExyEE+x+yE+yE+xyEx)\mathcal M(E,x,y)=\begin{pmatrix} E+x & E-x+y & E-y\\ E-x-y & E & E+x+y\\ E+y & E+x-y & E-x \end{pmatrix}

Set the coordinates equal to the following linear combination of the square values already constructed:

(E,x,y)=(E,EJ,GE)(E,x,y)=(E,\,E-J,\,G-E)

The general linear lemma is applied directly: when the selected cell-form matrix has rank 3, its value vector lies in the image exactly when every vector in the left kernel annihilates it. The left kernel has dimension one for four cells and two for five cells. The colored identities above form precisely such a basis, while the displayed formulas for E, x, and y give the unique preimage.

LS(E,x,y)T=(qP2)PS,kerLST=R1,,R2L_S(E,x,y)^T=(q_P^2)_{P\in S},\qquad \ker L_S^T=\langle R_1,\ldots,R_{2}\rangle

Now substitute the coordinates into the nine Magic3 linear forms. Therefore

πBEFGJ ⁣(M(E,x,y))=(B,E,F,G,J){n2:nZ}5\pi_{BEFGJ}\!\left(\mathcal M(E,x,y)\right)=(B,E,F,G,J)\in\{n^2:n\in\mathbb Z\}^{5}

By the Magic3 form itself, every row, every column, and both diagonals sum to 3E. We have therefore obtained the required family of magic squares with square-valued mask BEFGJ. This proves the claim.

Color lemmas used in this proof

Light-red arithmetic progression

B+F=2GB+F=2G

A red triple means the linear condition U + W = 2V on three cells whose values are all perfect squares.

r=a2+2ab+b2,s=a2+b2,t=a2+2abb2r=-a^2+2ab+b^2,\qquad s=a^2+b^2,\qquad t=a^2+2ab-b^2r2+t2=2s2r^2+t^2=2s^2(U,V,W)=(k2r2,k2s2,k2t2)U+W=2V(U,V,W)=(k^2r^2,\,k^2s^2,\,k^2t^2)\Longrightarrow U+W=2V

In this mask, the lemma variables are replaced by cells B, G, F; its conclusion is exactly the cell relation displayed above.

General statement and proof

Yellow equality of two sums of squares

B+E=G+JB+E=G+J

A yellow four-cell support comes from composition of the Gaussian norm and gives an equality between two pairwise cell sums.

u=ac+bd,v=adbc,w=acbd,z=ad+bcu=ac+bd,\quad v=ad-bc,\quad w=ac-bd,\quad z=ad+bcu2+v2=w2+z2=(a2+b2)(c2+d2)u^2+v^2=w^2+z^2=(a^2+b^2)(c^2+d^2)(U,V,W,Z)=(u2,v2,w2,z2)U+V=W+Z(U,V,W,Z)=(u^2,v^2,w^2,z^2)\Longrightarrow U+V=W+Z

In this mask, the lemma variables are replaced by cells B, E, G, J; its conclusion is exactly the cell relation displayed above.

General statement and proof

Coverage completeness

Status: exact conditional coverage. Completeness here refers to rational root vectors; integral representatives are obtained by clearing denominators and applying a common scale.

Broadest guaranteed subset

Every rational solution for which at least one of E and J is nonzero, together with the zero solution. Equivalently, the whole family is covered except for the explicit nonzero line below.

(E,J)(0,0)or(B,E,F,G,J)=(0,0,0,0,0)(E,J)\ne(0,0)\quad\text{or}\quad(B,E,F,G,J)=(0,0,0,0,0)

Inverse construction

After completely inverting the red conic, choose the signs of e and j so that e−j≠0. For the target point take the common scale L=2(e−j), then c=e−j and define d by Kd²=L(e+j)/2. The identity (e−j)(e+j)=f²−g² makes d rational and recovers all five roots with the common factor L.

What remains outside the guarantee

The only component missed by the current chart is E=J=0 and B=F=G≠0. Both relations hold there, but e₀=Kd²+c² and j₀=Kd²−c² force c=0 and then λ=2cd=0, so a nonzero constant red triple cannot be produced.

Exc(ΦBEFGJ)={E=J=0, B=F=G0}\operatorname{Exc}(\Phi_{BEFGJ})=\{E=J=0,\ B=F=G\ne0\}

Completeness is proved off one nonzero rational line and at the zero point; the line itself is not covered by this formula.

The formulas are checked by an exact integral certificate in the browser generator; migration to proof-core is not complete yet.red_yellow_befgj_square_mask