$\DeclareMathOperator{\p}{Pr}$ $\DeclareMathOperator{\P}{Pr}$ $\DeclareMathOperator{\c}{^C}$ $\DeclareMathOperator{\or}{ or}$ $\DeclareMathOperator{\and}{ and}$ $\DeclareMathOperator{\var}{Var}$ $\DeclareMathOperator{\E}{E}$ $\DeclareMathOperator{\std}{Std}$ $\DeclareMathOperator{\Ber}{Bern}$ $\DeclareMathOperator{\Bin}{Bin}$ $\DeclareMathOperator{\Poi}{Poi}$ $\DeclareMathOperator{\Uni}{Uni}$ $\DeclareMathOperator{\Exp}{Exp}$ $\DeclareMathOperator{\N}{N}$ $\DeclareMathOperator{\R}{\mathbb{R}}$ $\newcommand{\d}{\, d}$

CS109 Midterm Review
Thursday, October 22nd, 6:30pm–8:30pm, CEMEX Auditorium


Logistics

The midterm is on Thursday, October 22nd, from 6:30pm to 8:30pm, in CEMEX Auditorium. It is a closed book, closed calculator/computer exam. You are, however, allowed to bring 3 pages (front and back) of notes, written by hand with a pen or pencil (no iPad writing, please).

How to Use This Review

Topics: every major concept from the first half of the course, cross-referenced against fifteen past midterm exams posted on this site. The midterm covers Lectures 1–11 (through Inference).

How to use this page. This is not a problem set; it is a map. Work through the blocks below in order. Whenever a concept is something you are shaky on, go work the listed exam problems. Each entry names the exam, the problem number and title, and the specific parts that exercise that concept. Every exam code links straight to that exam's PDF; the Exam Index below has the solutions.

A note on coverage. A concept that shows up on ten or more of the fifteen midterms is a concept you will see again. Rows with long lists are the highest-yield material on the page. Rows with one or two entries are still fair game, but budget your time accordingly. Bold entries are the best single problem to start with for that row.

What You Do Not Need to Worry About

Because Inference (Lecture 11) is on this midterm, almost every problem on the old exams is fair game, including the Bayesian inference problems with continuous likelihoods and posterior belief distributions. The following topics are not on the midterm: covariance and correlation and Bayesian networks (Lecture 12), the Multinomial (Lecture 13), the Beta distribution (Lecture 14), sums of random variables and the Central Limit Theorem (Lecture 15), sampling and bootstrapping (Lecture 16), conditional expectation and the Law of Total Expectation (Lecture 17), and entropy and information theory (Lecture 18).

Only these problems (or parts) on the old midterms use that material. Skip them:

ExamProblemSkipWhy
Midterm 1 Summer 2026#5 Shot Speedpart (b)the sum of two independent Normals (adding random variables, Lecture 15). Part (c) is still fair game: compare the two events directly
Midterm 2 Summer 2026#1 Continuous Integrationparts (a, c, d, e)Bayesian networks and rejection sampling (Lecture 12). Part (b) is fair game: Law of Total Probability plus Bayes, using that $B$ and $F$ are independent
Midterm 2 Summer 2026#2 A Suspicious Cointhe whole problemBeta prior and posterior (Lecture 14) and entropy (Lecture 18)
Midterm 2 Summer 2026#3 Ride Sharingpart (c)the total of 100 independent Poissons, approximated (sums of random variables, Lecture 15)
Midterm 2 Summer 2026#4 A Delicate Pollparts (b, c, d)bootstrapping (Lecture 16). Part (a) is fair game: linearity of expectation
Midterm 2 Summer 2026#5 Load Balancingparts (a, c, e)the Multinomial (Lecture 13), entropy (Lecture 18), and the Law of Total Expectation (Lecture 17). Parts (b) and (d) are fair game
Midterm Fall 2025#2 Vibrant Variablespart (a)variance of a Beta posterior (Beta distribution, Lecture 14)
Midterm Fall 2025#4 Variance Reduction Samplingpart (d)distribution of a sample average (Central Limit Theorem, Lecture 15)
Midterm Spring 2016#4 Wind Energypart (c)needs the sum of two independent Normals (adding random variables, Lecture 15)
Midterm Fall 2017#6 Goodbye Integral (Monte Carlo Integration)the whole problemMonte Carlo integration is sampling-based estimation, which comes after the midterm

