Computation

Orthogonal squares are a code

Write down each cell of a set of orthogonal Latin squares as a word — its row, its column, and its entry in each square — and no two words agree in more than one place. That is not a pleasant accident of the squares. It is exactly what being Latin and being orthogonal say, it makes the list an error-correcting code as good as any code of its size can be, and the squares a field builds turn out to be a Reed–Solomon code, the one on every compact disc.

Worth reading first: A field's worth of squares · A polynomial through the gaps.

Two Latin squares of the same order are orthogonal when, laid one over the other, every ordered pair of symbols appears in exactly one cell. A field of order qq builds q1q - 1 of them, every two orthogonal, by the one line La(i,j)=ai+jL_a(i, j) = a\cdot i + j. And a complete set of them is a geometry in disguise: a plane with q2q^2 points in which every two points lie on one line.

This essay reads the same object a third way, and the third reading is the one that matters most outside mathematics. Take each cell of a set of kk orthogonal squares and write it down as a word of length k+2k + 2: its row, its column, and the symbol it holds in each square. The q2q^2 cells give q2q^2 words. Any two of those words agree in at most one position. So the list is a code — a set of words chosen to be far apart, so that a word damaged in transit can still be recognised — and it is as good a code as any code with that many words and that length can possibly be.

Sixteen words, and the distance between any two

Start with the three orthogonal squares of order four that the field of four elements builds, and write the sixteen cells as words: row, column, then the entry in each of the three squares. Each word has five symbols, drawn from the four elements 0,1,α,α+10, 1, \alpha, \alpha + 1 of the field.

3 orthogonal squares of order 4, read as a code. A table of 16 words of length 5 over 4 symbols, one per cell of 3 orthogonal Latin squares of order 4: row, column and the entry in each square. Any two words agree in at most one position.
Fig. 1 The sixteen cells of the three orthogonal squares of order four, each written as a word of five symbols: row, column, then the cell’s entry in each square. All 120 pairs of words were compared, and every pair differs in exactly four of the five places — so no two words agree in more than one position.

All 120 pairs of words differ in exactly four places. None agrees with another in more than one position, and in fact every pair agrees in exactly one. That is the property to explain, and it follows from the definitions one pair of positions at a time.

Suppose two different words agreed in two positions. If the two positions are the row and the column, the words come from the same cell, so they are the same word. If they are the row and one square’s entry, then that row of that square holds the same symbol in two different cells, which a Latin square forbids; the column and one square’s entry is the same argument turned sideways. And if they are two squares’ entries, then the ordered pair of symbols those two squares show appears in two different cells — which is precisely what orthogonality forbids. Being Latin and being orthogonal are, together, the statement that no two words agree twice. Nothing else is needed and nothing else is true.

That also explains why every pair agrees in exactly one place for a complete set, and the reason is a count. Fix one word. In any single position, each symbol is carried by exactly qq of the q2q^2 words, so q1q - 1 other words agree with the fixed word in that position. With all q1q - 1 squares present there are q+1q + 1 positions, which gives (q+1)(q1)=q21(q + 1)(q - 1) = q^2 - 1 agreements — one for every other word. No word can be counted twice, since no word agrees twice, so every other word agrees exactly once.

As good as a code can be

Distance is the currency of error correction. If every two words differ in at least dd places, a received word with fewer than d/2d/2 symbols wrong is still nearer its original than any other word, and a received word with d1d - 1 symbols erased — known to be missing — can still be identified uniquely. The trade-off is that far-apart words are scarce, and the sharpest limit on how scarce is the Singleton bound: a code of length nn with MM words and distance dd has

Mqnd+1.M \le q^{\,n - d + 1}.

The proof is one sentence. Delete any d1d - 1 positions from every word; the shortened words are still all different, since two words differing in at least dd places still differ somewhere among the rest; and there are only qnd+1q^{\,n - d + 1} possible shortened words.

