The I Ching, random numbers, and why you are doing it wrong

One would think that humanity would not have a need for good random number generators until computers and simulations were invented since, for most practical purposes, tossing a coin or throwing a die should suffice us all. So you can imagine my surprise when I saw in this four to five thousand years old Chinese divination book called I Ching a RNG algorithm that reminds modern Linear Congruential Generators! But why the need for such a complex procedure to render random numbers?

artemisia
         Artemisia Stems

The I Ching divination process requires to randomly select two trigrams via a rather convoluted process using either stems of Artemisia or Yarrow. And although I acquired this ancestral book a long, long, time ago, truth is that when reading it as an oracle I always used the simplified version for lazy busy people consisting in simply tossing three coins and checking the combination of heads and tails.

I always thought that the traditional form was just a magical way to do the same thing that we can do by tossing three coins, but today, for no particular reason that having too much free time in my hands, I gave a deeper mathematical look to this traditional form and it turns out that it renders a complete different random result that tossing three coins!

Well, a mathematical curiosity you might think, but does it matter? It might! Millions of people seek advice using the simplified coin version to render the I Ching Yin Yang oracles. In this post I will show how the three coins method yields an equal proportion on Old Yin and Old Yang oracles signs whereas the traditional method yields three times more Old Yang signs than Old Yin!

This means that The I Ching, in its traditional form to draw oracles, promotes Yang behaviour over Yin, that is, it promotes among its users action, imagination, creativity, strength whereas, nowadays, with the simplified three coin version, the active and passive answers are even out.

I am not a sinologist nor a psychologist so I cannot really tell what version would have a better influence among practitioners lives, but I know though that the traditional form promotes Yang among those seeking advice which, at first glance, seems like a positive thing to do and, since this book is used by millions of people, maybe experts in the field should advice to practitioners not to use three coins anymore when using the I Ching. For those interested in having a traditionally sound oracle in terms of probability, I will show a few simple ways to achieve just that at the end of this post.

This book has impressed mathematicians like Leibniz, psychologists like Jung, poets like Jorge Luis Borges and all kind of intellectuals all over the world for centuries. And regardless you believe or not whether it has magical properties, what is certain is that it has deep psychological sapiential ones. This is not only the oldest book in human history, but a beautiful one. So, before we plunge into the mathematical details of the traditional algorithm to draw oracles, let’s share this poem from Borges about the I Ching to break the ice.

For a Version of I Ching Para una versión del I King
The future is as immutable
As rigid yesterday. There is nothing
That is no more than a single, silent letter
In the eternal and inscrutable
Writing whose book is time. He who walks away
From home has already come back.
Our life Is a future and well-traveled track.
Nothing dismisses us. Nothing leaves us.
Do not give up. The prison is dark,
Its fabric is made of incessant iron,
But in some corner of your cell
You might discover a mistake, a cleft.
The path is fatal as an arrow
But God is in the rifts, waiting.

El porvenir es tan irrevocable
Como el rígido ayer. No hay una cosa
Que no sea una letra silenciosa
De la eterna escritura indescrifrable
Cuyo libro es el tiempo. Quien se aleja
De su casa ya ha vuelto. Nuestra vida
Es la senda futura y recorrida.
Nada nos dice adiós. Nada nos deja.
No te rindas. La ergástula es oscura,
La firme trama es de incesante hierro,
Pero en algún recodo de tu encierro
Puede haber un descuido, una hendidura,
El camino es fatal como la flecha
Pero en las grietas está Dios, que acecha.

Artemisia / Yarrow vs Three Coins

We will now compare the results from the traditional Artemisia / Yarrow method to obtain the two I Ching oracle trigrams as explain by Richard Wilhelm in his The I Ching: The book of changes with those from the simplified coin version described in the same book.

The Three Coins

For the coin version we toss three coins six times and we build an hexagram from bottom up with the following correspondence and probabilities:

  • Three heads:  Old Yang       (9)    (Pr = 2/16)
  • Two head:       Young Yang  (8)    (Pr = 6/16)
  • Two tails:        Young Yin      (7)    (Pr = 6/16)
  • Three tails:     Old Yin           (6)    (Pr = 2/16)

