Boolean Algebra and the I Ching (Yijing)

Posted on 22nd February 2010 by Ryan Somma in Geeking Out
Eight Trigrams of the I Ching
Eight Trigrams of the Yijing

In Sadie Plant’s book zeros + ones, she explores the duality of binary digits as fitting in with the human habit of dichotomizing concepts:

The zeros and ones of machine code seem to offer themselves as a perfect symbols of the orders of Western reality, the ancient logical codes which make the difference between on and off, right and left, light and dark, form and matter, mind and body, white and black, good and evil, right and wrong, life and death, something and nothing, this and that, here and there, inside and out, active and passive, true and false, yes and no, sanity and madness, health and sickness, up and down, sense and nonsense, west and east, north and south… Man and woman, male and female, masculine and feminine, one and zero looked just right, made for each other: 1, the definite, upright line; and 0, the diagram of nothing at all…

However she is incorrect in stereotyping this pattern to the greater “orders of Western reality,” when, in reality, the habit of framing concepts into dichotomies is a universal human habit. In fact, the best example of this in Eastern thought is the yin (0) and yang (1). I recently discovered that the Yijing, an ancient Chinese classic text/divination tool (I’m personally partial to thinking of it as a secular Confucian Philosophy text), uses eight trigrams with unique binary values that combine in pairs to express the 64 hexagrams within the text, each identifying a different concept.

Binary Concepts of the Yijing
Binary Concepts of the Yijing

The mathematician/philosopher Gottfried Wilhelm Leibniz viewed these concepts within the Yijing expressed as binary numbers as evidence of major Chinese accomplishments in philosophical mathematics. The entire Yijing can be expressed through a looping string of binary digits, from which any set of six digits from the below string will key into a unique entry:

0000001001000101010000110100110010110110001110101110011110111111


Each six-digit binary identifier has an opposite. For instance, “Approach” (000011) is the opposite of “Retreat” (111100) and “Progress” (101000) is the converse of “Waiting” (010111).

Binary Relationships Between Trigrams
Heaven 000 111 Earth
Mountain 100 011 Lake/Valley
Water 010 101 Fire
Wind 110 001 Thunder

According to an old revision Wikipedia entry for the Yijing, it is proposed that the binary nature of the Yijing creates a self-referential relationship of ideas within it, and the expression of these dualities in binary allows us to perform XOR functions on them, revealing a much more complex relationship between concepts within the text beyond simple counterparts:

For example, the use of the exclusive-OR operator (XOR) applied to Yijing hexagrams reduced to representations as patterns of ‘bits’ (0 = yin, 1 = yang), brings out the self-referencing of the Yijing, an example to test is in the characteristics of hexagram 27 (100001) where its generic focus in on issues of quality control and infrastructure, describing the ‘mud’ or ‘skeletal form’ of a hexagram. Since the Yijing hexagrams reflect a closed set of meanings, so the self-referencing involved means descriptions of hexagrams are through analogy to other hexagrams (for mathematical modeling of such, see set theory and group theory). Thus if I XOR hexagram 27 with ANY other hexagram I will get a description, through analogy with some other hexagram, of the ’27-ness’, the skeletal form, of that hexagram… For hexagram 01, XORing with 27 gives us hexagram 28. The generic qualities of hexagram 28 cover the notion of ‘excess, too much yang’, where such a description maps to the infrastructure state of hexagram 01 (which is 111111 and covers total yang).

Following this hypothesis, anything XOR’ed with “The Receptive” (000000) will return itself, while anything XOR’ed with “The Creative” (111111) will be transformed into its opposite (ie. “The Joyous” becomes “Keeping Still”, “Oppression” becomes “Grace”, and “Abundance” becomes “Dispersion”). These XORs can result in some very poetic relationships between concepts:

A Youthful Folly – Enveloped and Inexperienced 100010
B Creative – Possessing Creative Power & Skill 111111
XOR Revolution – Abolishing the Old 011101

A Conflict – Engagement in Conflict 111010
B Revolution – Abolishing the Old 011101
XOR Great Taming Power – Accumulating Wisdom 100111

A Peace – Pervading 000111
B Inner Truth – Staying Focused 110011
XOR Development – Auspicious Outlook 110100

I wrote a JavaScript that allows for performing XOR functions to more easily explore different concepts in the Yijing, as well as performing other logical functions on them as well just for giggles. I have restricted the text displayed for each concept to only the imagery, as I am only interested in exploring the relationships between the Confucian/Taoist philosophical concepts, not the divinatory aspects of the text (out of iframe):

Is there something to this? Did the ancient Chinese authors of this text intentionally structure the concepts within the Yijing to relate to one another through Boolean algebra? Dr. Andreas Schoter argues that the relationships are not coincidental, but a natural emergent phenomenon of categorizing the world into binary concepts:

It is not co-incidental because the Yi embodies structure: if one believes that the Universe is a cosmos, and that the Yi describes that Universe, then how could the Yi not encode structure? For the Yi, the starting point of that structure is the complementary relationship between yin and yang. This binary characterization is the most fundamental form of information — it is the minimal distinction, but in being minimal, it is also the easiest distinction on which computation can be built.

While the binary relationships, extended into eight trigrams, and further into 64 hexagrams, do generate concepts that are natural foils for one another, I believe I must draw the line at believing the ancient Chinese intentionally drew relationships between concepts through Boolean algebra. I do find meaning, deep poetic meaning in the relationships defined between hexagrams by the XOR function, but I also know that meaning is coming from within myself. I see the relationships because my brain evolved to find relationships and seek patterns.

The XOR trick works for the same reason Science Tarot Cards work, the concepts within the Yijing are sufficiently vague and generalized so that our minds fill in the gaps to make it work. That doesn’t mean performing Boolean algebra on them is a waste of time; quite the contrary, I think it’s a useful exercise to meditate on philosophical and ethical concepts and the complex relationships between them–so long as we do so from a position of healthy skepticism.

Further Reading

  • In the course of writing this, I discovered Russell Cottrell had written a very similar JavaScript before me. His script keys into the classic concepts more and makes use of JavaScript’s Boolean operators, where I kludged mine into if/then statements.

1 Comment

  1. Interesting page. I, too, wrote my page with Chris Lofting’s ideas in mind. Chris, bless his heart, latched onto the XOR function and never wasted a chance to perseverate on it. But there are other Boolean functions that illustrate further relationships between hexagrams. Most notably, XOR really needs to be paired with XNOR to make sense; using one or the other exclusively makes an arbitrary choice of either yin or yang, respectively, to represent the lines that two hexagrams have in common.

    Comment by Russell — July 2, 2013 @ 11:22 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.