The Case for Little-Endian

The I Ching is more than just a collection of sayings; the sayings are linked to 64 images (gua, hexagrams) that consist of six solid or broken lines which are a binary representation of the numbers 0 through 63.

Hexagrams may thus be treated as six-digit binary numbers.  Each line represents one digit, or bit; typically, yin = 0 and yang = 1.  The digits of binary, or base 2, numbers are ascending powers of 2.  The first digit is 1, followed by 2, 4, 8, 16, and 32.  (In binary notation, these numbers are 1, 10, 100, 1000, 10000, and 100000.)  So the numbers 0 through 7, in binary, are:


We have no arrangement of the hexagrams from antiquity that suggests a particular binary sequence.  Shao Yong, a Song Dynasty scholar, arranged the hexagrams in what we now recognize as a binary pattern, changing the lines from the top down.  (He actually made two such arrangements, a square one, and a circular one in which the values are reflected across the diameter, as well as the similar Earlier Heaven arrangement of the trigrams.)


However, there is no evidence that Shao Yong or his contemporaries conceived of or used this arrangement as a number system.  (Gottfried Leibniz would do this some 600 years later.)

Reading the trigrams and hexagrams by changing the lines from the top down to form binary numbers is a common convention, both in print and on the internet.  But one may argue that, when treating the hexagram lines as actual numbers, and not merely diagrams or lists of line types, changing them from the bottom up is more consistent with the structure of a hexagram.  For example, Larry Schoenholtz in New Directions in the I Ching describes Shao Yong’s arrangement as “a perfect mirror image of the numbers one to sixty-four expressed in the binary system of numeration worked out by Leibniz . . . .”  See also IChingPaper.pdf by E. A. Harper at; the I Ching Sequencer, in which the line changes progress from bottom to top; and Yijing hexagram sequences by Steve Marshall.


What are the arguments for a bottom-to-top binary progression of hexagram lines?  I offer three:

1.  Hexagrams are built from bottom to top, and the binary numbers that they represent should be as well.

2.  Binary digits represent a progression of values, and the lines of a hexagram are considered to progress in significance from bottom to top.

3.  At least two other traditional sequences, the waxing and waning seasonal cycle and the eight palaces arrangement, also progress from bottom to top, suggesting that ascent is the natural direction of line change.

Hexagrams are built from bottom to top

Hexagram lines are chosen and read starting at the bottom, line 1.  Since antiquity, the lines have been identified by the descriptive numbers 6, 7, 8, and 9, for changing yin, yang, yin, and changing yang, respectively.  (This suggests to some a base 4 system, which I believe to be incorrect, as this would imply a total of 4096 separate hexagrams.  I prefer to think of the lines as binary, with a second bit added to indicate whether the line is changing or not.)

A hexagram may be described by listing its lines from bottom to top, such as 888887 and 788888 for the following two hexagrams, respectively:


So which of these hexagrams should have the value 000001?  By analogy with the descriptive lines, it looks like the first one should.  But note that we both write and build text from left to right:


And we write numbers from left to right, but build them from right to left:


Changing hexagram lines from the top down to form a binary sequence corresponds to the way the lines are written, but not the way the hexagrams are built.  And I believe that, for a number system, the way hexagrams are built takes precedence over the way the lines are written.

Hexagram lines progress in significance from bottom to top

Binary digits, as increasing powers of 2, represent a progression of numeric values.  When treating hexagram lines as binary digits, they are no longer simply a bottom-to-top writing system,


but a similar progression of values.  So, should the values progress from top to bottom, or bottom to top?


Hexagram lines are traditionally interpreted as ascending from lesser to greater, and are associated with positions in the cosmos such as earth, man, and heaven, or commoner, official, lord, minister, ruler, and sage.  I believe it to be more consistent for the binary line values ascend from lesser to greater as well.

Other ascending sequences

The waxing and waning seasonal cycle and the eight palaces arrangement are both sequences of hexagrams in which the lines are changed from bottom to top, at least for the first six of the eight members of the latter.  The seasonal cyle, below, begins at the winter solstice, and progresses monthly through the year:


As you can see, the cycle begins with ascending yang as winter turns to summer, then ends with ascending yin and the return of winter.  The analogy with ascending binary values is obvious.

Big-endian or little-endian?

Shao Yong ordered the hexagrams by changing the lines from the top down.  But hexagrams are built, and the significance of the lines increases, from bottom to top.  Shao Yong’s is in fact a binary sequence, perhaps one of the world’s first.  But, in my opinion, it is actually a mirror image of our binary number system, in which the values of the digits, like the numbers of the lines, progress from bottom to top.

These two ordering systems are analogous to two different computer memory conventions, called big-endian and little-endian after the Lilliputian political factions.  Big-endian systems are similar to the way we ordinarily write numbers, beginning with the byte that has the highest value.  Little-endian systems begin with the byte that has the lowest value, and have the advantage that the same value can be read at different bit lengths at the same memory address.

These ordering systems refer to bytes, not bits; but I shall extend the analogy to hexagram lines, which are actually bits.  In a six-bit little-endian bit ordering system, the number 1 would be represented as 100000.  To any who still object to a bottom-to-top ordering of the hexagrams because the digits should be written from bottom to top, I propose thinking of it as a little-endian system.

The anatomy of a hexagram

So how do we read a hexagram in binary?  Each line represents one digit; yin = 0 and yang = 1.  The first, or bottom, digit is 1, followed by 2, 4, 8, 16, and finally 32 at the top.  For example, to read the binary value of hexagram 49 directly, add the values of all the digits that are 1, or yang, which in this case are 1 + 4 + 8 + 16 = 29.

Hexagram 49, Revolution:

10000 16  
1000 8  
3 × 8 = 24
100 4  
1 1  
011101 29 decimal value = 29
octal value = 35

The trigrams, handy mnemonic devices that they are, provide a shortcut.  Note that the value of each of the lines in the upper trigram is 8 times the value of the corresponding line in the lower trigram.  It is not hard to learn to recognize the values of all eight trigrams by sight.  All one then has to do is multiply the value of the upper trigram by 8, and add the value of the lower trigram.  So for hexagram 49, the value of the upper trigram, 3, is multiplied by 8 to give 24.  Adding the value of the lower trigram, 5, yields the hexagram’s value, 29.

Reading the trigram values directly actually turns the hexagrams into two-digit octal, or base 8, numbers, in this case 35 for Lake, 3, over Fire, 5.  One might argue that this is the most intiuitve way to number the hexagrams.