Everything else on all fifteen exams is fair game. Note that most of Summer 2026 Midterm 2 covered material after Inference, so only a few of its parts appear in the map below.

Answer Format

You are going to be solving probability questions by hand. To that extent we are not interested in numeric answers, but rather in formulaic answers. It is fine for your answers to include summations, products, factorials, exponentials, and combinations, unless the question specifically asks for a numeric quantity or closed form. You must show your work: describe the distributions and parameter values you used, where appropriate. You can leave your answer in terms of $\Phi$ (the CDF of the standard normal); for example $\Phi(\frac{3}{4})$ is a fine final answer. Older exams sometimes ask for a numeric value from a $\Phi$ table; you will not be asked to do that.


Block 1: Solving a CS109 Problem

ConceptMidterm exam problems
Translate the word problem into math first: name the random variable, give its distribution and parameters, then write the probability you want. This is usually the hardest step.Win25 #2 Vibrant Variables (a, b, c) (graded on exactly these steps); F24 #2 Chance Encounters (a–d) (declare the RV and state the question, without solving); F25 #2 Vibrant Variables (b, c); W22 #2 Midterm Theory; F22 #2 Down to Lunch (b)

Block 2: Counting

ConceptMidterm exam problems
The generative process; step (product) rule and sum rule; casework; counting the complementWin26 #2 Art Museum Security Code (a) (three different correct generative processes in the solution); Su26-1 #1 Starting Lineup (a, b); Spr19 #1 Enigma Machine (a, b); F17 #1 Alpha TicTacToe Zero (a, b); Spr17 #2 Secure Passwords (a); F18 #1 Random Writer (a); F21 #1 Color.com (a); F24 #3 Bingo! (a)
Connect new problems to old ones: permutations of distinct and indistinct objects, combinations, unordered pairs, treating a group as one objectW22 #3 Algorithmic Analysis; F22 #3 Random Edges (a, b); Spr17 #3 Shazam (a, b); Spr17 #1 Spotify (a, b, d); Spr16 #1 Card Game (a); Spr16 #2 Sampling a Median (a); F23 #2 GPT Generation (b)
When stuck: write out the outcomes, or reduce to a smaller version of the problemF21 #5 Longest Sequence of Heads (a–d) (small cases, then a recursion); Spr19 #1 Enigma Machine (b, last sub-part: any number of wires); F17 #1 Alpha TicTacToe Zero (c)
Probability with equally likely outcomes: $P(E) = |E| / |S|$F24 #3 Bingo! (b, c); Win26 #2 Art Museum Security Code (b); Win25 #4 Rival Production (a); F18 #1 Random Writer (b); Spr16 #1 Card Game (b, c); Spr16 #2 Sampling a Median (b); Spr17 #2 Secure Passwords (b); F21 #1 Color.com (b); W22 #1 Stanford Life (a)

Block 3: Core Probability

