Graeco-Latin Square Generator
Take two Latin squares — grids where each symbol appears once per row and column — and lay one over the other. If every combination of the two symbols appears exactly once across the grid, the pair is orthogonal. Euler asked whether thirty-six officers of six ranks and six regiments could be paraded in a six-by-six square, decided they could not, and was right; but he also guessed the same failure at ten and twenty-two, and there he was wrong.
What this generator does
Constructs a pair of orthogonal Latin squares at the size you choose, or says plainly that no such square exists, and then checks the finished grid cell by cell.
How to use this tool
- Choose the size of the square.
- Build it, and read each cell as a letter paired with a Greek symbol.
- Check that each symbol appears once in every row and column.
- Try six, and read why nothing can be built there.
Understanding the controls
- Size of the square
- Three to nine a side. Six is offered deliberately, because the answer there is that no square exists — proved in 1901 by working through every case.
Common use cases
- Designing an experiment that balances two factors at once
- Laying out a trial so every treatment pairing appears once
- Building a tournament schedule with two balanced attributes
- Illustrating a famous conjecture that was half right
- Teaching orthogonality with something you can look at
How this generator works
Odd sizes use two different multipliers over the numbers up to that size; four and eight use arithmetic in a field where every element has an inverse, since the plain multiplier trick fails at even sizes. Neither construction is trusted: both squares are checked to be Latin, and every combination of symbols is tallied across the grid to confirm each appears exactly once.
Randomness and fairness
Nothing is random. Each size has a construction, and the same size always gives the same square.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Three to nine a side. Ten exists — Euler was wrong about it — but finding one is far harder than any construction here.
- Six has no square at all, which is reported rather than worked around.
- One square per size is shown, though many exist for most sizes.
- Three or more mutually orthogonal squares are a further step and are not built here.
Privacy and your data
Squares are built in your browser. Nothing is transmitted or stored.
Related generators
- Golomb Ruler GeneratorThe shortest ruler with a given number of marks on which no distance can be measured twice.
- Langford Sequence GeneratorTwo of each number arranged so the two 3s have three things between them, and so on — which only works for some counts.
- Steiner Triple System GeneratorSplits a group into threes so that every pair of people ends up together exactly once — possible only for certain sizes.
- Sudoku GeneratorPrint a sudoku with exactly one solution — 4x4, 6x6 or full 9x9, four difficulties, with the answer key and a seed to reprint it.