For codes made from squares, M=q2M = q^2, so the bound says dn1d \le n - 1 — and the codes from squares achieve d=n1d = n - 1 exactly. They sit on the bound. A code that meets the Singleton bound is called maximum distance separable, and every set of kk orthogonal squares of order qq gives one: q2q^2 words of length k+2k + 2 over qq symbols at distance k+1k + 1. The converse holds too. Given any such code, its first two positions name every word exactly once — that is the bound met with equality — so they can be read as a row and a column, and each further position is then a Latin square, every two of them orthogonal. Sets of orthogonal Latin squares and maximum distance separable codes of this size are the same thing.

Two surviving symbols name the whole word. A word of length 5 from 3 orthogonal squares of order 4, shown whole, with all but two symbols erased, and with all but one erased; two survivors determine it, one does not.
Fig. 2 One word of the code of length five, whole; with three of its five symbols erased; and with four erased. When two symbols survive, exactly one of the sixteen words fits them, so the erased three are recovered — and this was checked for every word and every one of the ten pairs of surviving positions. When only one survives, four words fit and nothing can be recovered.

The erasure reading makes it concrete. Any two surviving symbols of a word pick it out, because any two positions together name every word exactly once — which is orthogonality again, or Latinness, depending on the two positions. So a word can lose any three of its five symbols and be restored. Lose four and the one survivor fits q=4q = 4 words, so no code of sixteen words and length five could do better: three erasures is the Singleton bound’s limit, and the code reaches it.

Every pair of positions casts a vote

Erasures are the easy case, because the damaged positions announce themselves. An error — a symbol silently replaced by a wrong one — is harder, and the squares give a decoder for it that needs no algebra at all.

Take a received word of length five, one symbol of which may be wrong, and let every pair of positions vote. There are ten pairs, and each pair of symbols names exactly one codeword, so each pair votes for a word. The six pairs that avoid the damaged position all read correct symbols, and all six vote for the transmitted word. The four pairs that include the damaged position may vote for wrong words — but no wrong word can collect two of those votes. If it did, it would agree with the received word at the damaged position and at two correct ones, and so agree with the transmitted word at two positions, which no two codewords do. So the transmitted word wins six votes to at most one, and a single error is corrected by counting.

With two errors the count fails, as it must: three pairs avoid both damaged positions and vote correctly, and a wrong word that happens to match both damaged symbols and one correct one collects three votes of its own — as many as the transmitted word. A code whose words differ in four places can correct one error and detect two, and the vote shows both halves of that sentence at work. Practical decoders for Reed–Solomon codes solve equations instead of counting votes, because the number of pairs grows quickly with the length, but the vote is the definition of what they compute: the codeword that agrees with the received word in the most places.

The squares a field builds are a Reed–Solomon code

The field construction has a second meaning that was hiding in plain sight. The word for cell (i,j)(i, j) is

(i,  j,  a1i+j,  a2i+j,  ,  aq1i+j).\big(\,i,\ \ j,\ \ a_1 i + j,\ \ a_2 i + j,\ \ \ldots,\ \ a_{q-1} i + j\,\big).

Read j+ixj + i x as a polynomial of degree at most one in xx. Then the last entries are that polynomial’s values at the nonzero field elements x=a1,,aq1x = a_1, \ldots, a_{q-1}, the column jj is its value at x=0x = 0, and the row ii is its leading coefficient — its “value at infinity”, which is what the polynomial looks like from very far away. So every word is a list of the values of one linear polynomial, taken at every point of the field and at the point at infinity.

That is the Reed–Solomon code of dimension two, from Irving Reed and Gustave Solomon’s paper of 1960. Its distance has the one-line proof that the essay on polynomials through gaps gave for all Reed–Solomon codes: two different polynomials of degree at most one agree at most at one point, since their difference is a nonzero polynomial of degree at most one and has at most one root. The same fact, stated as geometry, is that two different lines meet at most once. Stated as Latin squares, it is orthogonality.