ConceptMidterm exam problems
Probability of “or” (mutually exclusive vs. inclusion–exclusion); complement; De Morgan's laws; chain ruleWin26 #2 Art Museum Security Code (b) (solved both with inclusion–exclusion and with De Morgan); Su26-1 #3 Team USA Goals (c); Su26-1 #5 Shot Speed (c) (compare two events: one implies the other); Spr17 #1 Spotify (c); F17 #5 Curse of Dimensionality (a, b, c); F18 #1 Random Writer (c); F21 #1 Color.com (b, c); F24 #1 Adventure is Out There (a); Win25 #1 What a Time to Be Alive (a); F25 #6 Random Molecules (a); F23 #2 GPT Generation (a) (chain rule); Win25 #6 The Large Language Model That Keeps on Trying (b, c) (chain rule)
Law of Total ProbabilityWin25 #1 What a Time to Be Alive (d); F24 #1 Adventure is Out There (b); Su26-1 #2 World Cup Penalty Kicks (b) (condition on Argentina's total); Su26-2 #1 Continuous Integration (b); W22 #2 Midterm Theory; F17 #4 Gaussian Mixture Model (c); F22 #5 Mixing up Gaussians (a); Spr19 #3 µ Girls (b); F25 #4 Variance Reduction Sampling (a); F25 #7 The Golden Coin; F18 #4 Traffic Light (a); Win26 #6 TicketWizard (c) (LOTP over a Poisson count)
Conditional probability (the sample space shrinks to $F$); $P(E \mid F) \neq P(F \mid E)$; Bayes' TheoremWin26 #3 Fraud Detection (a); F24 #1 Adventure is Out There (c); Su26-1 #4 Ticket Prices (c); Su26-2 #1 Continuous Integration (b); F18 #5 Drug Effectiveness (a); W22 #5 Binary Spoof (b); Spr17 #3 Shazam (e); F22 #1 Weather Prediction (a, b) (estimating conditional probabilities from data); Spr16 #1 Card Game (c); Spr16 #6 Ride Sharing (a)
Independence; independence $\neq$ mutual exclusionF22 #1 Weather Prediction (c) (how to test independence from estimated probabilities); W22 #1 Stanford Life (a); W22 #4 ASL Fingerspelling (b); F21 #2 Doodle Poll (b, c); Spr19 #3 µ Girls (c); F22 #4 Expressed Trait; Win26 #1 Literary Randomness (b); F23 #1 Measure of Variety (a, b, c)
Conditional independence: independent once you know a third event (the Naive Bayes pattern)Win26 #3 Fraud Detection (b); Spr16 #3 Netflix Tearjerker (a, b, c); Spr19 #4 Name2Age (b); F21 #3 I Heard That! (b); F25 #5 Outlier Detection for Code in Place

Block 4: Random Variables

ConceptMidterm exam problems
Random variables and their PMF/PDF; computing $P(X = x)$; new, custom PMFs and normalizing constantsF24 #4 The Driftwood Random Variable (a); F25 #1 Counting Rain Drops (b, c) (truncated Poisson); F21 #5 Longest Sequence of Heads (a, b); F22 #3 Random Edges (c); Win25 #3 Board Game Analysis (a); F21 #4 Sleep and Dreams (a); F25 #4 Variance Reduction Sampling (c)
Computing $P(X \le x)$: summing a PMF vs. using a CDFF25 #1 Counting Rain Drops (a); F24 #4 The Driftwood Random Variable (b); F22 #2 Down to Lunch (b); F21 #2 Doodle Poll (a); Spr16 #2 Sampling a Median (c); Win25 #1 What a Time to Be Alive (c)
Computing $P(X \ge x)$ and $P(a < X < b)$; continuous CDFs; getting any probability from a CDFWin26 #5 Footprints in the Caves of Lascaux (a); Spr19 #5 Grades are not Normal (a, b) (you are handed a CDF); Su26-1 #4 Ticket Prices (a, b) (the price is a function of $X$: turn it back into an event about $X$); Spr17 #5 Exponentials (a, b) (CDF of a max); Win26 #1 Literary Randomness (c); F18 #4 Traffic Light (a); F21 #3 I Heard That! (d); F21 #4 Sleep and Dreams (d); F17 #3 500 Year Floodplanes (b); Win25 #2 Vibrant Variables (b, c); Spr17 #4 Recaptcha (a)
Expectation and variance; linearity of expectation (including indicator variables); LOTUS; $\text{Var}(aX + b) = a^2\,\text{Var}(X)$Win25 #3 Board Game Analysis (b, c); F24 #4 The Driftwood Random Variable (c, d); Su26-2 #3 Ride Sharing (a, b); Su26-2 #4 A Delicate Poll (a); Su26-2 #5 Load Balancing (d); F18 #4 Traffic Light (b, c, d); Spr19 #2 Daycare.ai (b, c, d); F24 #1 Adventure is Out There (d); F22 #3 Random Edges (d); F21 #4 Sleep and Dreams (b); F25 #4 Variance Reduction Sampling (b, c); F25 #6 Random Molecules (b) (indicators); Win26 #4 Let There Be Light (c); Spr16 #6 Ride Sharing (b); Spr17 #2 Secure Passwords (c); F23 #1 Measure of Variety (d); F23 #2 GPT Generation (d); Spr16 #1 Card Game (d); F17 #3 500 Year Floodplanes (c)
Law of Total ExpectationNot on this midterm Law of Total Expectation is taught in Lecture 17 this quarter. No old midterm problem on this page needs it.

