Study Guide
How Computers Count in Binary
Why a computer stores everything as patterns of two states, how many patterns a row of bits can make, and how to convert between binary and denary using place value.
Lesson 1.1 Data Representation
For: Key Stage 3 (about ages 11 to 14), and anyone starting GCSE or IGCSE Computer Science
Stage: Think
Three light switches
Picture a hallway with three light switches in a row. Each switch is either up (on) or down (off). A friend at the far end cannot hear you, but can see the lights, and you agree that each different arrangement of the switches will mean a different message.
Think it through
Before working anything out, guess: how many different messages could three switches send?
- Hint 1: Start smaller. How many arrangements does one switch have?
- Hint 2: Now try two switches: write down every arrangement you can find.
Show what happens
Many people guess 3 or 6. The real answer is 8, and the next step shows why.
Stage: Discover
Every switch doubles the patterns
Build the answer up one switch at a time, writing off as 0 and on as 1.
| Switches | Arrangements | How many |
|---|---|---|
| 1 | 0, 1 | 2 |
| 2 | 00, 01, 10, 11 | 4 |
| 3 | 000, 001, 010, 011, 100, 101, 110, 111 | 8 |
Adding a switch keeps every arrangement you already had, once with the new switch off and once with it on. So each extra switch doubles the number of arrangements.
Check your understanding
Show the answer
Answer: B. 16, because the fourth switch doubles the eight arrangements of three.
Four switches make 2 × 2 × 2 × 2 = 16 arrangements.
Stage: Explain
Why a computer uses two states
Inside a computer, data is stored and moved by billions of tiny electronic switches called transistors. Like the hallway switches, each is in one of two states. Telling two states apart is fast and reliable, even when signals are weak or noisy, which is much harder with ten.
One switch’s state is a bit, short for binary digit, written as 0 or 1. Writing numbers with only these two digits is called binary. Eight bits together make a byte, and the doubling rule from the switches applies to every one of them.
Everything a computer stores, whether a number, a letter, a colour in a photo or a moment of sound, is kept as patterns of bits. Reading those patterns is the start of understanding how a computer represents anything.
Check your understanding
Show the answer
Answer: C. 256, because each of the eight bits doubles the number of patterns.
Eight doublings: 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 256 patterns.
Stage: Explain
Reading a binary number
You already use place value in ordinary numbers, called denary (base 10). In 325, each column is worth ten times the column on its right, so 325 means 3 × 100 + 2 × 10 + 5 × 1.
Binary works the same way with only two digits, so each column is worth two times the column on its right: 1, 2, 4, 8, 16, 32, 64 and 128 for eight bits.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
Add the value of every column holding a 1: 8 + 2 + 1 = 11. Columns holding a 0 add nothing. That includes the 0s at the front: they keep the number eight bits long, just as 0325 is still 325, so 00001011 and 1011 are the same number.
Total:
Each button is one bit. The total is worked out from the place values of the bits that are on, exactly as in the example above.
Check your understanding
Show the answer
Answer: A. 100, because the 64, 32 and 4 columns each hold a 1.
The 64, 32 and 4 columns hold a 1, so 01100100 = 64 + 32 + 4 = 100.
Stage: Discover
Going the other way: denary to binary
Think it through
Using the place values 128, 64, 32, 16, 8, 4, 2 and 1, each at most once, how could you make 90?
- Hint 1: Start with the biggest place value that fits into 90.
- Hint 2: After using 64, what is left to make? Which place value fits into that?
Show what happens
Take the largest place value that fits and subtract it, then repeat with what is left:
- 128 does not fit into 90, so its bit is 0.
- 64 fits: 90 − 64 = 26, so the 64 bit is 1.
- 32 does not fit into 26: 0. 16 fits: 26 − 16 = 10, so the 16 bit is 1.
- 8 fits: 10 − 8 = 2, so the 8 bit is 1. 4 does not fit into 2: 0.
- 2 fits: 2 − 2 = 0, so the 2 bit is 1. Nothing is left, so the 1 bit is 0.
So 90 is 01011010 in 8-bit binary. Check it by reading it back: 64 + 16 + 8 + 2 = 90.
Check your understanding
Show the answer
Answer: C. 00100101, from the 32, 4 and 1 columns.
37 − 32 = 5 and 5 − 4 = 1, so the 32, 4 and 1 bits are on: 00100101.
Stage: Discover
When 10 does not mean ten
Think it through
Someone says: “In binary, 10 means ten.” Using the column values, what does binary 10 really mean?
- Hint 1: Two bits have the columns 2 and 1.
- Hint 2: Which of those columns holds the 1?
Show what happens
Binary 10 has a 1 in the 2 column and a 0 in the 1 column, so it means two. Ten in binary is 1010 (8 + 2).
The digits 1 and 0 look the same in both systems, but their columns are worth different amounts. To avoid confusion, say binary numbers digit by digit, “one zero”, and add a small 2 after a binary number when both systems are on the same page: 10₂ = 2, read as “one zero in base two equals two”.
Go deeper Why the largest 8-bit number is 255, not 256
With every bit on, 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. A byte still has 256 patterns, because one of them, 00000000, means zero: the values run from 0 to 255.
Stage: Apply
Use it somewhere new
A school’s lockers each have a small panel of five lights that shows the locker’s number in binary, using the place values 16, 8, 4, 2 and 1.
Apply it
Show the answer
Answer: B. Locker 19, from the 16, 2 and 1 columns.
10011 has 1s in the 16, 2 and 1 columns: 16 + 2 + 1 = 19. With five lights the school could number lockers 0 to 31.
Stage: Consolidate
Bring it together
Think it through
Without looking back, explain in two sentences why three bits can store eight different values, and how you would write 6 in 3-bit binary.
Show a model answer
Each bit doubles the number of arrangements, so three bits give 2 × 2 × 2 = 8. The columns of a 3-bit number are worth 4, 2 and 1, and 6 = 4 + 2, so 6 is 110.
Check your understanding
Show the answer
Answer: A. 63, from 32 + 16 + 8 + 4 + 2 + 1 with every bit on.
With every bit on, 111111 = 32 + 16 + 8 + 4 + 2 + 1 = 63. The 64 patterns are the values 0 to 63, just as a byte’s 256 patterns are 0 to 255.
- A bit is one binary digit, 0 or 1; computers store everything as patterns of bits, and a byte is eight bits.
- Each extra bit doubles the number of patterns: eight bits give 256, the values 0 to 255.
- Binary columns are worth 1, 2, 4, 8 and so on, doubling to the left. To read a number, add the columns holding a 1; to write one, take the largest place value that fits, subtract, and repeat.
- Binary 10 means two, not ten.
Sources and scope
- What this lesson is. A draft lesson for Key Stage 3 and the start of GCSE or IGCSE, written for this site. It awaits the site owner’s editorial review. Its curriculum links are provisional: the wording of each linked specification point has been checked against the published specification, but no link has yet been verified by the site owner. The links show where the lesson may help with a course; they do not imply that any examination board has reviewed or endorsed it.
- Original material. The hallway switches, the school’s locker panels and the sensor are fictional examples written for this lesson.
- Simplified on purpose. Computers keep bits in several physical forms, such as electrical charge in memory chips, magnetised regions on hard disks and patterns on optical discs; the light-switch picture stands for all of them.
The number system with only two digits, 0 and 1, in which each column is worth twice the column to its right.
A single binary digit: 0 or 1. The smallest unit of data a computer stores.
A group of eight bits, which can hold one of 256 different patterns.
The everyday number system with ten digits, 0 to 9, in which each column is worth ten times the column to its right.
What a digit is worth because of the column it is in: the 2 in 325 is worth twenty, not two.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.