Every hexagram has a meaning and if it contains Old Yang or Old Yin lines which meaning is extended by the I Ching with further advises. In this case, the Old Yin / Yang extension is done evenly with the same probability (2/16) when using three coins.

The Artemisia / Yarrow

This ancient method consists in dividing three times into two groups a set of 50 stems of Artemisia or Yarrow. At each division a calculation is done, a number of stems are left out and the process is repeated. For a complete human language explanation  of the process I highly recommend you Mr. Richard Wilhelm translation of the I Ching, but next you can see this process in the more precise and concise R language.

The previous R function returns six Yin Yang elements coded from 6 to 9 following the traditional method to obtain I Ching hexagrams as explained by Richard Wilhelm.

Seems clear to me that the intention in this procedure is to randomly choose at each step a number from 1 to 4 by applying a modular arithmetic process at each division, but the algorithm does not exactly calculates that since, when expanding all possible solutions, there is a tiny bias towards 4(3) results. So if we ignore this tiny bias the probability tree the algorithm generates for each Yin Yang code sign follows:

probability treeThe final probabilities in this tree imply the following Yin Yang sign probability distribution

ichingSo if we now compare the Artemisia / Yarrow Yin Yang probabilities with those rendered by tossing three coins we have:

  •                                             Old Yin    Young Yang    Young Yin   Old Yang
  • Artemisia / Yarrow:           1/16          5/16                   7/16              3/16
  • Three Coins:                          2/16          6/16                   6/16              2/16

So both methods return equal probabilities for each hexagram since we have a 50/50 chance to have a Yin or a Yang sign, but we don’t have the same probabilities for their interpretations.

The traditional method clearly favors Yang interpretations of the hexagrams which makes the coin procedure a bad alternative for an accurate reading of the I Ching as intended by they ancient Chinese who developed the method and, if we consider how this book is being use all over the world, it might not be a bad idea to stop using the three coins procedure in favor of the traditional one since the later promotes more positive and active interpretations of the hexagrams.

Questions

Now, I wondered a number of questions about why this procedure is the way it is, so unless some sinologist in the room says otherwise I am going to make some “common sense” assumptions.

Why the use of stems instead wood sticks?

The use of stems instead straight wood sticks might be due to avoid getting a feeling of the sticks and getting always a desired result (similar to what might happen with a deck of cards). the gnarled stems with its different widths help to prevent such bias and increase the randomness of the process.

Why 50 stems of Artemisia / Yarrow?

why 50 stems when the first step is to discard one? Well it could be magical reasons but it could also be an algorithmic left over reason since, at each of the three divisions, one stem is discarded.

Why Those uneven probabilities?

I would say it has to do with numerology, the proportions for Yin and Yang signs yield by the algorithm are represented by the first four prime numbers, that is, 1, 3, 5 and 7. Ancient Chinese might have seen that 1+7 = 5+3 and associate this mathematical property with the Yin and Yang equilibrium in the universe. Once this is set the probabilities for the Old Yang and Old Yin are also set and they decided for a higher degree of action among those using the I Ching.

Why 3 COINS as alternative?

Obviously the Artemisia / Yarrow process is overly complicated, but I don’t know why the alternative chosen to simplify the process were the three coins version since they clearly change the I Ching oracles. Did those developing the alternative knew what they were doing? Was is just a way for lay people to use the book without much hassle and they did not care? Any sinologist comment is more than welcome!

Alternatives to Artemisia / Yarrow than render traditional Hexagrams

Anyhow, now I will explain a few alternatives that return proper traditional sign probability hexagrams, let’s begin with my favorite one

The one coin + one 8 sided die

die8

This is my favorite alternative both, for its simplicity and its beauty.

For this alternative we simply need to first toss a coin; if we have tails (0) that means Yin, if we have heads (1) that means Yang.

Then we throw the 8 sided die to determine if the Yin or Yang sign is old or young. If we do so we have the following 16 possible outcomes:

0,1 – Old Yin
0,2 – Yin
0,3 – Yin
0,4 – Yin
0,5 – Yin
0,6 – Yin
0,7 – Yin
0,8 – Yin
1,1 – Yang
1,2 – Yang
1,3 – Yang
1,4 – Yang
1,5 – Yang
1,6 – Old Yang
1,7 – Old Yang
1,8 – Old Yang

