Latin square

A Latin square is an n × n square grid, or matrix, whose entries consist of n symbols such that each symbol appears exactly once in each row and each column. The following are some examples:


1   2  
2   1  


1   2   3  
2   3   1  
3   1   2  


1   2   3   4  
2   3   4   1  
3   4   1   2  
4   1   2   3  


1   2   3   4  
2   1   4   3  
3   4   1   2  
4   3   2   1  


M   A   G   I   C  
G   I   C   M   A  
C   M   A   G   I  
A   G   I   C   M  
I   C   M   A   G  


Latin squares have a long history, stretching back at least as far as medieval Islam (c .1200), when they were used on amulets. Abu l'Abbas al Buni wrote about them and constructed, for example, 4 × 4 Latin squares using letters from a name of God. In his famous etching Melancholia, the 15th century artist Albrecht Dürer portrays a 4 × 4 magic square, a relative of Latin squares, in the background. Other early references to them concern the problem of placing the 16 face cards of an ordinary playing deck in the form of a square so that no row, column, or diagonal should contain more than one card of each suit and each rank. Leonhard Euler began the systematic treatment of Latin squares in 1779 and posed a problem connected with them, known as the thirty-six officers problem, that wasn't solved until the beginning of the 20th century.


Arthur Cayley continued work on Latin squares and in the 1930s the concept arose again in the guise of multiplication tables when the theory of quasigroups and loops began to be developed as a generalization of the group concept. Latin squares played an important role in the foundations of finite geometries, a subject which was also in development at this time. Also in the 1930s, a large application area for Latin squares was opened by R. A. Fisher who used them and other combinatorial structures in the design of statistical experiments.


Latin squares are used in the design of scientific experiments. A scientist testing five versions of an experimental drug can divide her test subjects into five groups and randomly pair one version to each group for testing during the first phase of the experiment. The Latin square can then be used to schedule four more phases so that each version of the drug is tested upon each group of test subjects without duplication.