So the squares Euler could not find at order six, the lines of a finite plane, and the codes that protect the data on a compact disc and in a QR code are three descriptions of one object. The practical codes use polynomials of higher degree, which trade distance for more words, but the principle is the one drawn here: evaluate a low-degree polynomial at many points, and any two words are far apart because two low-degree polynomials cannot agree often.

The distances are forced

A maximum distance separable code has a property that ordinary codes do not: once its length, size and alphabet are fixed, the number of words at each distance from any given word is determined. No choice of construction can change it.

2 orthogonal squares of order 5, read as a code. A table of 25 words of length 4 over 5 symbols, one per cell of 2 orthogonal Latin squares of order 5: row, column and the entry in each square. Any two words agree in at most one position.
Fig. 3 Two orthogonal squares of order five, read as a code of 25 words of length four over five symbols. All 300 pairs were compared: 200 differ in three places and 100 in four, so each word has sixteen others at distance three and eight at distance four. Those numbers are the ones the formula for maximum distance separable codes forces, and the figure checks them against it.

For two squares of order five the code has 25 words of length four at distance three, and every word has exactly sixteen others at distance three and eight at distance four. The same count explains it. In each of the four positions, q1=4q - 1 = 4 other words share the fixed word’s symbol, and each of them agrees with it there and nowhere else, so those 4×4=164 \times 4 = 16 words are at distance three. The other 2416=824 - 16 = 8 words agree with it nowhere, and are at distance four. Nothing about the particular squares entered the count. The general formula, which F. J. MacWilliams and N. J. A. Sloane’s book on coding theory gives for every maximum distance separable code, was checked by the figure at every distance.

For a complete set the formula gives the equidistance already seen: every pair of the sixteen words of length five is at distance exactly four. A complete set of orthogonal squares is a code in which every two words are equally far apart — the same symmetry as an affine plane, where every two lines either meet once or are parallel, and parallel lines agree in the position that names their direction.

At most n − 1 squares, and why that bounds a code

The oldest fact about orthogonal squares is that there can be at most n1n - 1 of them at order nn, and the argument is a relabelling and a count. In code language it becomes a bound on length: a code of n2n^2 words over nn symbols in which no two words agree twice has length at most n+1n + 1.

Why order 4 carries no more than 3 orthogonal squares. The orthogonal squares standardised to a common first row, with the one cell that decides how many of them there can be marked in each.
Fig. 4 Why order four carries no more than three orthogonal squares. Relabel each square so that its first row reads 0, 1, 2, 3, which changes no pair count. Then the cell below the corner cannot hold 0 in any square, and no two squares can hold the same symbol there. Three symbols remain for it — so at most three squares.

Translated, the argument runs like this. Relabel the symbols of every square position so that the words of row 00 read their own column number in every square position. Now look at the word for cell (1,0)(1, 0). It cannot hold 00 in any square position, for it would then agree with the word for cell (0,0)(0, 0) in the column and in that position — twice. And it cannot hold the same symbol ss in two square positions, for it would then agree twice with the word for cell (0,s)(0, s). So its square positions carry different nonzero symbols, of which there are n1n - 1, and the length is at most 2+(n1)=n+12 + (n - 1) = n + 1.

For codes over a field whose words are closed under addition and scaling — linear codes — the analogous question for every dimension is the MDS conjecture of Beniamino Segre, from 1955: that the longest nontrivial linear maximum distance separable code over a field of qq elements has length q+1q + 1, with a single family of exceptions in even characteristic. Simeon Ball proved it in 2012 for fields of prime order, and for other orders it is still open. The squares settle dimension two, for linear and non-linear codes alike, with the argument in the figure.

Two codes that do not exist

The table of the longest codes that squares give, alphabet by alphabet, is the table of how many orthogonal squares exist, and its two famous gaps are two famous non-existence theorems.

