 Hong Kong
Stage 1 - Stage 3

# Binary Number System

Lesson

Counting from $1$1 to $9$9 is one of the first things we learn growing up, and figuring out how to keep going when you reach $10$10 and beyond means using a very useful pattern. As we count up, the digit in the units place (furthest on the right) starts at $0$0 and counts up to $9$9, then goes back to $0$0 and around again. Each time it moves from $9$9 back to $0$0 the number to the left (the digit in the tens place) counts up from $0$0 to $9$9 in the same way: When this tens digit goes from $9$9 back to $0$0, we move the next number across to the left up by $1$1 to make $100$100, and so on through the larger place values.

We use $10$10 different symbols in each place value, so we call it a base-$10$10 system. It is also called decimal, from the Latin word decimus (which means "tenth"). This tells us that each place value corresponds to a power of $10$10, so a number like $2019$2019 can be written as:

$2\times10^3+0\times10^2+1\times10^1+9\times10^0$2×103+0×102+1×101+9×100

Using $10$10 different symbols in each place is nearly universal in human communication these days, though there are systems that use a different number of symbols. A particularly useful system is base-$2$2, which means we only use $2$2 symbols in each place. This is also called binary, from the Latin word binus (which means "twice"). Instead of counting from $0$0 to $9$9 in each place, we only count from $0$0 to $1$1 before carrying across to the next place: Let's start by writing out the numbers from $1$1 to $16$16 in binary:

 Decimal $1$1 $2$2 $3$3 $4$4 $5$5 $6$6 $7$7 $8$8 Binary $1$1 $10$10 $11$11 $100$100 $101$101 $110$110 $111$111 $1000$1000 Decimal $9$9 $10$10 $11$11 $12$12 $13$13 $14$14 $15$15 $16$16 Binary $1001$1001 $1010$1010 $1011$1011 $1100$1100 $1101$1101 $1110$1110 $1111$1111 $10000$10000

There are a few things to notice here:

• The number in the units place (furthest on the right) switches from $1$1 to $0$0 and back to $1$1 again as we increase the number by $1$1 each time
• This number is a $1$1 for every odd number and a $0$0 for every even number
• Counting up to $4$4 and beyond in binary means using the third place. For decimals, we don't use the third place value until we reach $100$100
• A number like $7$7 is obviously a decimal, since binary numbers have only $0$0's and $1$1's in them. But a number like $11$11 appears in both rows - if we see an $11$11 somewhere, we might assume that it is an eleven, but it might actually be a three!

Just like with decimals, each place value corresponds to a power of the base, so in binary a number like $100110$100110 represents the following decimal number:

$1\times2^5+0\times2^4+0\times2^3+1\times2^2+1\times2^1+0\times2^0=38$1×25+0×24+0×23+1×22+1×21+0×20=38

To convert from decimal to binary, we need to rewrite the number as a sum of powers of $2$2. It is very helpful to have a descending list of powers of $2$2 nearby, like this one:

 Powers of $2$2 $1024$1024 $512$512 $256$256 $128$128 $64$64 $32$32 $16$16 $8$8 $4$4 $2$2 $1$1

Let's convert the number $921$921 into binary. We add a column to the left of the powers of $2$2 for working, and a column to the right for our answer. Start at the first column that has a number smaller than the one we want to convert. We put a $1$1 in the answer column, subtract the power of $2$2 from the number in the working column, and write the result in the next column:

 Working Powers of $2$2 Answer $1024$1024 $921$921 $512$512 $1$1 $921-512=$921−512= $409$409 $256$256 $128$128 $64$64 $32$32 $16$16 $8$8 $4$4 $2$2 $1$1

If the number we write in the next column is equal to or larger than the power of $2$2, we do the same thing again, continuing until we write a number that is smaller than the power of $2$2 in the same row:

 Working Powers of $2$2 Answer $1024$1024 $921$921 $512$512 $1$1 $921-512=$921−512= $409$409 $256$256 $1$1 $409-256=$409−256= $153$153 $128$128 $1$1 $153-128=$153−128= $25$25 $64$64 $32$32 $16$16 $8$8 $4$4 $2$2 $1$1

When we reach this row where we can't do the subtraction without making a negative number, so instead we write a $0$0 in the answer column and just copy the number down to the next row. We continue like this until we reach the end:

 Working Powers of $2$2 Answer $1024$1024 $921$921 $512$512 $1$1 $921-512=$921−512= $409$409 $256$256 $1$1 $409-256=$409−256= $153$153 $128$128 $1$1 $153-128=$153−128= $25$25 $64$64 $0$0 $25$25 $32$32 $0$0 $25$25 $16$16 $1$1 $25-16=$25−16= $9$9 $8$8 $1$1 $9-8=$9−8= $1$1 $4$4 $0$0 $1$1 $2$2 $0$0 $1$1 $1$1 $1$1

Once we reach the end of the table, we can read the binary representation off the column on the right:

$921$921 in decimal is $1110011001$1110011001 in binary

We can convert this binary number back into decimal like we did before just to check:

$1\times2^9+1\times2^8+1\times2^7+1\times2^4+1\times2^3+1\times2^0=921$1×29+1×28+1×27+1×24+1×23+1×20=921

We only include the powers $9$9$8$8$7$7$4$4$3$3, and $0$0 since these are the positions that have a $1$1 in the binary number.

#### Practice questions

##### Question 1

Write $11$11 in base-2 form.

##### Question 2

A certain number is given by $100$100 in base-2 form. What is the number in base-10 form?

##### Question 3

A certain number is given by $1110$1110 in base-2 form. What is the number in base-10 form?