Visual walkthrough — Policies and value functions
We only assume you know what a Markov Decision Process gives us: at each moment you are in a state (where you are), you pick an action (what you do), and the world hands you a reward (a number, good if positive) and drops you into the next state. That is all we need.
Step 1 — A reward is just a number on a timeline
WHAT. Draw time going left to right. At each tick the agent collects one number: a reward. We write the reward that arrives one step after time as .
WHY. Before we can talk about "how good a situation is," we must agree on the raw material: a stream of numbers. Everything else is bookkeeping on top of this stream.
PICTURE. Look at the timeline below. The dot at time is "now." The red arrow is the first reward you will receive, — notice its subscript is , not , because the reward comes after you act.

Step 2 — Add up the whole future: the return
WHAT. Sum every reward from now to the end of time. Call that sum the return :
WHY. A single reward is short-sighted. We care about long-run success, so we add the whole tail of rewards into one number — the total score earned from time onward.
PICTURE. Each future reward is a bar. is the total height when you stack them all.
Step 3 — Fix the infinite pile with discounting
WHAT. Multiply the reward steps ahead by , where (Greek "gamma") is a fixed number between and :
Term by term: multiplies the nearest reward (full weight), shrinks the next one, shrinks the one after that even more.
WHY THIS TOOL and not a plain sum? A plain infinite sum of rewards can blow up to infinity — then "which state is better?" has no answer. We need a geometric weight because it does two jobs at once: (1) it shrinks each far-away reward so the total stays finite, and (2) decaying like a geometric series is the only memoryless discount — the weight of "two steps from here" looks the same no matter where "here" is. That matches the Markov spirit of an MDP.
PICTURE. The reward bars are unchanged, but now each is scaled by a shrinking red envelope . The far bars almost vanish.

Edge cases of :
- : only survives — a purely greedy, one-step-ahead agent.
- : all rewards weigh almost equally — a far-sighted agent (needs the sum to still converge, e.g. episodes that end).
Step 4 — The future is uncertain: take an expectation
WHAT. The agent's policy may roll dice to pick actions, and the world may roll dice to pick next states. So is not one number — it is a spray of possible totals. We collapse the spray to its average, the expectation , and define the value of a state:
Reading the symbols: = "value of state "; the superscript = "assuming we act by policy "; = "average over all randomness the policy and world produce"; = "given that right now we are standing in state ."
WHY EXPECTATION and not the max or the min? We want the value you'd earn on average if you lived this state many times under policy . Not the luckiest run (max), not the worst (min) — the typical one. That is exactly what an average / expectation is for.
PICTURE. Many faded rollout paths fan out from state ; each has its own return. The red line is their average — that single average height is .

Step 5 — The magic peel:
WHAT. Look again at the discounted return and factor out one from everything past the first reward:
The whole tail, once you pull out one , is itself a return — but starting one step later. That is .
WHY. This is the single trick the entire theory rests on. An infinite sum is scary; a "first term plus a shrunken copy of myself" is a recursion we can solve. We turn an unbounded object into a self-reference.
PICTURE. Snip off the first red bar . What remains is the same picture shifted one step left and scaled by — a smaller copy of the original stack.

Step 6 — Push the average through the peel
WHAT. Take of both sides of the peel, conditioned on : Expectation is linear (average of a sum = sum of averages), and the average of given you land in is by definition . So the tail's average becomes the value of wherever you land next.
WHY. We want an equation in terms of only — no leftover . Linearity of expectation lets us split, and the definition from Step 4 lets us re-fold back into a . The recursion becomes a recursion on values.
PICTURE. A one-step lookahead fan: from , an averaged immediate reward, then an arrow into a next state whose value is a smaller copy of the same object.

Step 7 — Name the two dice explicitly: the Bellman expectation equation
WHAT. "Average over randomness" hides two separate dice. Spell them out:
Term by term:
- — average over each action , weighted by how likely the policy is to choose it.
- — average over each next-state-and-reward pair the world might produce after that action.
- — the reward collected on this transition (this is realised).
- — the value of the state you landed in, discounted once.
WHY. A number you can compute needs the dice written as explicit sums over probabilities, not an abstract . Splitting into "policy dice then world dice" mirrors the actual order of events: you choose, then the world responds.
PICTURE. A two-layer tree: root → policy branches (one per action, thickness = probability) → world branches (one per outcome, thickness = probability) → each leaf pays .

Step 8 — Watch the recursion actually solve itself (worked, from the parent)
WHAT. Use the parent's 2-state example. One action, . From : reward , then stay with prob or move to with prob . From : reward , stay forever.
Write the boxed equation once per state:
WHY. is a self-loop, so its equation has only itself — solve it first (the geometric-series limit from Step 3). Feed that number into 's equation. The recursion collapses to plain algebra.
PICTURE. The two-node MDP with the self-loops drawn, red-highlighting the self-loop that we solve first.

The one-picture summary

The whole derivation on one canvas: reward stream → discounted return → average into → peel one step → Bellman recursion. Follow the red arrow around the loop: the value of now equals the reward you get now plus a discounted copy of the value of next.
Recall Feynman retelling (say it out loud)
Imagine standing on a square. The world will pay you a number to leave, then drop you on a new square, over and over. Add up all those payments, but trust far-off payments a little less each time — that shrinking is the discount , and it's what keeps the total from being infinite. Since your dice-rolling strategy and the world are both random, you don't want one lucky total; you want the average total. That average, starting from a square, is the square's value. Now the trick: your average total = the average of (first payment) + (a slightly-shrunk average total of the next square). That's it — the value of where you are is the reward you get plus a discounted echo of the value of where you'll be. Written with the two dice spelled out (which action, then which outcome), that echo is the Bellman expectation equation.
Recall Quick self-quiz
Why must ? ::: So the geometric series converges and the return stays finite. What does the "peel" buy us? ::: It turns an infinite sum into a self-reference, giving the recursive Bellman equation. Why an expectation and not a max? ::: We want the average return under policy , not the best-case outcome. In the 2-state example, why solve first? ::: Its Bellman equation references only itself (self-loop), so it's a single equation in one unknown.