The longest codes that orthogonal squares give, alphabet by alphabet. A table for alphabet sizes 2 to 12 of the largest known number of mutually orthogonal Latin squares and the corresponding code length, with the prime powers built and checked and the rest quoted or open.
Fig. 5 For each alphabet size from 2 to 12: the most mutually orthogonal Latin squares known, and the longest code of n2n^2 words in which no two words agree twice. For prime powers the field supplies n − 1 squares and the code reaches length n + 1; those rows were built and checked. At 6 there is only one square and the code stops at length 3. At 10 and 12 the true values are unknown.

At six symbols there is no pair of orthogonal squares — Euler’s officers, proved impossible by Gaston Tarry’s exhaustive search in 1900 — so there is no code of 36 words of length four over six symbols in which any two words differ in at least three places. Stated that way, it sounds like a question about codes that nobody would have guessed was a question about officers.

At ten symbols the table stops knowing. Two orthogonal squares exist, found by Ernest Parker in 1959, so the code reaches length four; whether three exist, for length five, is open. What is known is that nine do not: a complete set would be a projective plane of order ten, and Clement Lam, Larry Thiel and Stanley Swiercz showed in 1989, after thousands of hours of computation, that there is no such plane. The surprising part is how. Their search did not look for the plane directly. It studied the binary code spanned by the plane’s lines — a code that would have had to exist if the plane did — and used the MacWilliams identities, which constrain a code’s distance distribution from its dual’s, to show that the code would need words of certain weights; the computer then showed those words could not be placed. The largest non-existence proof in the theory of orthogonal squares is a theorem about a code, which is fitting, because the squares were a code all along.

What the tables cannot show

They cannot show codes that are not built from a field. Every complete set checked here comes from the field construction. At order nine there are other complete sets, from planes no field built, and their codes are maximum distance separable but not linear; the figures do not draw them, and the equivalence between squares and codes is argued for them rather than exhibited.

They cannot show the practical codes. The codes that carry real data have many more words than q2q^2 — polynomials of degree up to some k1k - 1 rather than one — and are decoded by algorithms, not by comparing a received word against a table. The squares show why distance comes from low-degree polynomials; they show nothing of how a decoder finds the nearest word quickly, which is a separate and much harder matter.

And the table’s open rows are open. Whether three orthogonal squares of order ten exist, and the true number at twelve, are not settled by anything here. The two gaps are recorded as the literature leaves them.

Still open: three squares of order ten

The smallest open case is small enough to state on a postcard and has resisted every search: are there three mutually orthogonal Latin squares of order ten? Equivalently, is there a code of one hundred words, of length five, over ten symbols, in which no two words agree in two places? Two such squares exist in abundance; a complete set of nine does not; everything between is unknown. Searches have ruled out large families of candidate constructions, and the space of Latin squares of order ten, about 9.98×10369.98 \times 10^{36} of them, is far beyond exhaustion.

The same object, three times

A set of kk orthogonal Latin squares of order qq, read cell by cell, is a code of q2q^2 words of length k+2k + 2 in which no two words agree in two places — and conversely. Being Latin and being orthogonal are exactly that property, so the code meets the Singleton bound: any two surviving symbols recover a word, and its distance distribution is forced by its size. The squares a field builds, ai+ja\cdot i + j, are the values of linear polynomials — a Reed–Solomon code — and their distance is the fact that two lines meet at most once.

The bound of n1n - 1 squares is a bound of n+1n + 1 on the code’s length. Euler’s thirty-six officers become a code of 36 words that cannot exist, and the non-existence of a plane of order ten was proved by studying a code the plane would have carried. Squares, planes and codes are one object, and each description proves something the others find hard.

When a combinatorial object keeps turning up in other subjects under other names, the names are usually describing one property from three sides.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

ErasureError-correcting codeFinite fieldHamming distanceLatin squareOrthogonal latin squaresProjective planeReed solomon codeSingleton bound