The Math Behind I Ching: Binary Code 3,000 Years Early

A Letter From China That Stopped a Mathematician Cold

In 1701, Gottfried Wilhelm Leibniz — who had, alongside Newton, invented calculus, and who had spent years developing a system of arithmetic based entirely on the digits 0 and 1 — received a letter from a Jesuit missionary named Joachim Bouvet stationed in Beijing.

Enclosed was a diagram.

The diagram showed a square arrangement of 64 symbols, each composed of six stacked horizontal lines, some solid and some broken. It was a rendering of the Fu Xi sequence — one of the traditional orderings of the 64 hexagrams of the I Ching (易經), the Chinese oracle text whose earliest layers date to somewhere between 1000 and 750 BCE.

Leibniz recognized immediately what he was looking at. If you replaced each solid line with a 1 and each broken line with a 0, the 64 hexagrams — read from bottom to top — were the numbers 0 through 63 in binary. In perfect sequence. Complete.

The Chinese had constructed a binary number system three millennia before Leibniz formalized one in Europe. They had done it not for computation but for divination. And the question of what that means — mathematically, philosophically, and for how we understand the I Ching itself — turns out to be considerably more interesting than a simple “they got there first.”


What Binary Actually Is

Binary is a base-2 number system. Where our familiar decimal system uses ten digits (0–9) and represents numbers through combinations of powers of ten, binary uses only two digits — 0 and 1 — and represents numbers through combinations of powers of two.

In binary:

  • 0 = 0
  • 1 = 1
  • 2 = 10
  • 3 = 11
  • 4 = 100
  • 5 = 101

And so on. Any number that can be expressed in decimal can be expressed in binary; the two systems are mathematically equivalent. Binary became the foundation of modern computing not because it’s more naturally suited to mathematics but because it maps perfectly onto physical states that have two stable options: on/off, charged/uncharged, magnetized/demagnetized.

The reason binary is everywhere in computing is that physical systems find it easier to maintain two reliable states than ten. The logic of digital electronics is the logic of two.


The Structure of the Hexagrams

An I Ching hexagram is composed of six lines. Each line is either solid (—) or broken (- -). In the language of binary: each line is either 1 or 0.

With six binary positions, the total number of possible combinations is 2⁶ = 64. This is exactly the number of hexagrams in the I Ching. Not approximately — exactly.

Each hexagram is unique. No two of the 64 share the same combination of solid and broken lines. Together, they exhaust all possible configurations of six binary digits — every number from 000000 to 111111, or 0 to 63 in decimal.

The hexagrams are further organized into pairs of trigrams — three-line figures of which there are 2³ = 8. The eight trigrams (八卦, bā guà) are the structural units from which all 64 hexagrams are built, each hexagram being a stack of two trigrams. The eight trigrams themselves exhaust all possible combinations of three binary digits: 0 through 7.

This is not a metaphor or a loose analogy. The mathematical structure is precise and complete.


Leibniz and the Diagram

What makes the 1701 exchange remarkable is that Leibniz hadn’t seen the I Ching before receiving Bouvet’s diagram — but he had already published his binary arithmetic system in 1679. When he saw the hexagram sequence, he recognized not just a similarity but an identity.

He wrote back to Bouvet with barely contained excitement. He believed he had found evidence that the ancient Chinese sages had discovered binary arithmetic millennia before Europe, embedded it in a divination system, and — crucially — that this confirmed his own belief that binary was something like the natural language of mathematics: inevitable, universal, waiting to be rediscovered rather than invented.

Leibniz was a philosopher as well as a mathematician, and he read the I Ching’s binary structure through the lens of his broader project: a characteristica universalis, a universal symbolic language that could represent all human thought and knowledge. He saw the hexagrams as evidence that such a language was possible — that the Chinese had glimpsed it in antiquity.

He was, on reflection, probably wrong about what the Chinese had intended. But he was right about the mathematics.


What the Chinese Were Actually Doing

Here’s where the story gets more complicated, and more interesting.

The people who compiled the I Ching were not, as far as we can determine, doing binary arithmetic. They were building a system for representing all possible states of change — a complete map of transformation, not a number system.

