By the end of this lesson, students will be able to:
-
Understand that computers use binary (base 2) to represent data.
-
Convert small binary numbers (up to 8 bits) into decimal and vice versa.
-
Recognise the importance of binary in computing (e.g. storage, processing, instructions).
Binary
Computers don’t understand human languages like English — they operate using electrical signals, which can be on or off (either current flowing or not)
These two states are represented by 0 and 1, forming the binary number system (also called base 2).
Binary is an alternative number system to denary (also called base 10) – which is what we count in every day (using numbers 0 to 9)
Convert binary to denary
Just like how denary uses powers of 10, binary uses powers of 2. It’s just place value! It’s actually easier, because you can just read the columns with a 1 in them, and add them together.
| 8 | 4 | 2 | 1 |
|---|
| 1 | 0 | 1 | 1 |
So here, 1011 is a binary number that represents 11 in denary.
All we have to do to work out the columns is multiply each next column by 2 starting from the right.
Attempt these practice questions:
Convert these binary numbers into decimal:
-
1001= ? -
0110= ? -
1111= ?
A bit is a binary – digit. This means that it has a value of either 0 or 1.
| Bit Position | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Binary Value | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 |
To convert 11001010 to decimal:
-
Add up the values where there is a 1:
-
128 + 64 + 8 + 2 = 202
-
Convert denary to binary
To convert in the opposite direction, we need to do something slightly more specific – we need to start at the left side (the largest bits) and work our way across to the right, filling in 1s wherever we can, and taking whatever value is in that column away from our number.
For example – to convert 79 into binary.
79 is smaller than 128, so we can put a 0 in that column (or not include it at all).
64 fits into 79 though, so we take it away and put a 1 in the 64s column.
79-64 = 15
32 doesn’t fit into 15 -> 0
16 doesn’t fit into 15 -> 0
8 fits into 15 -> 1
15 – 8 = 7
4 fits into 7 -> 1
7 – 4 = 3
2 fits into 3 -> 1
3 – 2 = 1
1 fits into 1 -> 1
So then we just have to place the bits in our table:
Important: Remember the column headers are always the same. They just double each time to the left if you need more bits to store larger numbers.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 |