Now we simply have to throw the die six times, build the hexagram from bottom up and that’s it, enjoy your traditional I Ching oracle hexagram!

The four coins

Okay, let’s say we don’t want to buy a die and we only have coins. Then we can still use coins to render properly traditional probability sound hexagrams. For this alternative we need to toss four coins all at once and read from left to right being heads (1) and tails (0), we have 16 possible outcomes:

0000 – Old Yin
0001 – Yin
0010 – Yin
0011 – Yin
0100 – Yin
0101 – Yin
0110 – Yin
0111 – Yin
1000 – Yang
1001 – Yang
1010 – Yang
1011 – Yang
1100 – Yang
1101 – Old Yang
1110 – Old Yang
1111 – Old Yang

As an alternative, instead reading from left to right we can also have 4 different coins and assign each a position from 1 to 4. We could also toss four times one coin for each sign but that would make a grand total of 24 tosses per hexagram which, if you ask me, is a bit of a mood killer, but the choices are out there if we need them.

The one 16 sided die

Octagonal_bipyramid

One simple way to do so would be to use a 16 side die and then associate its side numbers as follow.

  • 1          : Old Yin
  • 2 – 6     : Yang
  • 7 – 13   : Yin
  • 14 – 16 : Old Yang

Another perhaps more aesthetically pleasant distribution of numbers would be to place all the Yin possibilities (1 + 7) at the top of the bi-pyramid and all the Yang (5 + 3) a the bottom.

The two four sided die

die4

If you happen to have two four sided dies then the procedure is similar to the 4 coins alternative; for the two dice we simply throw the two 4 sided dice and we read the outcomes from left to right. And just like in the case with the coins we could also have two different dice and assign each a position so we don’t have to worry about the order. These are the 16 possible outcomes:

1,1 – Old Yin
1,2 – Yin
1,3 – Yin
1,4 – Yin
2,1 – Yin
2,2 – Yin
2,3 – Yin
2,4 – Yin
3,1 – Yang
3,2 – Yang
3,3 – Yang
3,4 – Yang
4,1 – Yang
4,2 – Old Yang
4,3 – Old Yang
4,4 – Old Yang

Looking for dices I found an amazing web page where we can buy dices, coins and many other beautiful designs thanks to the magic of 3D printers. Just for you to know.

Anyhow, happy traditional choice!

