The Unified Logic of Clockwise and Counterclockwise Reading of the Sixty-Four Hexagrams on the Circular Diagram of the Compass
In the circular diagram of the sixty-four hexagrams, the reading order from the bottom line to the top line is not uniform. The prescribed order takes Kun as one, Xun as two, Li as three, Dui as four, Gen as six, Kan as seven, Zhen as eight, and Qian as nine. Qian, Kun, Kan, and Li form one group; Zhen, Dui, Xun, and Gen form another — that is, when the bottom and top lines are identical they belong to one group, and when different, to the other.
When the lower and upper trigrams of a hexagram belong to different groups, the reading proceeds clockwise from the bottom-line position up to the top; when the upper and lower trigrams belong to the same group, it proceeds clockwise from the top-line position down to the bottom. This conceals a subtle logic.
Viewed as a whole, its essence is an XOR logic. Here it should not be described in terms of yin and yang, but rather in terms of forward and reverse. Since the general rule is "yang goes forward, yin goes reverse," and "different upper and lower is forward" therefore yields yang, while "same upper and lower is reverse" therefore yields yin.
However, under the usual classification, Qian, Kun, Kan, and Li occupy the four cardinal positions and are regarded as yang trigrams. Taking the order from bottom line to top as forward and following the unified principle of "heaven is yang, earth is yin," here the hexagram is yin from top to bottom — and thus a unified logic is formed.
Because of the equivalence of continuous XOR operations, one may XOR the first and third lines of a hexagram, and then XOR the fourth and sixth lines. Since XOR satisfies the commutative law, the forward or reverse ordering of the hexagram lines is in fact equivalent to the XOR result of the first, third, fourth, and sixth lines. Therefore, after the upper and lower trigrams are assigned back, one can still determine forward or reverse by the original grouping rule: hexagrams whose number in the sequence is 1, 3, 7, or 9 are arranged clockwise from top to bottom; those with 2, 4, 6, or 8 are arranged counterclockwise from bottom to top.
Thus, grouping Qian with Li, Kun with Kan, Zhen with Gen, and Dui with Xun respectively, and discussing them in terms of the five elements: Li overcomes Qian, Kun overcomes Kan, Zhen overcomes Gen, and Dui overcomes Xun — their qi is interconnected, and wherever they meet, transformation becomes possible.