YiJing (I-Ching) Matrices

(By Pieng-Lam Kho)

Yijing, (I-Ching) the book of Changes, is a very famous and complex Chinese classic. Dating back thousands of years, the book is attributed to Fu Xi (Fu Hsi) , the legendary first emperor of China. Later it was reinvestigated by the scholarly King Wen whose son, King Wu founded the Zhou dynasty. He made modifications and set up interpretations. His other son, Duke of Zhou also contributed greatly by reinterpreting the line judgments of each hexagram. This is why this book is now more popularly known as Zhou Yi .

Yijing, together with five other books constituted the famous six classics of China. They are the Books of Odes (Songs), , Documents , Record of Rites , Music, , Changes, and the Spring-Autumn Annals. .

NOTE: There are many internal links in this main page. Although there is a "return" icon at the bottom of each linked page to bring you back, it is preferable to just click on the "back" arrow at the upper left corner of your browser. This way you are sure to get back to where you left off. The return icon in each linked page will also bring you back, but to the very top of the main page.

Conventions used in this article:

SymbolsAssigned as
Broken line0 (binary)
Solid line1 (binary)

Converting trigrams and hexagrams to binary numbers means replacing the corresponding lines with 0 and 1 respectively.

Trigrams and hexagrams are supposed to read from bottom line up, if arranged in circular form, from inside out.
To convert to decimal values, we shall read instead from the top downward; or better still turn the hexagram 90 degree clockwise, change the lines to 0 and 1 accordingly, then convert the binary symbols to decimals.

Complementary trigrams shall mean two trigrams whose decimal sum is 7.
Complementary hexagrams are the two hexagrams that add up to 63 in decimal value.


Fu Xi was the emperor credited for bringing the Chinese nation from the hunting and fishing age to the agricultural age. He was a man of great wisdom. By observing and surveying the changes that take place in nature, he came out with causes and effects the nature manifests. Exploring these observations, he laid down what is now known as trigrams and hexagrams used in divination. Writing did not exist yet, so this knowledge was orally handed down until a few thousand years later when King Wen revised and reinterpreted the Yijing.

Leibnitz, who with Newton separately developed Calculus, was researching for the binary system when he received a copy of Yijing sent to him by a Jesuit priest. He immediately recognized that the Yijing symbols of solid and broken bars are isomorphic to the 1 and 0 digits of binary system, and greatly surprised that a binary system was already used by Fu Xi thousands of years before him.

The purpose of this article is to correlate the different arrangements of the sixty four hexagrams , which are generated by the eight trigrams. The trigrams come from four Xiangs [greater yin, lesser yang, lesser yin, greater yang] which in turn are derived from two Yees [yin, yang]. The two Yees are originated from Taiji, the ultimate extreme. We want to see how the hexagram tables are set up by their 'Gua' (kua) orders, their trigram-pairings as well as their decimal equivalence.

We shall take the broken Yin line as 0, and the solid Yang line as 1, although one can interpret oppositely as well. We will limit ourselves to the different formations of the hexagram tables plus some interesting features in mathematical sense.

Suppose we set up the numbers 0, 8, 16...... to 56 in a row. We then prepare a square with row headings from 0, 1, 2..to 7 and do likewise along the left column downward. We shall then add the number at the left to the numbers in the key row to produce the rows of the table, resulting in: Table 1.

We have thus produced a hexagram table with cells containing the decimal equivalence of the "Gua's". Here the lower right cell, 63, is the first Gua, Qian (Chien) and the upper left cell, 0, is the second Gua, Kun. How do we know it ? Well, if you convert these numbers to binaries, the lower right is 111111, and the upper left is 000000, which in hexagrams are the six solid and broken lines respectively. One feature we observe is that this table is symmetric with respect to the intersection of the two diagonals (in the hexagram sense); that is, the two hexagrams reflected about the diagonals are complementary. We define a pair of complementary hexagrams as the two that add up to a decimal sum of 63.

Convert the table in terms of 'Gua' (some called it Textual) order, we get  Table 2 . Except for the complementation property, this table is not very interesting. Besides, it is not the one one set up by Fu Xi or King Wen.