30 thoughts on “The I Ching, random numbers, and why you are doing it wrong

  1. Wow fascinating exhaustive article, bookmarked for future reference. I have used the I Ching several times in the past and even have a (don’t laugh) I Ching app on my iphone!

  2. A worth-reading post. I never thought of the probability associated with each “yao” or “yiao.” (http://www.nationsonline.org/oneworld/Chinese_Customs/bagua.htm)!

    I am not sure what the Artemisia method is. However, I’ve derived a different probability distribution for the yarrow method described here – http://www.eheart.com/yarrow/use.html. The probability of getting 4 or 8 on the second and third “changes” is not 1/2. I might be wrong. I need to double check my reasoning later.

    • The Yarrow method uses Achillea millefolium, Richard Wilhelm translation mentions Achillea and Artemisia, so basically it is the same traditional method using different stems. Maye I should update the post with both kind of stems, thanks for mentioning.

      The link at eheart basically describes the same method found in Richard Wilhelm translation, they also realized that the probability of getting a changing yin line (Old Yin in Whilhem translation) is smaller but they don’t go further.

      About you having different probabilities, in the post I mentionted.

      Seems clear to me that the intention in this procedure is to randomly choose at each step a number from 1 to 4 by applying a modular arithmetic process at each division, but the algorithm does not exactly calculates that since, when expanding all possible solutions, there is a tiny bias towards 4(3) results. So if we ignore this tiny bias the probability tree the algorithm generates for each Yin Yang code sign follows

      So it is not exactly 1/2, maybe this is why you have different results? but if you think about the procedure I would say it is quite obvious that 1/2 was the intention, in fact, if the number of stems grows to infinity the bias disappears and the probability converges to 1/2.

      I did not calculate it but perhaps there is a larger number of stems that would remove the tiny bias without going to infinity? In any case ancient Chinese probably considered practical issues and thought that 50 stems was a good enough approximation.

      Thanks for your comment JH🙂

  3. After the first “change,” there will be 40 or 44 sticks left. Removing one stick from one of the piles, there are, e.g., 39 left altogether. The possible remainder combinations are (1,2), (2,1), (3, 4) and (4,3). I made a mistake thin inking the third possibility as (3, 0), temporarily forgetting that four sticks are set aside when the remainder is zero in this case.

    Anyway, yes, if we write out all possible ways of dividing the sticks, the probabilities are not exactly 3/4-1/4 and 1/2-1/2.

    Thanks for your reply.

  4. The link to Leibniz takes one to Jung. Minor error. Enjoyed your post.

    “This book has impressed mathematicians like Leibniz, psychologist like Jung, poets like Jorge Luis Borges and all kind of intellectuals all over the world for centuries. And regardless you believe or not whether it has magical properties, what is certain is that it has deep psychological sapiential ones. This is not only the oldest book in human history, but a beautiful one.”

  5. I use a simple method to maintain the probabilities.

    I have 16 marbles 1 Red (Old Yin) 3 Yellow (Old Yang) 5 Green (Yang) and 7 Blue (Yin)

    Pick them one at a time and return to dish and pick the next etc etc. for the 6 lines.

    You can of course vary the colours provided you keep to the ratios.

  6. Hi,
    I run http://www.iching.pl website based on 3 coin method algoritm. It’s been 9 years and I have collected over 3.000.000 questions and answers in form of 678967. Your article surprised me and I’d like to change my algoritm to yarrow to see how the results will change … thanks for inspiration!!!
    Cheers
    Wojtek

  7. Another reference i came up recently since this is part of some studies i do as well, by physicist-biologist S. Petoukhov, which relates the DNA bases and biological symbolic alphabet to the trigrams and hexagrams of the I Ching, and the dualities of Yin/Yang. Quite interesting, and not only for random generation!

    GENETIC CODE AND THE ANCIENT CHINESE BOOK OF CHANGES
    Sergei V. Petoukhov (1999) (http://jean-yves.boulay.pagesperso-orange.fr/rap/eng/pagepetoukhov.html)

    https://urbanshakedowns.files.wordpress.com/2011/01/pethoukhov.pdf

    Specificaly i quote:

    […]The modern science does not know why the alphabet of genetic language has four
    letters (it could have any other number of the letters in principle)…

    […]The starting point of the original research, stated in the article, was the following. The
    author paid attention to the fact that these four nitrogenous bases represent specific
    poly-nuclear constructions with the special biochemical properties. The set of these four
    constructions is not completely heterogeneous, and it has on itself a substantial system
    of attributes for uniting and distinguishing of its letters (or, more precisely, the set has
    pairs of “attribute – anti-attribute”).

  8. Thanks for the interesting article. A couple of things I would like to add:

    1) We don’t know for sure what exact yarrow stalk method was used by divination officials in late Shang and Early Zhou times. It is quite possible it was much different then the 12th century Zhu Xi explanation which is official today (please see more about that here: http://www.biroco.com/yijing/prob.htm).

    2) It is very likely coin method has been in use much longer and has been used much more frequently than the yarrow stalk method.

    3) But the most important question is: does it really matter? I think it does not really matter too much because even though we call it a random selection of the lines/hexagrams the basic idea is that cast hexagram IS NOT RANDOM because it must give meaningful answer to the question asked. Otherwise we would accept basic premise that any given hexagram and any given moving line would equally well “answer” the question. Which I do not believe is true.

    4) Probability in favour of more yang lines would not imply inherent logic of Yi Jing oracle is towards action. it just means that one would (on average, when used in the context of large numbers) get more yang moving lines which in turn may mean anything.

    5) If you toss a coin 5 million times on average you will get 2.5 million heads and 2.5 million tails however if you flip the coin only one time this coin will act as if no coin was ever flipped before and no coin will be flipped after. In my opinion traditional statistical probabilities make sense only in the context of large numbers. As we know we do not cast Yi Jing hexagrams 5 million times for one question therefore all those probabilities have very relative meaning.

    Cheers!

    • Thank you very much for your points, they are really interesting! Let me comment them briefly here:

      1) Even if we don’t know the original method at least we know that the scholars in the Zhou dynasty decided to hold the yarrow stalk method as official.

      2) According to the author of the link you posted “Although yarrow divination is mentioned in the Zuozhuan, a chronicle of the period 722–468 BCE, the actual procedure is not described in that text.” also “Tradition holds that Wang Xu, a Daoist recluse, invented the coin tossing method in the 4th century BCE.”

      So we have a chronicle vs a tradition holds, you can make your source choice. What I can believe and I would agree with you is that the average person would not want to use the yarrow stalk for being overly complicated and that they would use the simplest tossing coin procedure.

      3) I will disagree on this point with you. It is random, if it wasn’t you would always get the same anagram for the same question which is not the case, or opposite answers for opposite questions which is not the case either. What is not random is our interpretation.

      4) Well, again, the Zhou scholars decided that the yarrow stalk procedure was a sound logic for the Oracle, I am not a scholar myself so I can’t really tell otherwise. Also, if the practitioner associates Yang with action and Yin with caution, which I would say is a reasonable association, then yes, having a larger proportion of moving Yang means something in my opinion.

      5) The inference process that goes from the general to the particular is called deduction, and this is precisely the inference process Probability Theory is good for. Tossing a coin is one of this particular cases.

      Thanks again Zhouoracle!

  9. We use two coins:
    We throw first and then the other coin out system:

    HH Yin (old)
    HT Yin
    TH Yang
    TT Yang (old)

    1/4 + 1/4 + 1/4 + 1/4 = 1
    Equally and fairly.

    • i think the whole point of the discussion here is whether these probabilities, faithfuly represent the sample space. Based on the analysis by Fran on the yarrow-stalk method vs 3-coins method (or 2-coins method), this would not be so. In other words, the sample space may indeed have more old yin or old yang items than new yin / new yang. This is the whole point, and in this sense the yarrow-stalk method would indeed faithfuly sample and represent the event space, than the other methods.

      One possible justification for that would be that since things change (after all this IS the book of changes), it would mean that under any circumstamces changing lines should appear more frequently than non-changing lines and so on. So I Ching places a (justified) emphasis on changing lines, more than non-changing lines (this coupled with the fact that we are talking about trigrams/hexagrams and so on)

      • Sorry, minor correction, the rationale of having more new yin / new yang than old yin / old yang, is related to being a faithful reperesentation of the underlying event space. A possible justification for this distribution has to do with the whole theory behind the I Ching and how changes happen and what they represent.

          • It may very well be 1/4 + 1/4 + 1/4 + 1/4. The I Ching has a theory behind it which relates trigrams, hexagrams and the like into a representation. Associated to this theory, which we do not know very well (inspite some “new-agers” claiming otherwise), is the method to sample the event space in order to generate hexagrams for a given situation.

            In this sense and given Fran’s analysis in this post, it is plausible the yarrow-stalk method (given the theory of the I Ching), indeed faithfuly represents and samples the event space. One may choose to sample the event space differently, it does not guarantee faithful sampling though (unbiased sampling if you like), unless one can justify it based on the (theory of the) I Ching itself. And since this theory is not exactly known, one can say that based on the I Ching and the documented yarrow-stalk method, this most probably matches the (largely unknown) theory of the I Ching itself on the event space and how to sample it correctly.

            Also note that ancient Chinese were very good number-theorists among other things (e.g the chinese remainder theorem), and probably knew enough methods of sampling. Using a method for a specific purpose, should have a meaning (assuming the yarrow-stalk method was indeed used as documented) This was my comment.

          • Additionaly have in mind that the I Ching, like other (sacred) books of the east, has in its writing and content, a codified multiplexed context. This in simple terms means that the same text can represent multiple (note, simultaneously compatible and valid) associations which unfold based on external data and stimuli. This extra data (or decipher code if you like, what i refered to as the theory behind the I Ching in the previous comment) are usualy provided on initiation, which further unlocks the whole meaning that has been codified (if this is the case of course) into the text.

  10. Hi Fran nikosms,
    thank you for your comments – all of them make sense and you might be right on all points, I do not claim monopoly on the truth when it comes to Yi Jing or anything else for that matter🙂 However since I enjoy civilized and intelligent discussions I will add a few more lines:

    1) Even though Yi Jing (as a text and way of thinking) pre-dates yin-yang theory for many years I still believe yin yang paradigm is inseparable from the Yi Jing logic. In this context one can see randomness as yin and deliberate/intentional choice as yang. They form a pair as any other yin and yang pair (such as for example fate/destiny vs free will). One of the axioms of yin-yang theory is that those two (yin and yang) always come in pairs, they are inseparable, one may be dominant but the other one is always there. For that reason I believe that any method we choose (coin method, yarrow stalk method or any other method) must have an element of randomness just to “immobilize” our ego/mind (yang) and unleash what I would call subconscious faculties (yin) which basically lead us to the answers however I would have REALLY hard time accepting that answers we get are totally random because that would imply that yin exists without yang which is not possible.

    2) Statement “It is random, if it wasn’t you would always get the same anagram for the same question which is not the case” and “it is plausible the yarrow-stalk method (given the theory of the I Ching), indeed faithfuly represents and samples the event space” totally make sense and may very well be true however they sound an awful lot like a children of the scientific paradigm where repeatability (of an experiment) is the only valid proof of objective truth and existence of the phenomenon being investigated. As already stated Yi Jing is the book of CHANGES, expectations that we confirm validity of the given answer by drawing the same hexagram two (or more) times in a row comes from a different (scientific) “cognitive space”. Yes, “sample of events space” as nikosms put it does play a role, I would agree, however I must repeat my original statement – I do not believe one or the other sample of event space would critically affect efficacy of any given method. Why? because it is not all about randomness as I elaborated in the previous point.

    3) Concept that one method may “more faithfully represent sample space” then any other given method leads us again to the same dilemma: are those methods themselves random (yin) or they are carefully and deliberately selected by someone (yang)? Again I think they are both at the same time but I think yang is dominant – they are not totally random methods. For example it is well know that ancient Chinese knew about magic squares (3×3 and others) and probability of 1/16, 3/16, 5/16, 7/16 in Yi Jing numerology can be seen as 1/7, 3/7, 5/7, 7/7 somehow “make more sense” to me than coin method probabilities and it is quite possible that what Nikosms said is true however one thing I know about Chinese people is that they are and they have always been pragmatic: if coin method was inferior to yarrowstalk method they would not use it for so long which leads me to believe it is not all about the method.

    And in conclusion I want to say this: although Yi Jing to most science-minded persons sounds like a pile of hocus-pocus nonsense Yi Jing is as scientific as it can get: ever since oracle bone times people asked important questions, oracle provided them with the answers and with the passage of times those answers were validated by the actual events. In other words everyone can test it: if you have an important question you are not sure about, ask the question, get the answer, wait, and see if the answer was correct or not. If answers you receive are nothing but random nonsense then don’t waste your time on Yi Jing. If however it turns out answers were highly insightful and useful and validated by the upcoming events then pay closer attention to it.

    Cheers!

  11. Bug, or oddity, in the R code there: when you start off with 48 in the left hand & 1 in the right you still end up moving 4 from the right hand to the middle finger. Your calculation does, however, preserve the 5,5,5,9 pattern for the total between your fingers as you increment the no. straws in the left-hand division. Still, no-one divides the straws so unevenly, do they? This engenders the reflection that the uniform distribution given by sample(1:(48-hand),1) is unrealistic: owing to the patterns 5,5,5,9 at the first division, & 4,4,8,8 at subsequent divisions, the probability model you’ve shown, rather than exhibiting a “tiny bias” compared to the true model, might be seen as a reasonable approximation to a range of plausible models for how real people divide real bunches of straws.

  12. Or to put it another way, if the intent is, as you suggest, to obtain probabilities of 1/16, 3/16, 5/16, & 7/16, the yarrow-stalk method will be fairly robust to how different people divide different bunches of stalks; considering the exact probabilities when every possible division is assumed equally likely is something of a red herring.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s