Block 5: Common Distributions

ConceptMidterm exam problems
Choosing the right distribution from the problem's conditionsWin26 #1 Literary Randomness (a, b, c) (Poisson, Normal, Exponential in consecutive parts); F24 #2 Chance Encounters (a–d); Win25 #2 Vibrant Variables (a, b, c); F25 #2 Vibrant Variables (b, c)
Binomial: fixed $n$, independent trials, same $p$Win26 #4 Let There Be Light (b); Su26-1 #2 World Cup Penalty Kicks (a, b) (two independent Binomials); Su26-2 #5 Load Balancing (b); F25 #6 Random Molecules (a); F21 #2 Doodle Poll (a); Spr19 #2 Daycare.ai (a); W22 #5 Binary Spoof (a); F22 #2 Down to Lunch (b); F17 #2 Wisdom of the Crowds (a, b, c); F24 #6 DNA Mutation Clock (b); F23 #3 Era's Tour by Ticketmaster (b); Spr16 #2 Sampling a Median (c); F25 #2 Vibrant Variables (b) (match a Normal back to a Binomial)
When $p$ differs per trial it is not a Binomial (sum over which trials succeed)W22 #7 Beyond the Binomial; Spr19 #2 Daycare.ai (e); F24 #2 Chance Encounters (c)
Approximating a Binomial: Poisson ($p$ small) or Normal ($p$ medium)Win26 #6 TicketWizard (a); F21 #1 Color.com (d) (Poisson approximation); Win25 #1 What a Time to Be Alive (b); F24 #2 Chance Encounters (d); F22 #6 Bayesian Viral Load Test (b); F17 #2 Wisdom of the Crowds (d); Spr16 #4 Wind Energy (b); F18 #6 Simulation Accuracy; F23 #3 Era's Tour by Ticketmaster (c); Win26 #4 Let There Be Light (b) (Poisson approximation also accepted); Spr17 #6 Eleven-eleven (c) (Normal approximation to a Poisson)
Continuity correctionWin26 #6 TicketWizard (a); Win25 #1 What a Time to Be Alive (b); F24 #2 Chance Encounters (d); F17 #2 Wisdom of the Crowds (d); Spr16 #4 Wind Energy (b); F23 #3 Era's Tour by Ticketmaster (c)
Geometric (trials until the first success) and Negative Binomial (trials until the $r$th success)F25 #7 The Golden Coin (a Geometric number of Binomial flips); F24 #2 Chance Encounters (a); Win25 #6 The Large Language Model That Keeps on Trying (a); Spr17 #2 Secure Passwords (c); F23 #2 GPT Generation (c); Spr16 #1 Card Game (d)
Poisson (count of events in an interval) vs. Exponential (time until the next event)F18 #2 Race Condition (a–d); F17 #3 500 Year Floodplanes (a–d); Su26-1 #3 Team USA Goals (a, b) (two games is one Poisson with twice the rate); Su26-1 #4 Ticket Prices (a, b, c) (memorylessness); Su26-2 #3 Ride Sharing (a, b); Win26 #1 Literary Randomness (a, c); Win26 #4 Let There Be Light (a); Win26 #6 TicketWizard (b); F25 #1 Counting Rain Drops (a); F25 #2 Vibrant Variables (c); Win25 #2 Vibrant Variables (a, b); Win25 #1 What a Time to Be Alive (c); F24 #2 Chance Encounters (b); F24 #6 DNA Mutation Clock (a); F23 #3 Era's Tour by Ticketmaster (a); F23 #1 Measure of Variety (c); F22 #2 Down to Lunch (a); F22 #4 Expressed Trait; W22 #1 Stanford Life (b); F21 #4 Sleep and Dreams (a, c, d); Spr19 #3 µ Girls (a); Spr17 #6 Eleven-eleven (a, b); Spr17 #5 Exponentials (a); Spr16 #6 Ride Sharing (a, c)
Uniform (discrete and continuous)F18 #4 Traffic Light (a, b, c) (a mixed discrete/continuous wait time); Win25 #2 Vibrant Variables (c); F17 #5 Curse of Dimensionality; Spr17 #4 Recaptcha (b); W22 #1 Stanford Life (a); F21 #4 Sleep and Dreams (d); F24 #5 True Random (c)
Normal: standardize, then use $\Phi$; inverse $\Phi^{-1}$F24 #5 True Random (a, b, c); Su26-1 #5 Shot Speed (a); Win26 #1 Literary Randomness (b); Win26 #5 Footprints in the Caves of Lascaux (a); Win25 #5 Accidental Caps-Lock Press (a); F23 #5 Auto Morse Code Detection (a); W22 #6 PSetApp Answer Checker (a); Spr19 #5 Grades are not Normal (a); F17 #4 Gaussian Mixture Model (a, b); Spr17 #4 Recaptcha (a); Spr16 #4 Wind Energy (a); F21 #3 I Heard That! (d); Spr17 #6 Eleven-eleven (d) (the probit function $\Phi^{-1}$)

