Bayes’ rule step by step
If you see the intimidating formula
and want to run — pause. We’ll unpack it. It’s common sense encoded as a fraction.
Bayes’ core idea
Section titled “Bayes’ core idea”Bayes answers:
I thought event A had some probability. Then I saw observation B. How should I revise my belief about A?
Here:
- A = “student mastered the skill”
- B = “student solved the problem correctly”
We want — probability of A given B.
Two boxes
Section titled “Two boxes”Imagine we don’t know whether the student knows the skill. Split learners into two boxes:
%%{init: {'theme': 'base','flowchart': {'nodeSpacing': 96,'rankSpacing': 108,'padding': 40,'curve': 'basis','useMaxWidth': true}}}%%
flowchart LR
Pop["Population (1.0)"]
Pop -->|"P(L)"| K[Knows skill]
Pop -->|"1 - P(L)"| NK[Doesn't know]
K -->|"1 - P(S)"| KR[Knows & correct]
K -->|"P(S)"| KW[Knows & wrong slip]
NK -->|"P(G)"| NKR[Doesn't know guessed right]
NK -->|"1 - P(G)"| NKW[Doesn't know wrong]
Plugging numbers:
- → 20% “know,” 80% “don’t know”;
- → among “know,” 90% answer correctly, 10% slip;
- → among “don’t know,” 20% guess right, 80% miss.
Four cells:
| Answers correctly | Answers incorrectly | |
|---|---|---|
| Knows () | ||
| Doesn’t know () | ||
| Total | 0.34 | 0.66 |
Cell probabilities sum to — full partition.
Conditioning on “answered correctly”
Section titled “Conditioning on “answered correctly””Observing “correct” restricts us to the correct column — mass 0.34.
What fraction of that mass are “knowers”?
That is Bayes — numerator “knows AND correct,” denominator “all correct.”
In symbols:
And for “incorrect”:
Numeric check
Section titled “Numeric check”Take , , . Student answers correctly.
Confidence jumps from 0.2 to ~0.529 — almost “toss-up, leaning knows.”
What if they answer incorrectly?
Confidence collapses toward zero.
Why one problem swings estimates so hard
Section titled “Why one problem swings estimates so hard”Note: with a mistake drops confidence from 0.2 to ~0.027 — ~8×. That’s correct:
We barely believed in them; they missed — exactly what we expected from a non-knower.
But at (already confident) one mistake only lowers to ~0.61 — treated mostly as slip. Check:
That’s calibrated updating.
Step 2: allow “learning during the attempt”
Section titled “Step 2: allow “learning during the attempt””After applying Bayes (the posterior) we add one small step:
Meaning:
Even if posterior says you didn’t know — you still had probability to learn during this problem.
With :
After an error:
Bottom line: all of BKT math
Section titled “Bottom line: all of BKT math”That’s it. The whole model.
// Step 1. Posterior via Bayes.posterior = correct ? (pL * (1 - pSlip)) / (pL * (1 - pSlip) + (1 - pL) * pGuess) : (pL * pSlip) / (pL * pSlip + (1 - pL) * (1 - pGuess));
// Step 2. Update accounting for possible learning.pL_new = posterior + (1 - posterior) * pTransit;Exactly this appears in web/lib/bkt.ts — function bktUpdate. See the code walk-through.
Try it: two boxes by hand
Section titled “Try it: two boxes by hand”All four cells of the 2×2 table on one square. Drag sliders and press correct/incorrect. Highlights show what mass “survives” the observation; the formula prints the posterior.
Same Bayes story as above — without algebra — you see which area matches the observation.
Next chapter — both formulas side by side; chapter 7 — full numeric walk-through across six tasks.