Definition
Balanced ternary, also called symmetric ternary, is a generalized positional numeral system.
The digits of ordinary ternary consist of 0,1, and 2, while the digits of balanced ternary consist of -1,0, and 1. Its base is also 3 (because there are three possible values). Since writing -1 as a digit is inconvenient, we use the letter Z to represent -1.
Explanation
Here are several examples:
| Decimal | Balanced ternary | Decimal | Balanced ternary |
|---|---|---|---|
0 | 0 | 5 | 1ZZ |
1 | 1 | 6 | 1Z0 |
2 | 1Z | 7 | 1Z1 |
3 | 10 | 8 | 10Z |
4 | 11 | 9 | 100 |
Representing negative numbers in this numeral system is easy: simply reverse the digits of the positive number (Z becomes 1, and 1 becomes Z).
| Decimal | Balanced ternary |
|---|---|
-1 | Z |
-2 | Z1 |
-3 | Z0 |
-4 | ZZ |
-5 | Z11 |
It is easy to see that the most significant digit of a negative number is Z, while that of a positive number is 1.
Process
In the conversion method for balanced ternary, first write a given number x in ordinary ternary. When x is represented in ordinary ternary, each digit is 0, 1, or 2. Starting from the least significant digit, we can skip any 0 and 1, but if we encounter 2, we should first change it to Z and add 1 to the next digit. When we encounter digit 3, it should be changed to 0 and 1 should be added to the next digit.
Application 1
Convert 64 to balanced ternary.
First, rewrite the number in ordinary ternary:
Let us process the digits with the smallest effect on the whole number first (the least significant digit):
101is skipped (because0and1are allowed in balanced ternary);2becomesZ, and the digit to its left is increased by1, giving1Z101;1is skipped, giving1Z101.
The final result is 1Z101.
We then convert it back to decimal:
Application 2
Convert 237 to balanced ternary.
First, rewrite the number in ordinary ternary:
0and1are skipped (because0and1are allowed in balanced ternary);2becomesZ, and the digit to its left is increased by1, giving23Z10;3becomes0, and the digit to its left is increased by1, giving30Z10;3becomes0, and the digit to its left (defaulting to0) is increased by1, giving100Z10;1is skipped, giving100Z10.
The final result is 100Z10.
We then convert it back to decimal:
Properties
For a balanced ternary number , multiplying each digit by its corresponding weight uniquely produces a decimal number .
For a decimal number , does it uniquely correspond to one balanced ternary number?
The answer is yes. This property is called the uniqueness of balanced ternary.
Proof
We use proof by contradiction:
Suppose a decimal number has two different balanced ternary numbers that convert to ; that is, we need to prove . We discuss cases:
-
When , clearly , contradicting the assumption.
-
When :
- Number the digits of and from low to high, and let be the digit of at position , and be the digit of at position . In , there must be an such that . It can be seen that digits are irrelevant to the proof. Therefore, shift right by digits to obtain ; the original problem is equivalent to proving .
- For 's digit , . Assume (the result is the same when ). Clearly . For , the contribution of its digits to 's value is , and for , the contribution of its digits to 's value is . Since , we obtain . have a common factor of , while is not divisible by , contradicting the assumption. Therefore, .
-
When , the proof is the same as for .
Thus, every decimal has a unique corresponding balanced ternary .
Practice Problem
Part of this page is adapted from the blog post Троичная сбалансированная система счисления and its English translation Balanced Ternary. The Russian version is licensed under Public Domain + Leave a Link; the English version is licensed under CC-BY-SA 4.0.