A binary number (2進数) represents values using only two digits, 0 and 1, and each time you move one digit to the left, the size that a 1 in that digit stands for (its weight) becomes twice as large.
Digit position
Weight
As a power of 2
Integer part, 4th digit from right
8
2 to the 3rd power
Integer part, 3rd digit from right
4
2 to the 2nd power
Integer part, 2nd digit from right
2
2 to the 1st power
Integer part, rightmost digit
1
2 to the 0th power
1st place after the point
0.5
2 to the -1st power
2nd place after the point
0.25
2 to the -2nd power
The number of different digits that one position can use is called the radix (基数), and the radix of binary is 2. Weights in the integer part double from the right as 1, 2, 4, 8, while weights to the right of the point halve as 0.5, 0.25, 0.125. Negative numbers are usually written in two's complement (2の補数), formed by flipping every 0 and 1 of the positive number and then adding 1.
AnalogyIt is like a row of lamps that can only be on or off, where the pattern of which lamps are lit stands for a number.
How to rememberThink of "base 2" as "once two pile up, move on to the next place." In base 10 (decimal), you move on only when ten pile up.
Exam points
ExamThe value of the fractional part of a binary number (2進数) is the sum of the weights (one over a power of 2) of the digits that hold a 1. A decimal (10進数) fraction that cannot be written as such a sum does not fit into a finite number of binary digits.
ExamAn n-digit binary number (2進数) can distinguish 2 to the n-th power values. When several binary numbers are combined to express one state, the number of possible states is the product of each one's count.
ExamAn n-digit binary number (2進数) in two's complement (2の補数) covers the integers from −2^(n−1) up to 2^(n−1) − 1, with one more value on the negative side than on the positive side.
Radix conversion (基数変換) means rewriting a value in a notation with a different radix while leaving the value itself unchanged.
13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Remainders read from last: 1101
Reading the remainders from the last one gives 1101, the binary form of 13.
4 / 4
To turn a binary number into decimal, multiply each digit by its weight and add the results. To turn a decimal number into binary, keep dividing by 2 until the quotient reaches 0, then line up the remainders starting from the last one. Hexadecimal uses 16 digits, 0 to 9 and A to F; one hexadecimal digit matches four binary digits, and one octal digit matches three.
AnalogyLike restating the same length in inches instead of centimeters: the amount stays put, and only the ruler used to write the number changes.
How to remember16 is 2 to the 4th power, so one hex digit covers four binary digits; 8 is 2 to the 3rd power, so one octal digit covers three.
Exam points
ExamBesides dividing by 2, you can convert a decimal (10進数) number to binary (2進数) by subtracting the weights from the largest down, writing 1 in each digit whose weight could be subtracted and 0 where it could not.
ExamTo convert between octal (8進数) and hexadecimal (16進数), first rewrite the number in binary (2進数) and regroup it into blocks of three or four digits, starting from the right end. Hexadecimal A to F equal decimal 10 to 15.
ExamEven a notation written with symbols or shapes has the same structure as binary (2進数) if the weight of each position doubles from the right as 1, 2, 4, 8, and adding the weights of the positions holding the symbol for 1 gives the value.
Binary addition (加算) adds digit by digit from the lowest one up, and whenever a digit's sum reaches 2 or more, it carries 1 into the next higher digit.
Digit weight
Number added to
Number being added
Carry from below
Result in this digit
Carry to above
1
1
1
0
0
1
2
0
1
1
0
1
4
1
1
1
1
1
8
0
0
1
1
0
Whole (decimal)
0101 (5)
0111 (7)
None
1100 (12)
None
Adding one digit to another gives 0+0=0, 0+1=1, 1+0=1, and 1+1=10, so a carry appears only for 1+1. When a digit that already received a carry from below becomes 1+1+1, it keeps 1 and also carries 1 upward. Doubling a number shifts the whole thing one digit to the left, and multiplication can be done as an addition of shifted copies.
AnalogyPicture a wallet with a rule: as soon as two coins of the same kind pile up, they are swapped for one coin of the next higher value.
How to rememberBinary 1+1 plays the same role as decimal 9+1: in both, the digit rolls over the moment it passes the largest digit that place can hold.
Exam points
ExamIn addition (加算) with many digits, a carry can ripple on from one digit to the next. You can also check the result by converting both numbers to decimal, adding them, and converting back to binary (2進数).
ExamMultiplying a binary number (2進数) by 2 shifts it one digit to the left and puts 0 at the right end. For multiplication, line up a shifted copy of the multiplicand for each 1 in the multiplier and add them together.
Binary subtraction (減算) subtracts digit by digit from the lowest one up, and in any digit where it can't subtract, it first borrows 1 from the next higher digit and then subtracts.
Digit weight
Minuend
Subtrahend
Handling the borrow
Difference in this digit
1
0
1
Borrow from above to make 2, then 2 - 1
1
2
0
0
Borrow from above to make 2, lend 1 below, 1 remains
1
4
0
0
Borrow from above to make 2, lend 1 below, 1 remains
1
8
1
0
Lend 1 below and become 0
0
Whole (decimal)
1000 (8)
0001 (1)
The borrow runs through 3 digits
0111 (7)
A 1 in a higher digit equals 2 in the digit just below, so the digit that borrowed subtracts from its value plus 2. When borrowing across a run of 0s, the borrow travels up to the first digit holding a 1, and each 0 in between becomes 1. Inside a computer, subtraction is often done with the addition circuit by turning the subtrahend into two's complement (2の補数) and adding it.
AnalogyJust as you break a large coin into change when you are short, in binary one coin from the higher place breaks into exactly two.
Exam points
Mix-upIn binary (2進数) subtraction (減算), the 1 borrowed from a higher digit counts as 2 in the digit that borrowed it. That differs from decimal long subtraction, where a borrowed 1 counts as 10.
Addition vs. Subtraction
Aspect
Addition
Subtraction
Operation in each digit
Add that digit's numbers and the carry
Subtract the subtrahend from that digit's number
Key differenceExchange with the higher digit
When the sum reaches 2 or more, carry 1 to the higher digit
When it can't subtract, borrow 1 from the higher digit and use it as 2
When the exchange chains on
Carries chain through a run of 1s
Borrows chain through a run of 0s
Number of digits in the result
May gain one digit over the original numbers
Higher digits may become 0, leaving fewer digits
Key points
A binary number (2進数) uses only 0 and 1, and digit weights double in the integer part and halve in the fractional part.
An n-digit binary number can distinguish 2 to the n-th power values.
Binary to decimal: multiply by the weights and add; decimal to binary: line up the remainders of dividing by 2, starting from the last.