Visual walkthrough — Epsilon-greedy strategy
We are inside a multi-armed bandit problem: several levers, each pays out coins, and you don't know which lever is best. Let's start there.
Step 1 — What a bandit even is
WHAT. Picture slot machines (we say "arms"). Pulling arm number spits out a random number of coins. We call one number of coins a reward, written .
WHY start here. Every symbol later (, , ) is a statement about rewards. If reward is fuzzy, everything downstream is fuzzy. So we nail it first.
PICTURE. Below: three arms. Each has a hidden coin-cloud — the spread of rewards it could give. The dashed vertical line is the arm's true average payout.

In the figure the true values are , , . Arm is best. You cannot see these dashed lines. You only see coins.
Step 2 — Guessing the true value: the estimate
WHAT. Since you can't see , you estimate it: pull arm a bunch of times, average what came out. That running average is .
WHY average. If each pull is a noisy sample of the same hidden mean, averaging cancels the noise — this is the same idea as why more samples give steadier estimates. One coin lies; a hundred coins tell the truth.
PICTURE. Watch (the estimate, orange) bounce around wildly with 2 pulls, then settle onto the true dashed line as pulls pile up.

Key fact, straight from the picture: as grows, . But only for arms you actually keep pulling. An arm you abandon freezes its at a bad guess. Hold that thought.
Step 3 — Why pure greedy walks into a trap
WHAT. The "greedy" rule: always pull whichever arm has the biggest right now. means "the arm that maximises " — it returns the arm, not the value.
WHY it fails. Suppose your very first pulls were unlucky on the truly-best arm and lucky on a mediocre arm. Greedy locks onto the mediocre arm, never pulls the good one again, so its frozen never gets corrected. You are trapped.
PICTURE. Two timelines. Top (greedy): a lucky early sample on makes look best, greedy stays on forever, (truly best) is abandoned with a stale low estimate — red X. Bottom (what we want): keep sampling , its estimate climbs to the truth.

The fix must force every arm to keep getting pulled. Enter .
Step 4 — The biased coin: introducing
WHAT. Before each pull, flip a biased coin. With probability we ignore all our estimates and pick an arm uniformly at random (explore). With probability we do the greedy thing (exploit).
WHY a coin. We want mostly smart choices but a guaranteed trickle of random tries so no arm is ever fully abandoned. A biased coin is the simplest gadget that mixes "mostly A, sometimes B" in a controllable ratio.
PICTURE. A probability bar of total length 1, split into a big "exploit" chunk and a thin "explore" chunk. The explore chunk is then sliced into equal slivers — one per arm.

Step 5 — The probability of picking any one arm
WHAT. Let's compute the exact chance a given arm gets pulled on this step. There are only two ways an arm gets chosen, and they can't both happen on the same flip:
- We explored (chance ) and the random draw landed on this arm (chance ). Combined: .
- We exploited (chance ) and this arm is the current estimated-best.
WHY multiply then add. "Explore AND land here" → the two conditions must both hold → multiply. "Exploit-path OR explore-path" → mutually exclusive routes to the same arm → add. That is all the probability we use.
PICTURE. A tree: root splits into explore () and exploit (); explore fans into equal twigs each worth ; exploit points at the single best-looking arm. The chosen arm collects contributions from the twigs it touches.

Because every arm keeps its trickle forever, for all , so by Step 2 every . The estimates become correct.
Step 6 — What converges, and what does NOT
WHAT. Once estimates are correct, the estimated-best arm equals the truly-best arm . Plug into Step 5's formula: its indicator is now , so
WHY this is not 1. Even with perfect knowledge, on every explore-flip we might randomly pick a bad arm. That thin sliver never closes. So the estimates converge, but the policy never becomes perfect — it keeps making the same small mistake forever.
PICTURE. Two curves vs. time. The estimate error (violet) sinks to zero. The policy's chance of the optimal arm (magenta) rises and then flatlines at — a permanent ceiling below 1, drawn as a dashed orange line.

For our 3-arm example with , : So even a perfect -greedy learner pulls the best arm only 93.3% of the time. This gap is the topic of exploration vs exploitation, and the reason UCB and Thompson sampling exist.
Step 7 — The permanent price: expected regret
WHAT. Each time you pull a worse arm , you forfeit some reward compared to the best arm. That shortfall is the gap . The average shortfall per step, once estimates are good, is
WHY it never hits zero. Each suboptimal arm keeps its pull-rate forever (Step 5), and each such pull costs . Fixed ⇒ permanent, non-zero cost.
PICTURE. Bars for : bar height = , bar width = ; the coloured area of each bar is its per-step regret. Their total area is .

Plugging numbers (, , each with prob ): Over 1000 steps that's a cumulative regret of ≈200 reward — the tax you pay to never be trapped. To lower it you must decay (next step), which is exactly the tuning Q-learning agents do.
Step 8 — The degenerate and edge cases
WHAT. Let's stress-test the formula at its extremes so no scenario surprises you.
| Case | What happens | From the formula | |
|---|---|---|---|
| Pure greedy | Can get trapped (Step 3); is or depending on luck | ||
| Pure random | Ignores learning; every arm equally likely | ||
| One arm () | any | Nothing to explore; forced choice | |
| Tie in | any | picks one (implementation's choice) — break ties randomly! | exploit mass goes to the chosen one |
| Decaying | Policy does converge to greedy, regret | ceiling |
WHY decay fixes the ceiling. As , the explore sliver and , so : the ceiling rises to the top. The rule is with (explore hard early), near (slow fade), and a floor kept small-but-positive if the world can change (non-stationary settings).
PICTURE. Three -vs-time curves: fixed (flat), pure decay to (drops through the floor), and floored decay (levels off at ).

The one-picture summary
Everything at once: the biased coin splits each step into explore/exploit; exploit picks the tall bar; explore sprinkles onto every bar; the estimates climb to the true dashed lines; and the leftover -sliver on bad arms is the permanent regret area.

Recall Feynman retelling — say it back in plain words
We've got a row of slot machines and no idea which one is best. Each machine has a true average payout we can never see (Step 1), so we guess it by averaging the coins we've collected from it (Step 2). Trouble: if we always chase our current-best guess, one lucky early spin can fool us and we quit trying the real winner forever (Step 3). Cure: before every spin we flip a lopsided coin — nine times in ten do the smart thing, one time in ten pick a machine at random (Step 4). That random trickle guarantees every machine keeps getting sampled, so every guess eventually snaps onto its true value. Working out the exact chance of picking a machine is just "explore-and-land-here plus exploit-if-it-looks-best" (Step 5). The happy news: our guesses become correct. The catch: because that one-in-ten random flip never stops, we still pick a dud sometimes, so we're right only 93.3% of the time — and each dud pull costs us the gap between it and the best, adding up to a steady, unavoidable "regret tax" (Steps 6–7). Push to zero over time and that tax fades to nothing (Step 8). That's -greedy, whole.
Recall
Why is and not just ? ::: Because on an explore-flip you can still randomly land on the best arm; that adds an extra on top of the exploit mass. With , how often does a perfect learner pick the best arm? ::: , i.e. 93.3%. What single change makes the policy (not just the estimates) converge to optimal? ::: Decay over time. Why does fixed- regret never reach zero? ::: Every suboptimal arm keeps a permanent pull-rate, and each such pull costs .