The sixty-four hexagrams can be ordered in several ways. The arrangement used in every standard edition of the Book of Changes, and the one that determines what a reader meets first and what follows what, is called the King Wen sequence. It pairs the hexagrams so that each is followed by its inversion, or, where a figure is unchanged by inversion, by its complement, and the paired ordering carries an argument: the sequence opens with the two pure figures, the creative and the receptive, and closes with after completion followed by before completion, so that the book ends by refusing to end.
Tradition assigns both the sequence and the judgments, the short statements attached to each hexagram, to King Wen during his imprisonment at Youli by Zhou Xin, the last Shang king. The image of a captive ruler ordering the patterns of change while unable to act is one of the most quoted in Chinese letters, and Sima Qian lists it among the works produced by men in adversity. The line statements are traditionally given to his son, the Duke of Zhou, and the commentaries called the Ten Wings were later attributed to Confucius.
Modern scholarship does not accept the attributions and does not need them. The Zhou Yi is generally dated on linguistic and content grounds to the early Western Zhou period, later than King Wen himself, and read as a compilation of divination records that accumulated rather than a composed book. The manuscripts recovered at Mawangdui in 1973 carry the hexagrams in a different order, which shows that the received arrangement was one option among several rather than an original given. What is not in doubt is that the received sequence has been the frame for every commentary, every diagram and every reading of the text for more than two thousand years.