Block 6: Joint Distributions

ConceptMidterm exam problems
Joint tables: everything sums to 1; marginalize by summing out; condition by normalizingF18 #3 Algorithmic Fairness (a–e) (the classic joint-table problem); F25 #4 Variance Reduction Sampling (a, c) (the joint of X and Y from code); W22 #4 ASL Fingerspelling (b); Spr17 #4 Recaptcha (b) (a joint uniform PDF)
Covariance and correlationNot on this midterm Covariance is taught in Lecture 12 this quarter. No old midterm problem on this page needs it.

Block 7: Inference

ConceptMidterm exam problems
The roadmap: prior, likelihood, posterior. Bayes' Theorem with the denominator expanded by the Law of Total Probability (discrete hypotheses, discrete observations)Win26 #3 Fraud Detection (a, b); F21 #3 I Heard That! (a, b) (a second observation: posterior becomes the new prior); Spr16 #3 Netflix Tearjerker (c); W22 #5 Binary Spoof (b); Spr17 #3 Shazam (e); F18 #5 Drug Effectiveness (a); F24 #1 Adventure is Out There (c)
Updating a whole belief distribution (a PMF stored as a dictionary or list): multiply prior by likelihood, then normalizeF25 #3 Word Identification (write the code); F23 #4 How Many Coin Flips? (math and pseudocode); Win25 #4 Rival Production (b, c); F24 #6 DNA Mutation Clock (c); F22 #6 Bayesian Viral Load Test (c); Spr19 #4 Name2Age (a, b); Win26 #5 Footprints in the Caves of Lascaux (b)
Continuous likelihoods: a PDF (Normal, Exponential, ...) plays the role of $P(\text{obs} \mid \text{hypothesis})$Win25 #5 Accidental Caps-Lock Press (b, c); F23 #5 Auto Morse Code Detection (b, c, d); F22 #5 Mixing up Gaussians (b); W22 #6 PSetApp Answer Checker (b); F21 #3 I Heard That! (c); F18 #5 Drug Effectiveness (b); F17 #4 Gaussian Mixture Model (d); Spr17 #4 Recaptcha (c); Spr19 #5 Grades are not Normal (d) (choosing between two models); F25 #5 Outlier Detection for Code in Place (two observations, Exponential and Normal likelihoods); Win26 #5 Footprints in the Caves of Lascaux (b)
A continuous prior: the posterior is a density over the unknown (same pattern as the Lecture 11 LiDAR example)Spr16 #5 Autonomous Car

Exam Index

Exams are listed newest first. The two Summer 2026 midterms were 75-minute exams; the others were two-hour exams, the same length as yours.

CodeExamProblemsSolutions
Su26-1Midterm 1 Summer 2026PDFSoln
Su26-2Midterm 2 Summer 2026PDFSoln
Win26Midterm Winter 2026PDFSoln
F25Midterm Fall 2025PDFSoln
Win25Midterm Winter 2025PDFSoln
F24Midterm Fall 2024PDFSoln
F23Midterm Fall 2023PDFSoln
F22Midterm Fall 2022PDFSoln
W22Midterm Winter 2022PDFSoln
F21Midterm Fall 2021PDFSoln
Spr19Midterm Spring 2019PDFSoln
F18Midterm Fall 2018PDFSoln
F17Midterm Fall 2017PDFSoln
Spr17Midterm Spring 2017PDFSoln
Spr16Midterm Spring 2016PDFSoln

