How did you come to school today?
The children in Ms Wanjiru's class in Nairobi, Kenya, have a job to do. Their head teacher wants to know whether the school needs a bigger bicycle rack and a safer place to cross the road.
"How can we find out?" asks Ms Wanjiru.
"Ask everybody how they came to school!" says Baraka.
So the class asks one question: How did you come to school today? Every child gives one answer: walking, by bus, by bike or by car. The answers they collect are called data. But a long list of answers is hard to understand. How can the class turn it into something that tells a clear story?
Ask, sort, count, show
Finding things out with data has four steps.
- Ask a clear question that has a few possible answers.
- Sort the answers into groups called categories — here: walk, bus, bike and car. Each answer goes into exactly one category.
- Count the answers in each category. Tally marks help.
- Show the counts in a picture, so everyone can see the story at a glance.
Here are the 24 answers, in the order the children were asked:
🚶 🚌 🚶 🚗 🚲 🚶 🚌 🚶 🚲 🚌 🚶 🚗 🚶 🚌 🚲 🚶 🚌 🚶 🚲 🚌 🚗 🚶 🚌 🚲
Can you tell which is most common just by looking? It's hard! Let's sort and count.
Big ideas
Definition— data
Data are pieces of information collected to answer a question.
Definition— category
A category is one of the groups we sort the answers into. For a simple survey, every answer goes into exactly one category.
Definition— tally mark
A tally mark is one stroke that records one answer. Tally marks are grouped in fives: four strokes, then a fifth stroke across them, like a little gate. Groups of five are quick to count: five, ten, fifteen, …
Definition— picture graph
A picture graph shows each category as a row (or column) of pictures. Each picture stands for one answer — or for a fixed number of answers, which the key tells you. All the pictures are the same size and evenly spaced. A block graph is the same idea with blocks or squares instead of pictures.
Let's make a graph together
Example— Tally marks
Go through the answers one at a time. For each answer, draw one mark in its row. Every fifth mark goes across the four before it.
When every answer has been marked, count each row in fives and then count on the loose marks. Ms Wanjiru's class got:
| How we came | Tally | Number |
|---|---|---|
| Walk 🚶 | one gate and 4 marks | 9 |
| Bus 🚌 | one gate and 2 marks | 7 |
| Bike 🚲 | one gate | 5 |
| Car 🚗 | 3 marks | 3 |
Example— Do the totals add up?
There are 24 children in the class. Add the numbers: . The totals add up to the number of children asked. That is a good check: if the totals came to 23 or 25, we would know that an answer had been missed or counted twice.
Example— Reading the graph
Look at the graph below and answer the questions.
- Which is most? Walking: 9 children. Which is fewest? Car: 3 children.
- How many more children walk than come by bus? Pair them up: 7 walkers have a bus partner, and 2 do not. So more walk.
- How many altogether come on wheels (bus, bike or car)? .
So the head teacher learns that 5 children come by bike — enough for a small rack now, with room to grow — and that 9 children walk, so a safe crossing really matters.
Example— When one picture stands for two
Sometimes there are so many answers that one picture for each would make very long rows. Then the key says what one picture means. In this picture graph of library books borrowed by a class in Lima, Peru, one picture stands for 2 books, so half a picture means 1 book. Switch to the bar graph to check your reading.
Library books borrowed
Show the same data as tallies, pictures, bars or dots, and find the mean, median and mode.
Each whole picture stands for 2.
Part of a picture stands for part of 2: half a picture is half of 2.
Explore the class data
Here is Ms Wanjiru's class data. Start with the tally chart, then switch to the picture graph (pictograph) and the bar graph (block graph). They are three pictures of the same numbers. Which one shows "which is most" most quickly?
Press Change the data to make up your own class. Try making two categories the same size. What happens to the total when you add one more child?
How did you come to school today?
Show the same data as tallies, pictures, bars or dots, and find the mean, median and mode.
| Category | Tally | Frequency |
|---|---|---|
| Walk | 9 | |
| Bus | 7 | |
| Bike | 5 | |
| Car | 3 |
Two rules for honest graphs
Rule 1: each answer goes into exactly one category. Then, when we count each category and add the counts, every child is counted once — never forgotten, never twice. That is why the totals add up to the number of children.
What if the question were "Which fruits do you like?" and a child said "mango and papaya"? That child would be counted in two categories. Then the totals add up to more than the number of children. That's not wrong, but you must not expect the totals to add up. A question like "What is your favourite fruit?" gives one answer per child.
Rule 2: pictures must be the same size and evenly spaced. We often compare rows by looking at how long they are. That only works if every picture takes up the same amount of room.
Gideon's true-or-false game
Gideon looks at Ms Wanjiru's data. True or false?
- "More children walk than come by bike." — True. 9 is more than 5.
- "The four numbers add up to 24, the number of children." — True. .
- "No category is bigger than walking." — True. Check each one: bus 7, bike 5, car 3 are all less than 9.
- "If children may choose two fruits they like, the fruit totals always add up to the number of children." — False! A child who chooses two fruits is counted twice.
For grown-ups · the survey, checked by Lean
In Lean the class's answers are a list, one entry per child:
/-- The answers of the 24 children in Ms Wanjiru's class, in the order they were asked. -/
def answers : List Way :=
[.walk, .bus, .walk, .car, .bike, .walk, .bus, .walk, .bike, .bus, .walk, .car,
.walk, .bus, .bike, .walk, .bus, .walk, .bike, .bus, .car, .walk, .bus, .bike]The tally for a category is the number of answers in it:
/-- The tally for category `w`: how many answers in the list are `w`. -/
def tally (w : Way) (l : List Way) : Nat := l.count wLean counts each category itself and confirms the tallies, the "most" and the "how many more" answers:
/-- The class's tallies: 9 walk, 7 come by bus, 5 by bike and 3 by car — 24 answers in all.
`decide` makes Lean count every category itself. -/
theorem class_tallies :
tally .walk answers = 9 ∧ tally .bus answers = 7 ∧ tally .bike answers = 5 ∧
tally .car answers = 3 ∧ answers.length = 24 := by
decide/-- Walking is the most common answer: no category has a bigger tally. We check each of the
four categories in turn. -/
theorem walk_is_most : ∀ w : Way, tally w answers ≤ tally .walk answers := by
intro w
cases w <;> decide/-- "How many more children walk than come by bus?" Two more: `9 − 7 = 2`. -/
theorem how_many_more : tally .walk answers - tally .bus answers = 2 := by decideThe important theorem is about every possible list of answers, not just this class: the four tallies always add up to the number of answers. The proof is by induction — one more answer adds one mark to exactly one tally.
/-- **The totals add up.** For *every* list of answers, the four tallies add up to the number of
answers. Proof by induction on the list: one more answer adds one mark to the tally of its own
category and none to the others, so both sides grow by one. -/
theorem totals_add_up (l : List Way) :
tally .walk l + tally .bus l + tally .bike l + tally .car l = l.length := by
induction l with
| nil => rfl
| cons w rest ih =>
unfold tally at ih ⊢
-- Look at which category the new answer `w` is in; `simp` uses `List.count_cons`.
cases w <;> simp <;> omegaCounting tallies by fives is division with remainder:
/-- Counting a tally by fives, then counting on the loose marks, always gives the number of
marks: `5 × gates + loose = n`. This applies core Lean's `Nat.div_add_mod`. -/
theorem tally_in_fives (n : Nat) : 5 * gates n + loose n = n := Nat.div_add_mod n 5/-- A tally of 9 is one gate of five and four loose marks. -/
theorem nine_in_fives : gates 9 = 1 ∧ loose 9 = 4 := ⟨rfl, rfl⟩And when children may choose several fruits, the totals can exceed the number of children:
/-- Four children's answers. The second and fourth child each chose two fruits. -/
def likes : List (List Fruit) := [[.mango], [.banana, .mango], [.papaya], [.mango, .papaya]]/-- With several answers allowed, the totals no longer add up to the number of children: the
three totals are 3, 1 and 2, which make 6, but only 4 children were asked. -/
theorem likes_overcount :
likers .mango likes + likers .banana likes + likers .papaya likes = 6 ∧ likes.length = 4 := by
decideWhat is formalised: the counting facts about these surveys, and the "totals add up" theorem for every survey with these four categories. What a graph looks like (picture sizes and spacing) is about perception, and is not something Lean checks.
Margaret's survey machine
Margaret also asked the computer to try every way that 6 children could answer a question with 4 categories — 4,096 different surveys. In every one, the totals added up to 6.
For grown-ups · Margaret's program
The program draws a gate of five as ||||\ (four strokes and a slanting one). Press Run to try it in your browser. The checks are exact, and the "every survey" check covers six children and four categories only; the reason the totals always add up is Rule 1 above, proved for every survey in the Lean section.
"""A class survey: tallies, a picture graph, and when totals add up.
Twenty-four children answer "How did you come to school today?". We sort
the answers into categories, draw a tally chart (a gate of five is drawn as
||||\\) and a picture graph, and answer "which is most?" and "how many
more?". Then we show two things that can go wrong: pictures of different
sizes make row lengths misleading, and letting a child choose two answers
makes the totals add up to more than the number of children. Finally we
check every possible way six children could answer a four-category question:
the totals always add up to six.
All counts are exact. The exhaustive check covers six children and four
categories only; the lesson explains why the totals add up for any survey in
which each answer goes into exactly one category.
Runs unchanged in the browser (Pyodide) using only the standard library.
"""
from itertools import product
import textwrap
CATEGORIES = ("walk", "bus", "bike", "car")
#: The class's answers, in the order the children were asked.
ANSWERS = (
"walk", "bus", "walk", "car", "bike", "walk", "bus", "walk",
"bike", "bus", "walk", "car", "walk", "bus", "bike", "walk",
"bus", "walk", "bike", "bus", "car", "walk", "bus", "bike",
)
#: Fruits four children like, when several answers are allowed.
LIKES = (("mango",), ("banana", "mango"), ("papaya",), ("mango", "papaya"))
GATE = "||||\\"
def tally(answers, categories=CATEGORIES):
"""Count the answers in each category, keeping the categories' order.
Every answer must belong to exactly one category, so an answer that is
not one of the categories is an error.
"""
counts = {c: 0 for c in categories}
for answer in answers:
if answer not in counts:
raise ValueError(f"answer {answer!r} is not one of the categories")
counts[answer] += 1
return counts
def tally_marks(n):
"""Draw n tally marks, grouped in gates of five."""
if n < 0:
raise ValueError("cannot draw a negative number of marks")
gates, loose = divmod(n, 5)
return " ".join([GATE] * gates + (["|" * loose] if loose else []))
def marks_to_number(marks):
"""Read a tally drawn by tally_marks: five per gate, one per loose mark."""
return sum(5 if group == GATE else len(group) for group in marks.split())
def picture_row(n, picture="o"):
"""A row of n equal pictures, separated by single spaces."""
return " ".join([picture] * n)
def most_and_fewest(counts):
"""The categories with the largest and with the smallest count."""
top, low = max(counts.values()), min(counts.values())
return ([c for c, n in counts.items() if n == top],
[c for c, n in counts.items() if n == low])
def every_survey_adds_up(children, categories=CATEGORIES):
"""Check every possible survey of ``children`` children.
Returns (surveys checked, True if the totals always equal ``children``).
"""
checked, ok = 0, True
for survey in product(categories, repeat=children):
checked += 1
ok = ok and sum(tally(survey, categories).values()) == children
return checked, ok
def multi_choice_totals(choices, options):
"""Totals when each child may choose several options."""
return {o: sum(o in chosen for chosen in choices) for o in options}
def main():
counts = tally(ANSWERS)
print(f'Survey: "How did you come to school today?" ({len(ANSWERS)} '
"children)")
print("Tally chart:")
for cat, n in counts.items():
print(f" {cat:<5} {tally_marks(n):<12} {n:>2}")
print("Picture graph (one o = one child):")
for cat, n in counts.items():
print(f" {cat:<5} {picture_row(n)}")
most, fewest = most_and_fewest(counts)
print(f"Most: {', '.join(most)}. Fewest: {', '.join(fewest)}. "
f"Walk compared with bus: {counts['walk'] - counts['bus']} more walk.")
parts = " + ".join(str(n) for n in counts.values())
print(f"Totals: {parts} = {sum(counts.values())}, "
f"the number of children asked.")
print()
print("Same data, unequal pictures (car drawn wider):")
rows = [("bike", picture_row(counts["bike"])),
("car", picture_row(counts["car"], "[car]"))]
for cat, row in rows:
print(f" {cat:<5} {row:<18} count {counts[cat]}, "
f"row length {len(row)}")
print(" The car row is longer, but more children came by bike.")
print()
checked, ok = every_survey_adds_up(6)
print(f"Every way 6 children can answer: {checked:,} surveys, "
f"totals always 6: {ok}")
totals = multi_choice_totals(LIKES, ("mango", "banana", "papaya"))
listed = ", ".join(f"{f} {n}" for f, n in totals.items())
print(f"Fruits liked, several answers allowed: {listed}")
print(f" totals {sum(totals.values())}, but only {len(LIKES)} children "
"were asked: some were counted twice.")
print()
print(textwrap.fill(
"Epistemic status: all counts are exact. The check that totals add up "
f"covers all {checked:,} surveys of six children with four categories, "
"and nothing else; why the totals add up whenever each answer goes "
"into exactly one category is explained (and proved in Lean) in the "
"lesson.",
width=78,
))
if __name__ == "__main__":
main()Your turn
Read each question carefully. Tally marks and pairing are your friends!
1. Data, tallies and picture graphs
Warm-upHumanA tally shows one gate (four strokes with a fifth stroke across them) and 3 more strokes. How many answers does it show?
2. Data, tallies and picture graphs
Warm-upHumanA class made a picture graph of their favourite fruits. Each picture is one child, and all the pictures are the same size.
- Mango: 🥭🥭🥭🥭🥭🥭
- Banana: 🍌🍌🍌🍌
- Orange: 🍊🍊🍊🍊🍊🍊🍊
- Apple: 🍎🍎🍎
Which fruit is the most popular?
3. Data, tallies and picture graphs
CoreHumanUse the fruit graph: orange 7, banana 4. How many more children chose orange than banana?
4. Data, tallies and picture graphs
CoreHumanUse the fruit graph again: mango 6, banana 4, orange 7, apple 3. Every child chose exactly one favourite fruit. How many children were asked?
5. Data, tallies and picture graphs
CoreHumanBaraka wants a survey question where every child gives exactly one answer, so the totals add up to the number of children. Which question should he ask?
6. Data, tallies and picture graphs
CoreHuman24 children each gave one answer. But when the class added up their tallies, the total was 26. What probably went wrong?
7. Data, tallies and picture graphs
CoreHumanIn a pet picture graph, the dog row has 4 big dog pictures 🐕 and the cat row has 6 small cat pictures 🐈. The dog row is longer. Which pet did more children choose?
8. Data, tallies and picture graphs
StretchHumanIn a picture graph of favourite sports, the key says one ⭐ stands for 2 children. The football row has ⭐⭐⭐⭐. How many children chose football?
9. Data, tallies and picture graphs
StretchFormalGideon's game: true or false? "If every child gives exactly one answer, and every answer goes into exactly one category, then the category totals add up to the number of children."
10. Data, tallies and picture graphs
StretchComputationalMargaret's program draws a gate of five as ||||\. It printed this tally:
||||\ ||||\ ||
How many answers does the tally show?
Things that trip people up
Misconception
"The longest row has the most." Only if the pictures are all the same size and evenly spaced. Big pictures make a short row look long. Count the pictures, or check that the graph is fair.
Misconception
"I'll put this answer in both groups." In a simple survey each answer goes into exactly one category. If an answer is counted twice, the totals no longer add up to the number of people asked.
Misconception
"A tally gate is one mark." The gate — four strokes with a fifth across them — stands for five answers. Count gates as five, ten, fifteen, and then count on the loose marks.
Misconception
"Our graph tells us about everybody." Our survey tells us about the children we asked — this class, on this day. Another class, or the same class on a rainy day, might give different answers.
For grown-ups: where data leads
Set theory— Sorting is a partition
Sorting answers so that each lands in exactly one category is a partition of the set of answers into disjoint blocks, and "the totals add up" is the addition principle: if with the pairwise disjoint, then . When categories overlap (several answers allowed), the sum of the totals counts each person once for every category they are in, and correcting for overlaps leads to inclusion–exclusion: . See sets and equivalence relations and partitions.
Probability— From counts to distributions
Dividing each count by the total turns a tally into relative frequencies — here , , and — the empirical distribution of a categorical variable. Asking a different class, or the same class on another day, gives different counts: that variability is where statistics begins. Later lessons summarise data by averages and spread, compare samples, and ask how far a sample tells us about a larger population. See data displays and the mean and statistics: centre, spread and distributions.
Counting and showing, around the world
- For centuries the English treasury recorded payments on tally sticks: notches cut in a stick that was then split in two, so that each side kept a matching half. They were used until 1826, and burning the old sticks in 1834 started the fire that destroyed the old Palace of Westminster in London.
- In China, Japan and Korea, people often tally with the character 正, which takes exactly five strokes to write — a tally gate of its own. In some other countries people draw a square and then a diagonal: five strokes again.
- The Inca of the Andes recorded counts of people, animals and goods on knotted cords called khipu.
- The Scottish engineer William Playfair published some of the first bar charts in 1786.
- In Vienna in the 1920s and 1930s, Otto Neurath, Marie Neurath and the artist Gerd Arntz designed picture graphs called Isotype. Their key rule is the one in this lesson: show a bigger number with more pictures, never with bigger pictures.
- For the 1900 World's Fair in Paris, the American scholar W. E. B. Du Bois and his students at Atlanta University made beautiful hand-drawn charts showing the lives and achievements of African Americans.
For grown-ups: further reading
- Otto Neurath, International Picture Language (1936) — the ideas behind Isotype picture graphs.
- Marie Neurath and Robin Kinross, The Transformer: Principles of Making Isotype Charts (2009).
- Edward R. Tufte, The Visual Display of Quantitative Information (1983) — a classic on honest and dishonest graphs.
- Susan N. Friel, Frances R. Curcio and George W. Bright, "Making sense of graphs: critical factors influencing comprehension and instructional implications", Journal for Research in Mathematics Education 32 (2001) — how children learn to read graphs.