The legend is brief. When the sage-king Yu was taming the great flood, a turtle rose from the waters of the Luo River, and on the plates of its shell were marks: the numbers one to nine, so arranged that every line of three, across, down or corner to corner, sums to fifteen. The Great Appendix of the Yijing names the event in a single breath with its twin: the He gave forth the map, and the Lo gave forth the writing, and the sages took them as pattern. Behind the legend stands a mathematical fact and a long history.
The fact, noted in Schuyler Cammann's classic study, is that the three-by-three magic square is unique: apart from rotations and reflections, there is only one way to arrange one to nine so that every line sums to fifteen, with five inevitably at the centre. The Chinese diagram is therefore not one design among many but the design, discovered rather than invented.
The history is that by the Han dynasty the square was doing serious cosmological work. Its odd, yang numbers hold the centre and the four cardinal points; its even, yin numbers hold the corners; and each cell was correlated with a direction, a season and a trigram of the Yijing. In the traditional figure the numbers are drawn as knots of dots, white for odd and black for even, joined by short bars, the form in which the Song dynasty fixed the diagram and in which it has been printed ever since.