Counting systems
| English | Chinese | Pinyin |
|---|---|---|
| number base | 进制 | jìn zhì |
| binary | 二进制 | èr jìn zhì |
| place value | 位值 | wèi zhí |
| hexadecimal | 十六进制 | shí liù jìn zhì |
Ten fingers is an accident
- We count in tens because of hands, not because of mathematics.
- A number base 进制 says how many digits a system uses before it carries.
- Binary 二进制 uses two, because a wire is either on or off, and that is the whole reason computers use it.
Place value does the work
- Every digit's value is its place value 位值 times the digit.
- In decimal the places are 1, 10, 100, 1000. In binary they are 1, 2, 4, 8, 16.
- Write the place values above the digits before you convert. Doing it mentally is where the errors come from.
The same value in three bases
Place value is the only idea; the base only changes what the places are.
Hexadecimal
- Hexadecimal 十六进制 uses sixteen digits: 0 to 9, then A to F.
- One hex digit is exactly four bits, which is why memory addresses and colours are written in it.
- $\text{FF}$ is 255, and it is 11111111 in binary — eight bits, two hex digits, one byte.
Convert binary 1101 to decimal.
Places 8, 4, 2, 1 with digits 1, 1, 0, 1 gives 8 + 4 + 0 + 1 = 13.
Write decimal 10 in binary.
8 and 2 are used, 4 and 1 are not. Writing the place values first makes this immediate.
Convert 1101 from binary to decimal, and 13 back again.
Places: 8, 4, 2, 1. Digits: 1, 1, 0, 1.
Back: the largest place that fits in 13 is 8, leaving 5; then 4, leaving 1; then 1. So 8, 4 and 1 are used and 2 is not — 1101.
Writing the place values first makes both directions the same short piece of arithmetic.
How many bits does one hexadecimal digit represent?
Sixteen values need four bits, which is why hex is compact shorthand for binary.
What is hexadecimal FF in decimal?
15 × 16 + 15 = 255, which is also 11111111 in binary — one byte.
Converting is just place value. There is no separate technique for binary, hex or any other base — write the places, decide which are used, add. Learning it as one idea instead of three procedures is what makes base-$n$ questions easy.
Binary 10 is two, not ten. Read a binary number digit by digit — "one zero", not "ten" — because saying "ten" aloud is enough to make you treat it as a decimal number halfway through a calculation.
Binary 10 has the value ten.
It is two. Read binary digit by digit — "one zero" — so you never treat it as decimal by accident.