Probability for Computer Scientists
The math of uncertainty: how to reason about randomness, which is what every AI system ultimately does.
AI tutor is turned off for this class
Use the CS109 lectures, notes, and assignments below to keep learning.
Big Idea
Learning
Grade bands
K-2 · 3-5 · 6-8 · 9-12
AI literacy pillar
How AI works · Ethics
Lesson overview
The math of uncertainty: how to reason about randomness, which is what every AI system ultimately does. This module climbs from an everyday intuition to the real mechanism, then names the Stanford course it descends from.
Teacher script · ~45 min
- 0–5
Hook
Probability sounds mystical but starts as counting: a fair die has 6 faces, so each has a 1-in-6 chance. The probability of something is just 'ways it can happen' divided by 'ways anything can happen.' Most confusion disappears once you carefully count both.
- 5–15
Explore
Students do the activity in pairs: A test is 99% accurate for a rare disease (1 in 10,000). You test positive. Are you likely sick? (Surprisingly, no; work out why with counts.)
- 15–30
Explain
A 'random variable' is a number whose value is uncertain: a dice roll, tomorrow's downloads. A distribution describes how its outcomes spread out. A few shapes (uniform, binomial, normal) describe an astonishing amount of the world, and knowing their mean and variance lets you predict and bound behavior.
- 30–40
Connect to the summit
Show students this is the real thing professionals build: CS109, the real thing. The math of uncertainty: how to reason about randomness, which is what every AI system ultimately does.
- 40–45
Check
Run the formative check below. Anyone who can explain a key term in their own words has it.
Student activity
A test is 99% accurate for a rare disease (1 in 10,000). You test positive. Are you likely sick? (Surprisingly, no; work out why with counts.)
Slides
Formative check
- 1.In your own words, what is "Conditional probability"? (Looking for: The chance of A given that you already know B happened.)
- 2.In your own words, what is "Bayes' rule"? (Looking for: The exact formula for updating a belief after seeing new evidence.)
- 3.In your own words, what is "Random variable"? (Looking for: A numeric outcome that's uncertain until observed, like a dice roll.)
Carry-away concepts
- Conditional probability
- The chance of A given that you already know B happened.
- Bayes' rule
- The exact formula for updating a belief after seeing new evidence.
- Random variable
- A numeric outcome that's uncertain until observed, like a dice roll.
- Expectation
- The long-run average value of a random variable.
From the summit · the Stanford source
You master probability from counting through random variables, distributions, and Bayesian inference, then apply it to machine learning.
This module descends from CS109 at Stanford. Students who climb the full ladder arrive here.
