GoalExplain that a computer stores everything with switches that are on or off, and that 1 and 0 stand for on and off.
New words
binary · a number system that uses only two digits, 0 and 1digit · one of the symbols used to write numbers, such as 0 or 1switch · a tiny part that can be on or offpattern · an arrangement of 0s and 1s, for example 1011
Explanation
A computer stores text, pictures, sound, video and games. Inside it are billions of tiny switches, and each switch is either on or off. Like a light, it has no other state. We write on as 1 and off as 0. The binary number system uses only these two digits. Every file in a computer is a long pattern of 1s and 0s. With one switch there are 2 patterns. Each extra switch doubles the number of patterns: 2 switches make 4 patterns, 3 switches make 8, and so on. That is how a small set of switches can store a very large amount of data.
Worked examples
Four lamps are on, on, off, on. We write 1 for on and 0 for off, so the code is 1101.
Switches
Patterns
All the patterns
1
2
0, 1
2
4
00, 01, 10, 11
3
8
000, 001, 010, 011, 100, 101, 110, 111
Each extra switch doubles the patterns. Two switches make 4 patterns and three switches make 2 × 2 × 2 = 8 patterns.
A picture can be stored as binary too. Think of a grid of squares: a black square is 1 and a white square is 0. Each row has its own code, and the rows together are the picture of a letter T.
Class activity
Coin switches (3 coins, then 4). Heads is 1 and tails is 0. Put three coins in a row and write down the pattern, for example 101. Turn coins over to find every different pattern. Did you find 8? Then try four coins. Before you start, predict how many patterns there will be. Check by listing them in order. What do you notice when each extra coin is added?
Practice
1
Write the binary code for these lamps: on, off, off, on, on.
10011. On is 1 and off is 0.
2
How many patterns can 4 switches make? Show how you know.
16 patterns. 2 switches make 4, 3 switches make 8, and 4 switches make 8 × 2 = 16. Each switch doubles the number.
3
Why do computers use only two digits, 0 and 1, and not ten digits?
Their switches have only two states, on and off. A switch with many states would be hard to build and easy to get wrong.
4
Complete the list of all the patterns for 3 switches: 000, 001, 010, 011, ?, ?, ?, ?.