Pilot · L07 · 50 minutes
Representing information in bits
Read unsigned binary using place values, reason about what a fixed number of bits can store and what happens on overflow, and explain why sampled, rounded data approximates a continuous original and why every bit pattern needs an agreed interpretation.
Topics: 2.1 Binary Numbers
Goals and vocabulary
By the end you can:
- Explain that the same bits can mean different things and that a convention decides the meaning.
- Convert small unsigned binary values to decimal and back.
- Give the range of values a fixed number of bits can store and describe overflow under a stated convention.
- Explain how sampling and round-off make stored data an approximation of a continuous original.
- Predict the effect of adding one bit.
- Bit
- A single binary digit, 0 or 1.
- Place value
- The amount a position is worth; in binary each position is worth twice the one to its right.
- Overflow
- A result needs more bits than are available to store it.
- Sample
- A measurement of a continuous quantity taken at one moment.
- Round-off
- Storing the nearest value the bits allow instead of the exact value.
- Convention
- An agreed rule for what a bit pattern represents.
Bits mean nothing without a convention
A bit is a single 0 or 1. A row of bits is just a pattern until a convention says how to read it. The same eight bits can be a number, a letter, part of a colour or one sample of a sound, depending on what the program that stores and reads them has agreed.
| Bits | Read as an unsigned whole number | Read as a letter code (ASCII) | Read as a grey level from 0 (black) to 255 (white) |
|---|---|---|---|
| 01000001 | 65 | A | a dark grey |
Nothing in the bits themselves says which reading is right. If a program reads a file with the wrong convention, it gets nonsense, even though every bit is intact.
Positional binary: place values that double
In this lesson binary means unsigned whole numbers. Each position has a place value twice the one to its right: 1, 2, 4, 8, 16 and so on. To convert to decimal, add the place values of the positions that hold a 1.
| Place value | 8 | 4 | 2 | 1 |
|---|---|---|---|---|
| Bit | 1 | 1 | 0 | 1 |
| Contributes | 8 | 4 | 0 | 1 |
8 + 4 + 0 + 1 = 13. Going the other way, start with the largest place value that fits: 13 contains one 8 (leaving 5), one 4 (leaving 1), no 2 and one 1, so 13 is 1101. Leading zeros do not change the value: 001011 is 8 + 2 + 1 = 11.
A fixed number of bits limits the values
Real systems store numbers in a fixed number of bits. With n bits there are 2ⁿ different patterns, so an unsigned value can range from 0 to 2ⁿ − 1. Four bits give 16 patterns, from 0000 (0) to 1111 (15).
| Bits | Patterns | Range |
|---|---|---|
| 3 | 8 | 0 to 7 |
| 4 | 16 | 0 to 15 |
| 5 | 32 | 0 to 31 |
| 8 | 256 | 0 to 255 |
Adding one more bit doubles the number of patterns. It does not just add one more value.
Sampling continuous things
Some information is already discrete: a count of students, a letter. Other things, like a sound wave or a temperature through the day, vary continuously. To store them in bits, a program takes samples: it measures at regular moments and stores each measurement with a fixed number of bits.
- Between samples, the program has no data. Changes that happen between two samples can be missed.
- Each measurement is rounded to the nearest value the bits can store. This round-off means the stored value is close to, but not always exactly, the original.
- Sampling more often, or using more bits per sample, gives a closer approximation but uses more storage. It never makes the stored version identical to the continuous original.
Worked example: storing a fictional thermometer reading
Worked example
A fictional classroom sensor records the temperature once every hour and rounds each reading to the nearest whole degree and stores it in five bits (0 to 31).
| Time | Actual temperature | Stored value | Bits |
|---|---|---|---|
| 09:00 | 19.4 °C | 19 | 10011 |
| 10:00 | 21.6 °C | 22 | 10110 |
| 11:00 | 22.1 °C | 22 | 10110 |
- Round-off: 19.4 is stored as 19 and 21.6 as 22. The decimal part is lost.
- Sampling: if the heater briefly pushed the room to 25 °C at 10:30, the stored data would never show it.
- Width: a reading of 33 °C cannot be stored in five bits. Under this lesson’s convention the sensor reports an overflow error.
- Interpretation: 10110 means 22 °C only because the sensor’s documentation says “unsigned whole degrees”.
Explore each concept
Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.
- Analog versus digital
- Sample intervals and rounding
- Bits, bytes and conventions
- Fixed-width versus AP integer model
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- ExploresamplingWaiting
- Sampling interval1Waiting
- Stored precisionwholeWaiting
Ready to explore: Sampling, precision and bit interpretation
Why: Change an input, predict the first effect, then advance one step.
Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.
Step through and experiment
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Input 145Waiting
- Input 26Waiting
Ready to experiment
Why: Predict the first change, then advance one step.
Try this: Try 63 and 64, then change the width.
Common misconceptions
Bits carry their own meaning
The belief: 01000001 is always the letter A.
What is actually true: It is 65 as a number and A only under a letter-code convention. The reader must know the convention.
Check yourself: Which convention does the program reading this file use?
One more bit means one more value
The belief: Five bits can store one more value than four bits.
What is actually true: Each extra bit doubles the number of patterns: 16 becomes 32.
Check yourself: How many patterns do four bits give, and what happens when you double that?
Digital data is exact
The belief: A stored recording is identical to the real sound.
What is actually true: Sampling and round-off make it an approximation; more samples or bits get closer but never identical.
Check yourself: What happens between two samples?
Guided practice
Guided: four-bit cards
Use four cards labelled 8, 4, 2 and 1. A card face up is 1 and face down is 0.
Work in pairs. One partner calls a decimal number from 0 to 15; the other shows it with the cards and reads the bits aloud.
- Show 13 and write its bits.
- Show 6 and 9, then explain why their bits are each other’s opposite.
- Try to show 16. Explain what goes wrong, and state what this lesson’s overflow convention says happens.
- Add a fifth card. Write its place value and the new largest value.
Independent practice
Independent: the fictional sensor
Use the worked thermometer example.
- Convert 10011 and 10110 to decimal and check them against the table.
- Give the bits that would be stored for a reading of 26.7 °C, and explain the round-off.
- Explain why the 10:30 heater spike is missing from the stored data.
- Explain what happens to a reading of 33 °C and how many bits would be needed to store it.
Exit check
- Convert 10101 to decimal and show the place values you used.
- A program reads the bits 01000010 and shows the letter B. Another program reads the same bits and shows 66. Explain how both can be correct.
Check yourself
Practice only: answers are checked in your browser and nothing is saved or sent to your teacher. Each explanation links back to the section it practises.
Lesson practice
Your practice so far
Check an answer to see its rationale.
Apply it somewhere new
Your practice so far
Check an answer to see its rationale.