To convert a decimal number to a ternary (base-3) number, you must convert the integer and fractional parts separately.
The integer portion is converted using repeated division by 3, while the fractional portion uses repeated multiplication by 3.
Part 1: Converting the integer part
The standard method for converting a base-10 integer to any other base is through repeated division. For ternary, this means repeatedly dividing the number by 3 and recording the remainder at each step.
The procedure
- Divide the decimal number by 3.
- Note the integer quotient and the remainder.
- Take the new quotient and repeat the division by 3.
- Continue this process until the quotient becomes 0.
- Construct the ternary number by reading the remainders in reverse order (from last to first).
Example: Convert 42 to ternary
- Step 1: Divide 42 by 3.
-
42÷3=1442 divided by 3 equals 14
42÷3=14
with a remainder of 0.
-
- Step 2: Divide the quotient, 14, by 3.
-
14÷3=414 divided by 3 equals 4
14÷3=4
with a remainder of 2.
-
- Step 3: Divide the quotient, 4, by 3.
-
4÷3=14 divided by 3 equals 1
4÷3=1
with a remainder of 1.
-
- Step 4: Divide the quotient, 1, by 3.
-
1÷3=01 divided by 3 equals 0
1÷3=0
with a remainder of 1.
-
- Step 5: Read the remainders from bottom to top: 1, 1, 2, 0.
The decimal number 42 is therefore 112031120 sub 3
11203
in ternary.
Why this works
The method of repeated division uncovers the coefficients of the number's expansion in powers of the new base. A number in base 3 can be expressed as:(dndn−1…d1d0)3=dn⋅3n+dn−1⋅3n−1+…+d1⋅31+d0⋅30open paren d sub n d sub n minus 1 end-sub … d sub 1 d sub 0 close paren sub 3 equals d sub n center dot 3 to the n-th power plus d sub n minus 1 end-sub center dot 3 raised to the n minus 1 power plus … plus d sub 1 center dot 3 to the first power plus d sub 0 center dot 3 to the 0 power
(𝑑𝑛𝑑𝑛−1…𝑑1𝑑0)3=𝑑𝑛⋅3𝑛+𝑑𝑛−1⋅3𝑛−1+…+𝑑1⋅31+𝑑0⋅30
When we divide by 3, the remainder is the lowest-order digit (d0d sub 0
𝑑0
). The integer quotient is the remaining part of the number, shifted right by one place (i.e., divided by 3), and the process is repeated to find the next digit (d1d sub 1
𝑑1
).
Part 2: Converting the fractional part
The method for converting a decimal fraction to ternary is based on repeated multiplication by 3.
The procedure
- Multiply the decimal fraction by 3.
- The integer part of the result is the first digit of the ternary fraction.
- Take the remaining fractional part of the result and repeat the multiplication by 3.
- Continue this process until the fractional part is 0 or until a repeating pattern is observed.
- Construct the ternary number by reading the integer parts of the results in order (from first to last).
Example: Convert 0.625 to ternary
- Step 1: Multiply 0.625 by 3.
-
0.625×3=1.8750.625 cross 3 equals bold 1 .875
0.625×3=𝟏.875
. The first digit is 1.
-
- Step 2: Take the fractional part, 0.875, and multiply by 3.
-
0.875×3=2.6250.875 cross 3 equals bold 2 .625
0.875×3=𝟐.625
. The second digit is 2.
-
- Step 3: Take the fractional part, 0.625, and multiply by 3.
-
0.625×3=1.8750.625 cross 3 equals bold 1 .875
0.625×3=𝟏.875
. The third digit is 1.
-
- Step 4: Take the fractional part, 0.875, and multiply by 3.
-
0.875×3=2.6250.875 cross 3 equals bold 2 .625
0.875×3=𝟐.625
. The fourth digit is 2.
-
A repeating pattern of 1 and 2 has emerged. The decimal 0.625 is therefore 0.12¯3the repeating decimal 0 point with repeating digits 1 2 end-digits sub 3
0.123
in ternary.
Why this works
This method is based on the expansion of a fraction in powers of the new base. A ternary fraction can be expressed as:(0.d1d2d3…)3=d1⋅3-1+d2⋅3-2+d3⋅3-3+…open paren 0. d sub 1 d sub 2 d sub 3 … close paren sub 3 equals d sub 1 center dot 3 to the negative 1 power plus d sub 2 center dot 3 to the negative 2 power plus d sub 3 center dot 3 to the negative 3 power plus …
(0.𝑑1𝑑2𝑑3…)3=𝑑1⋅3−1+𝑑2⋅3−2+𝑑3⋅3−3+…
Multiplying the fraction by 3 isolates the first digit, d1d sub 1
𝑑1
, as the integer part. The remaining fractional part contains the rest of the digits, which are then found by repeating the process.
Part 3: Converting a mixed number
To convert a decimal number with both an integer and a fractional part, simply combine the two methods. Convert the integer part to ternary using repeated division, and convert the fractional part using repeated multiplication.
Example: Convert 42.625 to ternary
From the previous examples, we already know the components:
-
The integer 42 is 112031120 sub 3
11203
.
-
The fractional part 0.625 is .12¯3point 12 bar sub 3
.123
.
Combining them, we get 42.62510=1120.12¯342.625 sub 10 equals the repeating decimal 1 1 2 0 point with repeating digits 1 2 end-digits sub 3
42.62510=1120.123
.