The core philosophical concept is yáo (爻) — the individual line, which can be either solid (yang, 阳) or broken (yin, 阴). Yang and yin are not “1 and 0” in any functional sense; they’re complementary principles of force and receptivity, activity and rest, the full and the empty. The hexagrams represent the 64 possible combinations of these principles across six positions — but the meaning of each combination is qualitative, not quantitative.

What the I Ching’s authors built was not a number system but a combinatorial topology of change: a framework for thinking about how situations can be constituted, and how they transform into one another. The numerical completeness — the fact that you get all 64 combinations and no more — was a feature because it guaranteed the system was exhaustive. Every possible state of the yang-yin interplay was represented. Nothing was missing.

The binary mathematics and the divination purpose are not in tension. They’re the same design goal: completeness. The system had to include everything, leave nothing out, cover all states. Binary is the most efficient way to achieve exhaustive coverage of two-valued positions. The I Ching’s architects arrived at binary structure not by thinking about numbers but by thinking about totality.


The Deeper Mathematical Resonance

The connection goes further than hexagram counting.

The I Ching includes a concept called change (變, biàn) — the transformation of a line from solid to broken or vice versa. When you cast an I Ching reading, some lines may be “moving lines” that transform, producing a second hexagram from the first. This is the dynamic layer of the system: not just a static position but a vector of movement.

In computational terms, this is something like a state machine: a system defined by its current state and the rules by which it transitions to other states. The 64 hexagrams are the state space; the changing lines are the transition function. The I Ching performs a kind of qualitative computation — mapping a present situation onto a change vector that points toward a future state.

This isn’t how the I Ching’s compilers would have described it. But the structural parallel is genuine. The system was built with a logic that turns out to be isomorphic — same structure, different content — to formal computation.

Claude Shannon, whose 1948 paper A Mathematical Theory of Communication founded information theory and established binary digits (“bits”) as the fundamental unit of information, was working in a tradition that — through Leibniz — connected back to this moment. Shannon almost certainly didn’t think of himself as continuing anything the Zhou dynasty started. But the thread is there.


What This Doesn’t Mean

It would be easy — and wrong — to read this history as evidence that the I Ching is therefore validated as a divination system, or that the ancient Chinese “knew” about computers, or that mathematics somehow confirms the oracle.

It doesn’t. The mathematical structure of the I Ching is a feature of its design, not a proof of its metaphysical claims. A system can be structurally elegant and combinatorially complete while also having interpretive content that isn’t empirically verifiable. These are separate questions.

What the mathematics does establish is something more modest but still significant: the I Ching was built by people who were thinking carefully about structure, completeness, and transformation — not just inventing mystical symbols. The system has an internal logic that is coherent, precise, and, as it turns out, formally equivalent to the number system that underlies every computation you’ve performed today.

That’s worth taking seriously. Not as evidence that the oracle is accurate, but as evidence that the people who built it were serious thinkers working on genuine problems — and that their solutions were, in at least one domain, genuinely ahead of what the rest of the world would discover for millennia.


The Honest Synthesis

The I Ching is a binary system. This is mathematics, not metaphor.

The I Ching is also a divination system — a set of interpretive frameworks for making meaning from the 64 positions. Whether those interpretations are accurate, useful, or merely evocative is a separate question from whether the underlying structure is sound. The structure is sound. Provably, demonstrably, in a way that Leibniz recognized with genuine astonishment three centuries ago.

The Whisper uses the I Ching as one of its 15 frameworks precisely because of this combination: structural rigor and interpretive richness together. The hexagram you receive in a reading isn’t random in the way a horoscope generically applies to everyone born in a month. It’s one of 64 specific states, each with a particular character, chosen by a process that takes your birth information as its input.

Whether that process is meaningful — whether the combinatorics of your birthday have anything to say about the situation you’re in today — is the question the I Ching has been asking for three thousand years. Leibniz, for what it’s worth, thought the answer was yes. He also thought binary arithmetic was the language of God.

He was probably wrong about the second one. The first remains genuinely open.

If you want to understand how the hexagrams actually work as an oracle rather than a number system, the I Ching daily oracle guide covers the interpretive side of the system in depth.