Ternary arithmetic

In signed ternary number system each digit can be expressed as either a negative one (-1), a zero (0) or a positive one (1). This number system is usually called balanced ternary because digits are arranged symmetrically about zero, and negative one is usually written not with minus sign as a prefix, but with a vinculum: 1. Digits in this number system are called trits (as they are called bits in binary number system).

The example below shows some decimal values and their corresponding values in balanced ternary notation:

2410 = 1103; 13710 = 1110113; -2110 = 11103; -29610 = 1110013

Every positive and negative number can be represented in this scheme, and each number has one and only one representation.

Balanced ternary system has many attractive features.

One of them is that we can express negative values as easily as positive ones, without the need for an extra leading negative sign. So the sign of number is defined by the first nonzero trit in the ternary notation: if it is equal 1, it means that the number is positive, else if it is equal 1, it means that the number is negative. It can be observed also that the negative value of any balanced ternary number can be obtained by simply replacing every 1 with a 1 and vice versa. Really:

-2410 = 1103; -13710 = 1110113; 2110 = 11103; 29610 = 1110013

Now let us write some fractions in balanced ternary system:

101.1113 = 8 13 ; 101.1113=-8 13
27 27

To round any balanced ternary number to the closest power of 3 it is enough to set the least-significant digit to 0. This property is also evident enough, because the largest possible positive fraction, 0.111...3, is the sum: 1/3 + 1/9 + 1/27 + ..., which is always lesser than 1/2 (and accordingly, the largest absolute value of negative fraction, 0.111...3, is always greater than 1/2).

Arithmetic in balanced ternary system is much like that in any other number system. For example, the addition in balanced ternary system is doing very simple. Let’s make a ternary addition table, which will be used for number summation:

+ 1 0 1
1 11 1 0
0 1 0 1
1 0 1 11

For example, the sum result of 1 + 1 is equal 1, and 1 transfers to the next number position. Let us add two decimal numbers 296 and 137 expressed in balanced ternary system:

+ 111001
111011
1111001

It is easy to check, that the result is equal to 433.

To subtract a number we must only to invert all 1 and 1 digits of decrement and then to add it with minuend.

Multiplication in balanced ternary system is done in a very similar fashion to decimal multiplication. Let’s make a multiplication table:

x 1 0 1
1 1 0 1
0 0 0 0
1 1 0 1

Let’s multiply two decimal numbers 20 and -19 with the help of it:

x 1111
1101
+ 1111
1111  
1111    
1111011

The result is equal –380. It is obvious that multiplication is reduced to simple operations of altering of sign and addition.

Division in balanced ternary can be performed in the same manner as decimal long division, but becomes slightly more complex because both positive and negative digits in the quotient are possible. At each stage in decimal long division, the intermediate result is compared to the divisor. The next digit of the quotient is the maximum number of times the divisor goes into the intermediate result without causing the following intermediate result to be negative. Unlike decimal long division, in balanced ternary the intermediate results are allowed to be negative. The next digit of the quotient is either 1 or 1 depending on which value will reduce the number of digits in the following intermediate result.


Setun' computer
Setun' 70 computer
"Nastavnik" system
Non-paradoxial logic
Youth
War
Study in the university
The beginning of the scientific researches
Nondecimal number systems and computations
Ternary arithmetic
The history of balanced ternary number system
Thomas Fowler's ternary arithmometer
Main About Biography Projects Publications Photo album Nondecimal number systems Try ternary!