Ternary numeral system
|Numeral systems by culture|
|Positional systems by base|
|Non-standard positional numeral systems|
|List of numeral systems|
||It has been suggested that Nonary and Base 27 be merged into this article. (Discuss) Proposed since July 2013.|
Ternary (sometimes called trinary) is the base-3 numeral system. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit contains (about 1.58496) bits of information. Although ternary most often refers to a system in which the three digits 0, 1, and 2 are all non-negative numbers, the adjective also lends its name to the balanced ternary system, used in comparison logic and ternary computers.
Comparison to other radixes
Representations of integer numbers in ternary do not get uncomfortably lengthy as quickly as in binary. For example, decimal 365 corresponds to binary 101101101 (9 digits) and to ternary 111112 (6 digits). However, they are still far less compact than the corresponding representations in bases such as decimal — see below for a compact way to codify ternary using nonary and septemvigesimal.
|Ternary||1||10||100||1 000||10 000|
|Binary||1||11||1001||1 1011||101 0001|
|Ternary||100 000||1 000 000||10 000 000||100 000 000||1 000 000 000|
|Binary||1111 0011||10 1101 1001||1000 1000 1011||1 1001 1010 0001||100 1100 1110 0011|
|Decimal||243||729||2 187||6 561||19 683|
As for rational numbers, ternary offers a convenient way to represent one third (as opposed to its cumbersome representation as an infinite string of recurring digits in decimal); but a major drawback is that, in turn, ternary does not offer a finite representation for one half (neither for one quarter, one sixth, one eighth, one tenth, etc.), because 2 is not a prime factor of the base.
Sum of the digits in ternary as opposed to binary
The value of a binary number with n bits that are all 1 is 2n − 1.
Similarly, for a number N(b,d) with base b and d digits, all of which are the maximum digit value b − 1, we can write
N(b,d) = (b − 1) bd−1 + (b − 1) bd−2 + … + (b − 1) b1 + (b − 1) b0,
N(b,d) = (b − 1) (bd−1 + bd−2 + … + b1 + 1),
N(b,d) = (b − 1) M.
bM = bd + bd−1 + … + b2 + b1, and
−M = −bd−1 − bd−2 − … − b1 − 1, so
b M − M = bd − 1, or
M = ( bd − 1 ) / ( b − 1 ).
Then, N(b,d) = (b − 1) M,
N(b,d) = (b − 1) ( bd − 1 ) / ( b − 1 ), and
N(b,d) = bd − 1. For a 3-digit ternary number, N(3,3) = 33 − 1 = 26 = 2 × 32 + 2 × 31 + 2 × 30 = 18 + 6 + 2.
Compact ternary representation: base 9 and 27
Nonary (base 9, each digit is two ternary digits) or septemvigesimal (base 27, each digit is three ternary digits) is often used, similar to how octal and hexadecimal systems are used in place of binary.
A base-three system is used in Islam to keep track of counting Tasbih to 99 or to 100 on a single hand for counting prayers (as alternative for the Misbaha). The benefit—apart from allowing a single hand to count up to 99 or to 100—is that counting doesn't distract the mind too much since the counter needs only to divide Tasbihs into groups of three.
In certain analog logic, the state of the circuit is often expressed ternary. This is most commonly seen in TTL logic using 7406 open collector logic. The output is said to either be low (grounded), high, or open (high-Z). In this configuration the output of the circuit is actually not connected to any voltage reference at all. Where the signal is usually grounded to a certain reference, or at a certain voltage level, the state is said to be high impedance because it is open and serves its own reference. Thus, the actual voltage level is sometimes unpredictable.
A rare "ternary point" is used to denote fractional parts of an inning in baseball. Since each inning consists of three outs, each out is considered one third of an inning and is denoted as .1. For example, if a player pitched all of the 4th, 5th and 6th innings, plus 2 outs of the 7th inning, his Innings pitched column for that game would be listed as 3.2, meaning 3⅔. In this usage, only the fractional part of the number is written in ternary form.
Ternary numbers can be used to convey self-similar structures like the Sierpinski triangle or the Cantor set conveniently. Additionally, it turns out that the ternary representation is useful for defining the Cantor set and related point sets, because of the way the Cantor set is constructed. The Cantor set consists of the points from 0 to 1 that have a ternary expression that does not contain any instance of the digit 1. Any terminating expansion in the ternary system is equivalent to the expression that is identical up to the term preceding the last non-zero term followed by the term one less than the last nonzero term of the first expression, followed by an infinite tail of twos. For example: .1020 is equivalent to .1012222... because the expansions are the same until the "two" of the first expression, the two was decremented in the second expansion, and trailing zeros were replaced with trailing twos in the second expression.
Ternary is the integer base with the highest radix economy, followed closely by binary and quaternary. It has been used for some computing systems because of this efficiency. It is also used to represent 3 option trees, such as phone menu systems, which allow a simple path to any branch.
A form of Redundant binary representation called Balanced ternary or Signed-digit representation is sometimes used in low-level software and hardware to accomplish fast addition of integers because it can eliminate carries.
- Mohsen Soltanifar, On A sequence of cantor Fractals, Rose Hulman Undergraduate Mathematics Journal, Vol 7, No 1, paper 9, 2006.
- Mohsen Soltanifar, A Different Description of A Family of Middle-a Cantor Sets, American Journal of Undergraduate Research, Vol 5, No 2, pp 9–12, 2006.
- Dhananjay Phatak, I. Koren, Hybrid Signed-Digit Number Systems: A Unified Framework for Redundant Number Representations with Bounded Carry Propagation Chains, 1994, 
- Brousentsov, N. P.; Maslov, S. P.; Ramil Alvarez, J.; Zhogolev, E.A. "Development of ternary computers at Moscow State University". Retrieved 20 January 2010.
||This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (September 2010)|
- Third Base
- Ternary Arithmetic
- The ternary calculating machine of Thomas Fowler
- Ternary Base Conversion includes fractional part, from Maths Is Fun
- Gideon Frieder's replacement ternary numeral system
- Visualization of numeral systems