Problem Titles by Exam

A quick lookup so you can find a problem without opening every PDF. Struck-through items are not on this midterm.

ExamProblems
Su26-11 Starting Lineup; 2 World Cup Penalty Kicks; 3 Team USA Goals; 4 Ticket Prices; 5 Shot Speed (skip part b)
Su26-21 Continuous Integration (skip parts a, c, d, e); 2 A Suspicious Coin (skip); 3 Ride Sharing (skip part c); 4 A Delicate Poll (skip parts b, c, d); 5 Load Balancing (skip parts a, c, e)
Win261 Literary Randomness; 2 Art Museum Security Code; 3 Fraud Detection; 4 Let There Be Light; 5 Footprints in the Caves of Lascaux; 6 TicketWizard
F251 Counting Rain Drops; 2 Vibrant Variables (skip part a); 3 Word Identification; 4 Variance Reduction Sampling (skip part d); 5 Outlier Detection for Code in Place; 6 Random Molecules; 7 The Golden Coin
Win251 What a Time to Be Alive; 2 Vibrant Variables; 3 Board Game Analysis; 4 Rival Production; 5 Accidental Caps-Lock Press; 6 The Large Language Model That Keeps on Trying
F241 Adventure is Out There; 2 Chance Encounters; 3 Bingo!; 4 The Driftwood Random Variable; 5 True Random; 6 DNA Mutation Clock
F231 Measure of Variety; 2 GPT Generation; 3 Era's Tour by Ticketmaster; 4 How Many Coin Flips?; 5 Auto Morse Code Detection
F221 Weather Prediction; 2 Down to Lunch; 3 Random Edges; 4 Expressed Trait; 5 Mixing up Gaussians; 6 Bayesian Viral Load Test
W221 Stanford Life; 2 Midterm Theory; 3 Algorithmic Analysis; 4 ASL Fingerspelling; 5 Binary Spoof; 6 PSetApp Answer Checker; 7 Beyond the Binomial
F211 Color.com; 2 Doodle Poll; 3 I Heard That!; 4 Sleep and Dreams; 5 Longest Sequence of Heads
Spr191 Enigma Machine; 2 Daycare.ai; 3 µ Girls; 4 Name2Age; 5 Grades are not Normal
F181 Random Writer; 2 Race Condition; 3 Algorithmic Fairness; 4 Traffic Light; 5 Drug Effectiveness; 6 Simulation Accuracy
F171 Alpha TicTacToe Zero; 2 Wisdom of the Crowds; 3 500 Year Floodplanes; 4 Gaussian Mixture Model; 5 Curse of Dimensionality; 6 Goodbye Integral (Monte Carlo Integration) (skip)
Spr171 Spotify; 2 Secure Passwords; 3 Shazam; 4 Recaptcha; 5 Exponentials; 6 Eleven-eleven
Spr161 Card Game; 2 Sampling a Median; 3 Netflix Tearjerker; 4 Wind Energy (skip part c); 5 Autonomous Car; 6 Ride Sharing

Extra Practice

Note: you should not expect that a TA will have prepared to answer these problems in office hours (there are far too many for them to prep them all). If you ask about one of these problems on Ed or in office hours, please be ready to give the full context.


Closing Observations

  1. Four topics appear on essentially every midterm: a counting problem, Poisson vs. Exponential, Normal probabilities with $\Phi$, and Bayes' Theorem / inference. If you are triaging, start there.
  2. Inference is the capstone of the first half of the course and is usually the highest-point problem on the exam. Practice the full pattern (prior, likelihood, Law of Total Probability in the denominator, normalize) with both a discrete likelihood and a continuous (PDF) likelihood.
  3. Work at least one recent two-hour exam (Winter 2026, Fall 2025, Winter 2025, or Fall 2024) under realistic, timed conditions before the midterm. Summer 2026 Midterm 1 makes a good shorter warm-up; everything on it except one part is fair game.
'