If we assign the six broken Yin bars (Kun) as 0, and replace the top bar with the solid Yang bar, we shall get a hexagram with a value of 1 (both binary & decimal). By adding (binarily) 1 to each new hexagram and read its decimal equivalent (from top downward), we will be able to build up all the sixty four hexagrams, with the last one having all solid Yang bars (Qian) and a decimal value equal to 63.

Fu Xi

The Fu Xi hexagrams are actually arranged in this natural order starting with decimal 0 at top left corner, going right and downward to 63. (Converting to decimal from top to the bottom. The correct hexagram should always be read from bottom to top).

Fu Xi's Hexagram Table

The Fu Xi's hexagram table in decimal values is shown in: Table 3.

If we replace the matrix with the (King Wen's) Gua order numbers, it would look like Table 3a.

There is a very interesting correlation between Fu Xi's hexagram arrangement and D N A presented at the end of this article.
For those who wants to preview now, try this D N A link.

The hexagrams are of course generated by combining two sets of trigrams in all possible ways. And the Fu Xi trigrams are arranged in a natural (symmetric) order like this:

Note that the opposite trigrams are complementary (i.e. decimal values all added up to 7).

Legend has it that a map called river map came from a design drawn on the back of a dragon-horse at Yellow River inspiring Fu Xi to arrange the trigrams. Another design called Luo Shu was found on the shell of a tortoise at Luo River. This design looked like the 3rd order magic square. The reconstructed river map looks like this.

River Map

Note that there are white circles and black spots arranged into a rectangular form numbering from one to ten. The white circle group is made up of odd (yang) numbers while the black spots are all even (yin). The perimeter numbers are 6,7,8 and 9. These are significant as we shall see later.

Fu Xi replaced the white circle with a solid line, and the black spot with a broken line. These two are called the two yees .Take two of each and permute to make the four duograms, with an old yang (two solid bar one on top the other), an old yin (two broken bars), a young yang (solid on top of broken bar) and young yin (broken on top of solid bar). This is what is known as four xiangs (images), representing the four seasons.

Yang is associated with heaven, and yin with the earth. To include the man, he added one bar, used a combination of three bars (heaven, man, earth). With permutation of three out of the two symbols, he produced the trigrams which is known now as ba gua.

Martin Gardner mentioned in his January 1974 Scientific American article that Mr. Z.D. Sung in his book on Yijing (1934) related how he found out a natural way of generating the eight trigrams using cartesian coordinates of a unit cube. The cube is repeated here with a little change, namely; 0 for broken line and 1 for solid line. Here we use the right-handed coordinate system, and read each trigram of the corners from top to bottom, The eight sets of coordinates correspond to the eight trigrams, are complementary to the opposite cornered trigram of the cube.

If we convert Fu Xi's hexagram table in the trigram-pair equivalence (0,1,2...,7), table 3 will become  table 4.

Sung also set up a polynomial representation of the hexagrams.

A set of rythmic lines (in Chinese) helps people associate the names of the trigrams and their symbols:

Translated literally: Qian(Chien): three links, Kun: breaks to six, Zhen(Chen): open cup, Kan(Ken): inverted bowl.
Gen(Kan): solid center, Li: broken mid-line, Dui(Tui): incomplete top, Xun(Sun): broken base.

King Wen

The King Wen hexagram is arranged in a different way,

King Wen's Hexagram Table

Starting with the upper right corner of Qian (6 solid bars), the rows are read from right to left. Each odd-numbered hexagram is followed by a hexagram that is its inverse (inverted) or its complement (Yin Yang interchanged) when the hexagram is two-fold symmetric. Thus, the 6 broken bars (Kun) come after the Qian.

[This table is taken from a reference book, please note that hexagram 41 is not
printed right, it should be the inverse of hexagram 42.]

Using decimal values, the King Wen's hexagram table has the format of Table 5

*(There are many interesting features inbedded in this table, we shall bring them up later.)

Converting into trigram-pairs, table 5 now becomes Table 6

Why do we put the header numbers 1 to 8 from the right ? The next table Table 7 in which the King Wen's Gua numbers are substituted will show the clue. They are actually arranged in the Gua order.

It is indeed a very orderly sequenced table.

[Note that FuXi's hexagram table is arranged in decimal-value order
while King Wen's hexagram table is arranged in Gua (some called it Textual) order.]

Why are King Wen's hexagrams sequenced in this way ? The Appendix on Orderly Sequence of Hexagrams' is worth reading. Since I could not locate a link that gives this appendix, I am reproducing the part that appeared in J.N. Wu's book. [Both pinyin and Wade-Giles ways of writing are shown. Some Chinese characters are included to avoid misunderstanding.] Here is the Hexagram sequence.

King Wen was imprisoned by the tyrant king (named Zhou) of the Shang dynasty. While in prison he studied Yijing very conscientiously and wrote the commentaries of the hexagrams. His son, the Duke of Zhou is credited for writing down the judgments of each line (384 in all) of the hexagrams that appeared in the appendix of the book.

A very interesting research by S.J. Marshall about the conquest of Shang
under King (Zhou Xin) by King Wu is worth reading.

Mawangdui's recent excavation

From the recently excavated material at Mawangdui site near Changsha, Hunan, the hexagram table in decimal values looks like that in Table 8, and its table of Gua's is shown in Table 9

When we replace the cells with trigram-pairs, Table 10 is what we see. Except for the hexagrams at the first column; which are made up of 'double' trigrams* with the Yang (male) group comes before the Yin (female) group, we are unable to show any simple ordered arrangement.
But on closer look, it does have some interesting feature. See the  Link  in another page.

* These are the hexagrams made up of two identical trigrams. they have the same names as the trigrams.

We will now coast through a site by Rick le Mon which gives a brief discussion of what the eight trigrams designate.

King Wen's trigram arrangement is different from Fu Xi. It is not symmetric.

King Wen's Trigram Chart

Look at the dotted line which separates the trigrams into two groups, One (male) group is made up of Qian, the father with Zhen, eldest son, Kan, the second son, Gen, the youngest son. The other (female) group is Kun, the mother, with Xun ,the eldest daughter, Li, the second daughter, and Dui, the youngest daughter.

Another hexagram table, also attributed to King Wen appears below: Table 11
They are arranged (trigram-wise) in such a way that the Yang group (Father, 1st son, middle son and last son) come first. The Yin group (Mother, 1st daughter, middle daughter and last daughter) follows. There is also a very nice pattern found in this arrangement. The complementary hexagram can be located easily by going 4 steps along the diagonal directions.(e.g. Gua 1 to Gua 2)
It will be much more obvious if we convert the elements into the decimal values as in Table 12, keeping in mind that we are looking for a cell whose number when added to the number of the current cell is 63.

The pattern set up by Fu Xi is called xian tian (earlier heaven) , while the one set up by King Wen is called hou tian (later heaven) . It will be better understood if xian tian and hou tian are translated as 'prenatal' and 'postnatal'. A xian tian circular hexagram arrangement is worth noting. The diagram is shown here.

Hexagram circular diagram

Here the upward direction is south, not north as the convention used in maps. South is where Qian is and north is Kun. If we replace each hexagram with its decimal equivalence, converting from the edge going inward, and go counter clockwise, we shall see that the numbers will be 1 to the right of Kun, and increase by 1 as we go up. This gives a very easy and orderly way of drawing up this circular hexagram ring. When we fill up to number 31 beside Qian Gua (63), take the complement of the opposite pole number, the next one after qian should be 62. (as it is directly opposite 1) This time deduct 1 as we go down. Now we can easily fill up the whole ring using this complementation rule. However, the correct way of reading the hexagram lines should be from inside out.

I converted this circular diagram to a diamond form for a clearer view.

Yijing was used in the early years to foretell what may happen in the future. The rulers and kings wanted to know, e.g., in a battle, when to attack the enemy or not at all. To do this, they went into a ritual sometimes with sacrifices, to draw up a hexagram, line by line (from bottom up). This process will take quite sometime to accomplish. After the hexagram is drawn, they would go to the commentary and judgment portion of the book to get the interpretations. One has to impart his own interpretation to come to a decision for the commentaries are usually not very clear cut.

Methods of Divination

There are three methods {#} of doing the divination. One is to burn the tortoise shell and look at the cracks thus produced. This method had already been lost and no one knows how to do it.

{#} With many variations, see E. Hacker.

The second one is the use of yarrow stalks. Yarrow is a kind of milfoil plant. To get a hexagram this way, one needs fifty (50) yarrow stalks, (For detailed discussion, please refer to any Yijing book). Set one stalk aside unused, divide the remaining forty-nine at random into two heaps. Again setting aside one stalk from the right hand heap, put it between the little and ring fingers of the left hand. Now remove the stalks of the left hand heap, four at a time, until only 1,2,3,or 4 are left. Do the same to the right hand heap. The stalks that remained after casting out by four are put between the ring and middle fingers and between the middle and index fingers respectively. Adding the number of these stalks and convert into a number which is either 2 or 3.
Collect the cast away (remainding) stalks, and repeat the process. (i.e. divide into two groups at random, and start again, by setting aside one stalk from the right heap and none from the left heap). Again add the remaining stalks and convert it into 2 or 3.
Repeat this process one more time, and get another 2 or 3 number. Add the three converted numbers. One would get a 6, 7, 8 or 9.

The remaining stalks after the first step( with 49) will be 44 or 40. After the next process it will become either 40, 36 or 32 and after one one more step, becomes either 36, 32, 28 or 24; which are all divisible by 4 and can be reduced to 9, 8, 7, or 6 the Xiang numbers.

If you get a 9, you have an old yang, and you would draw a solid line. A 6 will give you an old yin, a broken line. 8 gives you a young yin, 7 gives you a young yang. You would draw a broken line or solid line respectively. But the lines obtained which are called 'old' and 'young' are different. The olds are called the moving or changing lines. They will be changed to their opposites after the six-line (yes, you must repeat the above process SIX times) hexagram is completed. While the 7 and 8 are called the stable lines, they are not changed.
You will use the hexagram to consult the commentaries. If there are changed lines, read the text of those changing lines, consult only the judgment of the changed hexagram not the lines. (Some books say consult the text of both hexagrams.) Otherwise read the commentary of the original hexagram. [Please refer to the rules set up by the Nanjing study group]
This process needs a good deal of time and concentration to perform.

I have prepared a short spreadsheet program to simulate this process and to check the results. We need to consider 64 different cases by varying the left hand bundles with numbers 1,2,3 and 4,** in each of the three tosses. This results in: 4 sixes, 20 sevens, 28 eights and 12 nines. Reducing to simpler terms, give 1 chance out of 16 for Six against 3 out of 16 for Nine. (See table below for probabilities)

** It does not matter how many stalks are on the left hand side,
when we cast away 4 at a time, the final results will always be the same.

Because the probability of getting a 9 (which is good) is slightly higher than the probability of getting a 6 (not so good), we see that Nature is on the favorable side using this yarrow method. (Some interpreted that this is why the universe goes on.)

The third is the coin throwing method which is quite easy. In this method one would use three coins, assign tail as yang (worth 3) and head as yin (worth 2) [or vice versa] . Flip the three coins. If they landed with all tails, you get a 9 which is old (moving) yang, 6 is old (moving) yin , 8 young yin and 7 young yang. Draw the respective line from bottom to top. You will get your hexagram you asked for. Again change the moving lines (if needed) before consulting the commentaries and jugdments. This method is very much faster, good for the professional fortune tellers, because the turnover will be faster and the income greater.

Based on the Nanjing Group's criterion, I also devised a spreadsheet where one enters the number of heads/tails in each toss from bottom upward. The result will tell him how to get the answer. [Here we assume that the Nanjing Group's interpretation is right.]

The probabilities of 6 and 9 in the coin method is of course even. See the following table for the odds of the two methods:

NumberYarrow stalkCoin
61 in 162 in 16
93 in 162 in 16
75 in 166 in 16
87 in 166 in 16


The line statements of the hexagrams sometimes give a guide that reflects the climate of the year, quite important for an agricultural society. For example, the first two hexagrams Qian and Kun in a way hinted at the seasonal farming activities (planting, harvesting etc...) based on the position of the stars that made up the "dragon" (not the western 'draco') constellation. Shaughnessy gave an interpretation of the line statements of these hexagrams that follow the movements of these stars.
This Japanese site also shows the azure (blue) dragon constellation and the names of their parts.

Some interesting features

The hexagram table arrangement of King Wen (also known as Received Order) has many interesting features, if we recall Table 5, we can see many number-related results. I. Olsvanger and E. Hacker did some research on the symmetries of this arrangement. They found out that there are many possible ways in which one can draw a continuous line and cut the decimal-value table into two equal parts whose sums are also equal.* (The sum is 1008)

* See R. Rutt

To produce these partitioned tables, print out few copies of table 5. Get a pencil and do the following: Start from the cell under number 32, draw a cutting line similar to any of the diagrams* below. Get a calculator, add up the numbers on each partition and compare. Have fun !

Olsvanger 1Hacker 1
Olsvanger 2Hacker 2
Olsvanger 3Hacker 3

* I believe a diagram is better than a monotonous directional paragraph

There are other symmetries found in this Received order. Cut out some blocks as shown in the following diagrams. We can observe that the sums of these symmetric blocks are equal pairwise (number inside the block is the sum).Try also to look for some pairs of complementing neighboring cells that are located along the main diagonal.

Symmetric Block 1Symmetric Block 2

Another interesting point is shown in Table 5b.

Nuclear Hexagram

Nuclear trigrams influence the meaning of the individual lines. The specific influence will be determined by the nature of the nuclear trigram itself.
The hexagram composed of two trigrams one of which is a nuclear trigram is called a nuclear hexagram, there are several of them. One particular one made up of the lower and upper nuclear trigrams is called the Inner Hexagram, also called the Primary Nuclear Hexagram (lines 2,3,4,3,4,5). If we pick any of the 64 hexagrams and repeatedly transform* it into its Inner Hexagram, we would arrive at any of these four hexagrams: #1,#2 #63 or #64. Try it !

* Diana ffarington Hook found this interesting result.


Mathematically speaking, this means the limit of the 'Innerization' process of any hexagram approaches one of the hexagrams #1, #2, #63 or #64.

Hexagram #1 is Qian (Creation), #2 is Kun (Reception) #63 is Ji Ji (Perfection or Fulfillment) and #64 is Wei Ji (Transition or Unfulfillment). This means every hexagram is linked to either one of these four.
[Note that hexagrams 63 and 64 will ocillate from one to the other by this process.]

Yang Hui , a mathematician of Song Dynasty, produced an eight order* magic square using the numbers 1 to 64. Since there are 64 hexagrams, we can take this as an arrangement of Gua-order. It is interesting to note that the first two and the last two hexagrams all crowded into the first four spaces at the top right corner, and these four are where all the hexagrams will converge into when nuclear hexagrams are taken and they are the beginning and end of Gua arrangement.

* Even-order magic squares are relatively harder to set up than the odd-order ones

Yijing and D N A

We shall now discuss the very interesting topic
on the analogy between Yijing and D N A .

Some Links

One can surf through the web and find invaluable information about Yijing. Here are some interesting sites you can look for:

For the Chinese names of all the hexagrams, try Chinese names from the site China the Beautiful site.
A site by Mr.Rick le Mon gives a hexagram matrix (same as table 11) with all the commentaries of each 'Gua' accessible with a CLICK ! Try this Matrix for commentaries.
Another site for commentaries by ddiamond with table arranged in descending binary (decimal) order is also good.
For detailed explanation of each hexagram, try here.
Princeton also has a site about Yijing.

Richard Wilhelm's 1923 German translation of Yijing is rated as the best among the many translations. Here is an introduction of his life in China.

The following are some sample links of Yijing in different languages, if your browser is able to read them:
(The two Chinese links require Big-5 font.)
Chinese1 Chinese2
Spanish French
Italian German Japanese

This article is prepared for the fun of playing the number-arrangement with Yijing tables. Comments and suggestions are welcome.
For reference books in English, please see Reference

Last Updated: June, 2004.
Please e-mail any comments and suggestions to
Pieng-Lam Kho at: