← Back to archive
Feng Shui & Geomancy

Binary Numbers and the Secret Formula of Dual-Yuan Inversion

理气风水

In my earlier article <<The Feng Shui Theory of the Eight Mansions' Great Wandering Year and the Yuan Kong Great Trigrams>>, I discussed the isomorphic operations between Yuan Kong Great Trigrams and Eight Mansions; at the core, both use the Great Wandering Year algorithm.

The Great Wandering Year algorithm is also often called the Gui Zang method in Yi Jing circles; the name may derive from the late Yi Jing master Mr. Huo Feiran. In particular, determining Shi and Ying via Gui Zang is the most widely circulated on the internet.

This algorithm is actually quite simple: compare the yin and yang of corresponding lines in two trigrams. If they are the same, it is Yin; if different, it is Yang. In one simple sentence: if the line position has changed, it is Yang.

By the way, the six-line method for determining Shi and Ying is also relatively simple. Articles online usually describe it in a complicated way, but it is really just this: within the Earlier Heaven Eight Trigrams, start counting from Zhen with the number one, skip over Kan and Li when you encounter them, and count clockwise. If what emerges from Gui Zang is Kan or Li, then Kan is the Returning Soul on the fourth line, and Li is the Wandering Soul on the third line.

There is no need to memorize any mnemonics. Just count the Earlier Heaven trigrams directly on your hand, in the same manner as Xiao Liu Ren, and you can easily remember it.

Now returning to the main topic: why adopt this algorithm for the relationships between trigrams? The secret here lies in "inversion of inversions" (颠倒颠).

Using the Earlier Heaven Eight Trigram numbers—Qian one, Dui two, Li three, Zhen four, Xun five, Kan six, Gen seven, Kun eight—what if we collide these numbers line by line in order to obtain the relationships between trigrams?

When two trigrams collide, although it is spoken of as a relationship between two trigrams, it can be regarded in terms of Ti (Body) and Yong (Function). Therefore we can define: when two trigrams are Gui Zang-ed, (Note by Sanfu Fengyunyong:) the first trigram is the Host, the second trigram is the Guest; then we look at the Guest's relationship to the Host, and what result it produces.

For example, when the Kan trigram meets the Xun trigram, only the top line moves while the others remain unchanged; clearly, the result is the Gen trigram.

This rule—same is Yin, different is Yang—corresponds exactly to the XOR (exclusive OR) logic in logical operations. Since it can be expressed this way, it becomes easy to compute. After calculating all pairings among the trigrams and converting back to decimal, interesting results appear:

Binary Sequence Variable Inversion Rule
0 01234567 Return to origin Unchanged
1 10325476 Upper and lower yuan unchanged Invert forward one position; invert backward seven positions
2 23016745 Upper and lower yuan unchanged Invert forward two positions; invert backward six positions
3 32107654 Upper and lower yuan unchanged Invert forward three positions; invert backward five positions
4 45670123 Upper and lower yuan inverted Invert forward four positions; invert backward four positions
5 54761032 Upper and lower yuan inverted Invert forward five positions; invert backward three positions
6 67452301 Upper and lower yuan inverted Invert forward six positions; invert backward two positions
7 76543210 Upper and lower yuan inverted Invert forward seven positions; invert backward one position

A simple observation reveals that in the 0,1,2,3 sequences, the first four digits only ever contain 0,1,2,3, and the last four digits only ever contain 4,5,6,7. Whereas in the 4,5,6,7 sequences, the first four digits only ever contain 4,5,6,7, and the last four digits only ever contain 0,1,2,3.

The sequence of the Square and Circle Diagram of the Sixty-Four Trigrams is ordered as Qian, Dui, Li, Zhen, Xun, Kan, Gen, Kun. Thus we can make a mapping: the first number is the bottom line (initial line), the second number is the middle line, and the third number is the top line:

[0,0,0] => 0 => Kun
[0,0,1] => 1 => Gen
[0,1,0] => 2 => Kan
[0,1,1] => 3 => Xun
[1,0,0] => 4 => Zhen
[1,0,1] => 5 => Li
[1,1,0] => 6 => Dui
[1,1,1] => 7 => Qian

This yields a beautiful result: Kun, Gen, Kan, and Xun form one yuan; Zhen, Li, Dui, and Qian form another yuan. If viewed within the square-and-circle diagram of trigrams, one can see that from the Fu trigram all the way clockwise to the Qian trigram, the trigrams are precisely arranged in this order: Earth over Thunder (Fu), Mountain over Thunder (Yi), Water over Thunder (Tun), Wind over Thunder (Yi), and so on...

For example, the present Period 8 corresponds to the Zuo Fu Thunder trigram, and Zhen corresponds to the binary number 4, which in turn corresponds to a certain sequence; therefore the positions of the trigrams are swapped. Because Period 8 belongs to the Lower Yuan, originally the Lower Yuan should be the one that receives the period. However, when the Eight Palace Gui Zangs with the Zhen Palace, it is inverted once again. Correspondingly, the directions still follow the pattern that one, two, three, four form one yuan, while six, seven, eight, nine form another yuan. The same principle applies when discussing which yuan mountain and water receive.

Written by Master Sanfu on March 26, 2020. Please credit the source if you share.

Translation Notice: This English version was translated with AI assistance. Specialized, historical, religious, or culturally sensitive terms may contain nuances, inaccuracies, or debatable wording. In case of ambiguity or discrepancy, the original Chinese text shall prevail.