Positional notation (sometimes called place-value notation) is a method of encoding numbers. It differs from other notations (such as Roman numerals) in that it uses the same symbol for different orders of magnitude depending on its position. For example, consider the number 23. The “3” indicates 3 ones, because it is in the ones position. The “2”, however, indicates 2 tens, because it is in the tens position. We know the value of a position by its location within the number. As we move left in a number, each position is valued at ten times the prior position. It might help if we label each position using power notation. Consider the number 123:
The “3” is the right-most, and therefore the lowest-valued position, representing “ones” with a position multiplier of 100 (that is, 10 raised to the zero power, or 1). The “2” is located one position to the left, so we multiply by 10 again giving us a position multiplier of 101 (that is, 10 raised to the first power, or 10). Finally, the “1” is located one position to the left, so we again multiply by 10 giving us a position multiplier of 102 (that is, 10 raised to the second power, or 100). By multiplying each digit by its corresponding position multiplier, we can obtain the value of the entire number:
1 * 102 + 2 * 101 + 3 * 100 =
100 + 20 + 3 =
While we generally understand the mechanics of this process in the decimal system, thinking about how it actually works will enable us to consider other systems.
The radix or base is the number of unique digits, including zero, used to represent numbers in a positional numeral system. The base is normally written as a subscript to the right of the number. For example, the decimal number 123 would formally be written as (123)10
Note that the parentheses are sometimes not written: 12310
In the case of decimal (base 10) numbers, the subscripted 10 is often assumed and not written.
The decimal system is the system with which we are most familiar. It is a decimal system because it contains ten unique digits:
0 1 2 3 4 5 6 7 8 9
For any (integer) value larger than 9, we’re required to use positional notation. Please keep in mind that “10” is not a digit. Rather, it’s a number consisting of two digits, a “1” in the tens (101) position and a “0” in the ones position (100).
The octal system uses eight unique digits to represent a number:
0 1 2 3 4 5 6 7
Let’s consider the value of an octal number: 47358
What is the decimal value of this number? We use exactly the same method that we use for knowing the value in any system:
|Digit at position:||4||7||3||5|
|Position value:||4 • 83||7 • 82||3 • 81||5 • 80|
Note that in this case, the right-most digit is, as always, representative of units (ones), just as in any positional system. However, moving one digit to the left, because we’re now using an octal system, the position indicates the number of eights (not tens). The next position to the left indicates the number of sixty-fours (not hundreds) and the final position indicates the number of 512’s. As before, we multiply each digit by its corresponding position multiplier to obtain the value of the entire number:
4 • 83 + 7 • 82 + 3 • 81 + 5 • 80 =
2,04810 + 44810 + 2410 + 510 =
The hexadecimal (six and ten) uses sixteen digits to represent a number:
0 1 2 3 4 5 6 7 8 9 A B C D E F
Note that because we only have ten digits in our familiar decimal system, we use the letters A through F to represent the additional six digits in the hexadecimal system. Remember that these are digits, that is, A represents 10, B represents 11, and so on up to F which represents 15.
Let’s consider the value of a hexadecimal number: B59C16
What is the decimal value of this number?
|Digit at position:||B||5||9||C|
|Position value:||B • 163||5 • 162||9 • 161||C • 160|
As always, we multiply each digit by its corresponding position multiplier to obtain the value of the entire number:
B • 163 + 5 • 162 + 9 • 161 + C • 160 =
45,05610 + 128010 + 14410 + 1210 =
The binary system (two) uses two digits to represent a number:
Let’s consider the value of a binary number: 1011 10102
What is the decimal value of this number?
|Digit at position:||1||0||1||1||1||0||1||0|
|Position value:||1 • 27||0 • 26||1 • 25||1 • 24||1 • 23||0 • 22||1 • 21||0 • 20|
Multiplying each digit by its corresponding position multiplier to obtain the value of the entire number:
1 • 27 + 0 • 26 + 1 • 25 + 1 • 24 + 1 • 23 + 0 • 22 + 1 • 21 + 0 • 20 =
12810 + 010 + 3210 + 1610 + 810 + 010 + 210 + 010 =
Let x be a string of digits, such that:
Then, the value of in any particular base, , is calculated as:
The rightmost digit, is referred to as the least significant digit, or LSD. It is least significant because in terms of the overall value of the entire number, this digit will always have the least impact. Conversely, the leftmost digit, is referred to as the most significant digit, or MSD. It is most significant because in terms of the overall value of the entire number, this digit will always have the most impact.
Conversions to Decimal
Conversions from Decimal
To convert a decimal (base 10) number to any other base, we simply repeatedly divide by the base until we have a quotient of zero. Specifically, the dividend starts with the number that we want to convert, the divisor will always be the base. The remainder of each successive operation indicates the digit in the new base first at the right-most position and then moving left. The quotient of each step becomes the dividend of the subsequent step.
Let’s first try converting the number 2810 to octal (base 8):
The dividend is the decimal number that we want to convert, in this case 28. The divisor is the base to which we want to convert, in this case 8. The remainder indicates each successive digit. We stop the process when the quotient is 0.
So, 2810 is 348. (Remember that we read the remainder from bottom to top.)
Let’s try converting the number 56710 to octal:
So, 56710 is 10678.
Let’s try converting the number 63,21510 to hexadecimal:
So, 63,21510 is hexadecimal , or more conventionally, F6EF16.
(Remembering that in hexadecimal, we use the digit “F” for 15, “E” for 14, etc.)
Finally, let’s convert the number 53410 to binary:
So, 53410 is 10 0001 01102
- It is customary to separate groups of three decimal digits by commas. For example: 123,45610.
- It is customary to separate groups to two hexadecimal digits by spaces and prefix a leading zero to what would otherwise be a single digit. For example: 01 2F16.
- It is customary to separate groups of three octal digits by spaces and prefix leading zeros to pad to a three digit grouping. For example: 001 2378.
- It is customary to separate groups of four binary digits by spaces and prefix leading zeroes to pad to a four digit grouping. For example: 0001 1011 11002.
Because both the octal and hexadecimal bases contain and possible digits, respectively, and the binary base contains possible digits, we're able to utilize a shortcut when converting between these systems. Note that each octal digit is comprised of three binary digits and each hexadecimal digit is comprised of four binary digits. We can therefore establish (and memorize) the following table:
The shortcut is very straight-forward yet a significant time saver and based on the above information. When converting between binary, octal, and hexadecimal, there's no need to use an intermediate, decimal step.
Binary to Hexadecimal
Group the binary number in sets of four digits, from right to left. Each binary set represents a single hexadecimal digit. (It's sometimes helpful to pad the final set with zeroes.) For example, given the number , regroup the binary digits in sets of four:
Then, use the memorized table to translate each set of four binary digits to a single hexadecimal digit:
Hexadecimal to Binary
Simply follow the above procedure in reverse. Use the memorized table to convert each hexadecimal digit to a set of four binary digits.
Binary to Octal
Group the binary number in sets of three digits, from right to left. Each binary set represents a single octal digit. (It's sometimes helpful to pad the final set with zeroes.) For example, given the number , regroup the binary digits in sets of three:
Then, use the memorized table to translate each set of three binary digits to a single octal digit:
Octal to Binary
Simply follow the above procedure in reverse. Use the memorized table to convert each octal digit to a set of three binary digits.
Octal to Hexadecimal (and vice versa)
This requires slightly more work. Convert the number in the source base to binary, and then convert from binary to the target base.