This page assumes you have never seen the symbols in the parent Monte Carlo note. We will build every letter, subscript, and Greek symbol from the ground up, in an order where each new idea stands on the one before it. By the end you will be able to read the parent note line by line without stopping.
A quick note on how figures are named: each picture on this page is tagged s01, s02, s03 in the order it appears. When the text says "look at figure s01", it means the first embedded picture, and so on — the little tag matches the file name so you never lose track of which drawing we mean.
Before any letter, picture the thing Monte Carlo methods live inside.
An episode is one complete run of a task from a start to a finish. A chess game from first move to checkmate. One hand of blackjack from deal to payout. One walk through a maze from entrance to exit.
Look at the picture above (figure s01). Time flows left to right. At each moment you are in some situation (a circle), you do something (an arrow), and you get a number back (a reward). Then the world moves you to the next situation. The chain ends — that is the crucial word. Monte Carlo only works when the chain ends, because we need to reach the finish before we can look back and add up what happened.
Everything below is just names for the parts of that picture.
Plain words:S stands for "State". The little t below it (a subscript) is a clock reading — S0 is where you start, S1 is where you are one step later, and so on.
The picture: each circle in figure s01. In blackjack a state might be (player total 19, dealer shows 2, no usable ace). In a maze it is which room you stand in.
Why the topic needs it: Monte Carlo estimates "how good is this state?" — so it must be able to point at "this state" with a name. St is that name.
Plain words:A for "Action", subscript t = which step. A0 is your first move.
The picture: the labelled arrows in figure s01 (hit, stick, right, down).
Random variable too: like St, the action At can vary run to run (especially when the policy chooses randomly), so it is also a random variable filled in by chance each episode.
Why needed: the control half of Monte Carlo has to compare actions to find the best one. No actions, nothing to improve.
The picture: the numbers floating above each arrow in figure s01 (0, 0, +1, -1).
Also a random variable: the same action in the same state can yield different rewards on different runs, so Rt+1 is random too.
Why needed: rewards are the only feedback we get. Monte Carlo has no rulebook, no map — just this trickle of numbers. Everything we learn is built by adding these up.
Plain words: a plain capital T = "Terminal". If a maze run takes 6 moves, then T=6.
The picture: the double circle on the far right of figure s01.
Why needed: Monte Carlo must reachT before it can compute anything — that is the whole "wait until the end, then look back" idea. This is exactly why MC only works on tasks that terminate.
Now the first Greek letter. It is pronounced "gamma" and drawn γ.
Look at figure s02. Each bar is the weightγk applied to a reward that is k steps away. When γ=0.9 the bars fade slowly — the far future still matters. When γ=0.5 they collapse fast — you barely care about anything distant.
Reading the extremes:γ=0 means "I only care about the very next reward" (myopic — near-sighted). γ→1 (gamma creeping toward one) means "a reward 100 steps away is almost as precious as one right now" (far-sighted).
The superscript γk: this just means "γ multiplied by itself k times". γ0=1 (no shrink), γ1=γ, γ2=γ×γ, and so on. Since γ≤1, each power is smaller than the last — that is the shrinking you see in s02.
There is a beautiful shortcut. Factor γ out of everything except the first term:
Gt=Rt+1+γ(this is exactly Gt+1Rt+2+γRt+3+⋯)
The bracket is the return starting one step later, which is Gt+1. So:
Gt=Rt+1+γGt+1,GT=0
Read figure s03 right-to-left: the sweep begins at the terminal circle where GT=0, and at each earlier state we stack "my reward now" on top of "γ× the return I already know from the next state".
The next Greek letter, "pi", drawn π (same symbol as 3.14… but here it means something totally different — do not confuse them).
The picture: a table pinned to each circle in figure s01 saying "in this state, do this".
Why needed: Monte Carlo evaluates a specific policy — "how good is state sif I keep behaving like π?" Without naming the behaviour, "how good is this state" has no answer, because the future depends on how you act. The policy π is also what decides the probabilities of each random At — so it shapes the whole distribution of returns.
Before we can define value we need the averaging symbol itself.
Plain words: think of rolling a fair die forever and averaging: the average settles on 3.5. That 3.5 is E[die] — a number no single roll ever shows, yet the true center of them all.
The subscript Eπ: the outcomes of St,At,Rt depend on how you behave. Writing Eπ says "average over the randomness produced when actions are chosen by policy π". Change π and the whole distribution — and hence the average — changes.
The bar ∣ inside, as in Eπ[Gt∣St=s]: the bar reads "given that". So the whole thing means "the average return, over all π-driven episodes, among only those runs where the state at time t was s".
Why the topic needs it: the true value we chase is a long-run average of a random return. E is the precise name for that average. Monte Carlo's whole job is to estimate this E by literally averaging observed samples.
Every symbol here is now earned: Eπ[⋯] is the π-driven long-run average (§8), the bar ∣ is "given that", and St=s says the random state landed on the particular state s.
Inside a single episode you might pass through the same state s more than once. That raises a fair question: if s shows up twice in one run, do we record both returns or only the first? The answer defines two variants.
The subscript π matters: just like vπ, the action-value depends on the policy you follow after the first action — so it wears the same π label. Different policy afterward, different Qπ.
Difference from v:vπ(s) scores a state; Qπ(s,a) scores a state-and-a-choice.
Why the topic desperately needs Q: to improve a policy you must compare actions. With only v, choosing the best action needs a model of the world (if I do a, where do I land?) — which model-free MC does not have. But Qπ(s,a) already bakes in the consequence, so "pick the best action" becomes simply "pick the a with the largest Qπ(s,a)". No model required.
To average returns as they arrive (without hoarding every number), we keep two running quantities per state:
Initialization (before any episode): set V(s)=0 and N(s)=0 for every state s. Starting the count at zero is essential — the very first update will make N(s)=1, so the first sample entirely replaces the initial guess (as it should, since a single sample is its own average). The starting value V(s)=0 is arbitrary and gets washed out immediately by that first update.
Now the update loop. Each time a fresh return G arrives for state s (first-visit: only its first occurrence in the episode):
First bump the count:N(s)←N(s)+1
Then nudge the estimate using the updated count:V(s)←V(s)+N(s)1[G−V(s)]
The order matters: we increment N(s)first so that the fraction N(s)1 uses the new, correct visit number. On the very first visit this makes N(s)=1 and the step is 11(G−V)=G−V, so V jumps straight to G — exactly the mean of one sample.
Reading the update: the arrow ← means "becomes / gets updated to". The bracket G−V(s) is the error — how far the new sample sits from our current guess. We step a fraction N(s)1 of the way toward it.
Sometimes we replace N(s)1 with a fixed small number α (Greek "alpha"), giving:
V(s)←V(s)+α[G−V(s)]
Why a fixed α instead of N1? With N1, every sample counts equally forever — great for a fixed world. A fixed αforgets old samples slowly, letting the estimate track a changing world (useful when the policy is still improving). α is a knob between "trust all history equally" and "chase recent evidence".
Last Greek letter, "epsilon", drawn ε — think "a tiny bit".
argmaxaQπ(s,a) reads "the action a that makes Qπ(s,a) largest" (argmax = "the argument giving the max", i.e. whicha, not the value).
Why needed: if you always pick what looks best right now (pure greedy, ε=0), you might never try the action that would have been great — you'd never gather evidence for it. A dash of randomness ε>0 guarantees every state-action pair gets sampled eventually, which is exactly what the "average over many samples" promise requires.
Read top to bottom: episodes give you states, actions, and rewards; rewards fold into the returnGt (with the help of γ and the base case GT=0); the expectationE turns returns into true value; and value plus Qπ plus exploration is exactly what Monte Carlo needs.
Cover the right side and see if you can answer each before revealing.
What is an episode?
A finite run of the task from a start to a terminal (ending) point — it must stop.
What does the subscript in St, At mean?
A clock reading — which time step. S0 is the start, S1 one step later, etc.
Are St, At, Rt fixed labels or random variables?
Random variables — before a run, chance decides which value each takes; that is why we must average over many runs.
Why is the reward for acting at time t written Rt+1, not Rt?
The reward is the consequence of the action and arrives one tick later, so it wears the label t+1.
What is T?
The terminal time step — when the episode ends. MC must reach it before computing anything.
What does γ (gamma) do, and what range is it in?
It shrinks each reward by γk for k steps of delay; γ∈[0,1]. It handles uncertainty about the future and keeps totals finite.
Why is γ=1 safe here but risky in general?
With a terminating episode the sum has finitely many terms so it stays finite; in a never-ending task γ=1 could make the return unbounded.
Write the return Gt in full and in recursive form, including the base case.
Gt=Rt+1+γRt+2+⋯; recursively Gt=Rt+1+γGt+1 with GT=0.
Why must we define GT=0?
At t=T the exponent T−t−1 becomes −1 and there is no reward left to collect, so the sum is empty — we define it as 0 to anchor the recursion.
Is Gt one number or an average?
One number — a single (random) sample from one episode. The average of many Gt is the value.
What does E mean, and what does the subscript in Eπ add?
E[X] is the probability-weighted long-run average of random X; the π says "average over the randomness produced when acting by policy π".
What is a policy π?
A rulebook mapping states to actions (or action probabilities) — your strategy.
Write vπ(s) in words and symbols.
The average return starting from s and following π: vπ(s)=Eπ[Gt∣St=s].
First-visit vs every-visit MC — what is the difference?
First-visit records the return only from s's first occurrence per episode (unbiased, independent samples); every-visit records all occurrences (more samples, correlated, slightly biased).
How does Qπ(s,a) differ from vπ(s), why the π subscript, and why do we need it?
Qπ scores a state and a chosen action then follows π; the π marks that dependence; it lets us pick the best action with no model of the world.
How do you initialize V(s) and N(s)?
V(s)=0 and N(s)=0 for every state before any episode.
In the update, why increment N(s)before using 1/N(s)?
So the fraction uses the correct new visit count; on the first visit this gives 1/1, making V jump straight to the first sample.
Why is V←V+N1[G−V] the same as taking a mean?
Stepping N1 of the way toward each new sample is algebraically identical to recomputing the running average, with no stored history.
Why use ε-greedy instead of always-greedy?
A small random chance ε keeps exploring every action, so all state-action pairs get sampled — needed for the averages to converge.