Trinary numbers

By Martin McBride, 2023-09-09
Tags: trinary number bases
Categories: number theory


We are all familiar with base 10 numbers (denary). And if you have ever done any computer programming you will also be familiar with base 2 numbers (binary).

This article is about trinary numbers (sometimes called ternary numbers). Trinary numbers use base 3.

Why study these numbers? Well, one important reason is to understand the Cantor set. The Cantor set is based on an iterative process of dividing intervals into three parts. Trinary numbers, in particular trinary fractions, are very useful for analysing the set.

This is a deep dive into trinary numbers that should help if you want to fully appreciate the Cantor set.

Trinary numbers

The trinary system uses base 3. This means that the least significant digit represents 1, next represents 3's, then 9's, 27's, 81's and so on. These values go up in powers of 3 - in other words, the value of each column triples as we move to the left. The value 142 in base 10 is represented like this in base 3:

Base 3 places

The base 3 value is calculated like this:

Base 3 places

Base 10 uses the digits 0 to 9, but base 3 uses the digits 0, 1 and 2.

Here are the numbers 0 to 10 (denary) in base 3:

Base 3 number 0 to 10

So for example, 5 is made up of 1 times 3 plus 2 times 1. 10 is made up of 1 times 9 plus 1 times 1.

Trinary fractions

In base ten, we use a decimal point to represent fractions. For example the decimal fraction 0.125 represents this value:

Base 10 fraction

The number is equal to 1 tenth, plus 2 hundredths, plus 5 thousandths. That is equal to 125/1000, which of course is 1/8.

In trinary, we can also use a decimal point (or rather, a trinary point). The first digit after the point represents thirds of a unit, the second represents ninths, and the third represents twenty-sevenths. So this trinary number represents 7/9:

Base 3 fraction

The number is equal to 2 thirds, plus 1 ninth, which simplifies to 7/9.

Recurring trinary fractions

In the decimal system, many rational numbers have to be expressed as recurring fractions. The simplest example is a third which is expressed as 0.333 recurring.

In the trinary system, a third is simply expressed as 0.1. There is no recurring number here.

However, there are recurring fractions in trinary too. For example, a half in trinary is 0.111 recurring. This can be shown quite easily, by expanding out the terms in 0.111...:

One half, base 3

This can be written in terms of powers of 1/3, like this:

One half, base 3

This is an infinite geometric series, and its sum can be written as:

One half, base 3

This formula is valid if r is less than 1. In our case, a is 1/3 and r is also 1/3, so the formula is valid. The value (1 - r) is equal to 2/3, so the sum of the series is:

One half, base 3

This proves that 0.111 recurring, in base 3, is equal to a half.

As another example, a quarter has the base 3 value of 0.020202 recurring. This can be proved similarly (in this case a is 2/9, r is 1/9, and (1 - r) is 8/9).

One half, base 3

Trinary and recurring twos

With decimal fractions, if we multiply 0.333 recurring by 3, we don't get 1, we get 0.999 recurring. This may seem contradictory, but the reason is that 0.999 recurring is equal to 1.

0.999 = 1

Notice that 0.999 recurring isn't approximately equal to 1, it is exactly equal to 1. It is just a different way to write the number 1. We can prove this using the geometric series formula from earlier. In this case a is 9/10, r is 1/10, so (1 - r) is 9/10:

0.999 = 1

This doesn't only happen with 1. For example, the same thing happens with 0.035:

0.034999 = 0.035

In fact, for any decimal number that terminates, we can write the same number by subtracting 1 from the final digit and adding recurring 9s.

Something very similar happens with trinary fractions, but the important digit here is 2 rather than 9. So, for example, these values are identical:

Alternates base 3

See also



Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

adder adjacency matrix alu and gate angle area argand diagram binary maths cartesian equation chain rule chord circle cofactor combinations complex polygon complex power complex root cosh cosine cosine rule cpu cube decagon demorgans law derivative determinant diagonal directrix dodecagon ellipse equilateral triangle eulers formula exponent exponential exterior angle first principles flip-flop focus gabriels horn gradient graph hendecagon heptagon hexagon horizontal hyperbola hyperbolic function infinity integration by substitution interior angle inverse hyperbolic function inverse matrix irregular polygon isosceles trapezium isosceles triangle kite koch curve l system locus maclaurin series major axis matrix matrix algebra minor axis nand gate newton raphson method nonagon nor gate normal not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutations polar coordinates polynomial power probability probability distribution product rule pythagoras proof quadrilateral radians radius rectangle regular polygon rhombus root set set-reset flip-flop sine sine rule sinh sloping lines solving equations solving triangles square standard curves star polygon straight line graphs surface of revolution symmetry tangent tanh transformations trapezium triangle turtle graphics vertical volume of revolution xnor gate xor gate