Mathematics for the three-fingered mathematician

We’re all familiar with using a couple of different bases to represent integers. Base ten for almost all purposes when we do our own calculations, and base two, or binary, for getting computers to do them for us. But there’s nothing special about ten and two. We could equally well use any integer, $b$, greater than two, so that the string of digits

$$ d_n d_{n-1} d_{n-1} \ldots d_0, $$

where each $d_i$ is positive and less than $b$, represents the integer

$$ \sum_{i=0}^n d_i b^i.$$

Some bases are slightly more convenient than others for doing arithmetic. Bases eight and sixteen are both used in various computer applications, and there is an active society, the dozenal society, devoted to using and promoting the arithmetical advantages of base twelve. Much less common, but far more interesting, is base three.

With base three, the digits are all 0, 1 or 2. But I want to look at a variation on this. Instead of using 1 and 2, I’ll use 1 and -1; but it’s not convenient to have minus signs in the middle of our numbers, so because of this and for reasons of symmetry I’ll represent them with 1 (for 1) and 1 (for -1). Base three is ternary, and this variation of it is called balanced ternary.

Then the first few integers are

0, 1, 11, 10, 11.

Challenge 1:
Convince yourself that any integer has a unique representation in this notation.

But why would anybody use this notation?

The reasons are simplicity and symmetry, which combine to make the system really quite beautiful.

Properties of balanced ternary

The first thing we can notice is that the negative of any number is obtained by simply swapping the 1 and 1 symbols. There’s no actual need for a minus sign: if the leading digit is 1, the number is positive; if it is 1, the number is negative. A nice consequence of this is that we don’t need to have a subtraction algorithm: we can just change the sign and add.

Next, there are fewer basic rules of arithmetic to learn: the addition and multiplication tables of single digits are very simple, and have some very pretty symmetry to them.

Challenge 2:
Convince yourself that these tables are correct.

With these rules in place, the standard procedures for addition and multiplication work just as before, but now there is no real difficulty in dealing with negative numbers.

Challenge 3:
Write out the numbers from zero to twenty in this notation to see the patterns, and do some addition and multiplication to see it all working.

Non-integers and more symmetry

There’s no problem with dealing with non-integers. Just as with binary and decimal, those with a terminating expansion are those which are an integer divided by the base—in this case three—and all others do not terminate.

Also, just as with binary and ternary, there is a unique representation for integers, but not for all numbers. In the case of base ten, we know that any decimal expansion ending in an infinite string of nines represents a number with a terminating decimal expansion. This is encapsulated in the fact that

$$ 0.999\ldots=1. $$

Challenge 4:
Convince yourself that
0.111$\ldots$ = 1.111$ \ldots$
where the two expressions both represent the number one half.

So, we don’t get a unique representation in this notation any more than in decimal; but the non-uniqueness also acquires a pleasant symmetry.

We could do something like this with base ten, of course, but we have a decision to make: should we use digits from negative four to five, or from negative five to four? This is an unfortunate consequence of the fact that ten is an even number. With an odd base, we don’t have this problem, and get all the symmetry of balanced ternary.

So balanced ternary has very slightly more basic operations than binary, but this is compensated for by the extra symmetry to do with negative numbers.

In real life?

I admit, I have not converted to using balanced ternary for my everyday arithmetic. But it is great fun to play with. It also has not been influential in the history of computing. The only cases I know about are a wooden mechanical calculator from the 19th century built by Thomas Fowler (and so preceding the binary electrical and electronic computers of about a century later), and the Setun computers, the first developed in 1958 at Moscow University (which showed advantages of efficiency over competing binary computers), followed up by a newer model in 1970.

I have one last confession/challenge. You have probably noticed that I have mentioned addition and multiplication, but not division. That’s partly because the long division algorithm is just a bit more fiddly than the usual one. So I’ll close with:

Challenge 5:
Work out a long division algorithm.

Challenge 6:
Decide whether you do actually find balanced ternary more pleasing than binary, decimal, or any of the other competing number systems.