5.1.5 · D1Reinforcement Learning Foundations

Foundations — Bellman equations

2,237 words10 min readBack to topic

This page assumes nothing. Before we can read a single boxed formula in the parent note, we must earn every letter in it. We will meet each symbol, draw the picture it stands for, and say why the topic cannot live without it. Read top to bottom — each item leans on the one above.


1. The world as a set of rooms — the state

The picture. Imagine a tiny 2×2 grid of rooms. Standing in a particular room is being in a particular state. The letter is just a name-tag we pin on a room.

Why the topic needs it. Every value question begins "how good is it to be in this state?" Without a name for "where we are," there is nothing to attach a number to. The set of all possible states is written ; a next state (the room we step into) gets an apostrophe: , read "s-prime."

Recall Why the prime in

? It distinguishes ==current room from the room you step into next == — same kind of object, different moment in time.


2. The moves you can make — the action

The picture. From a room, arrows point to the doors. Picking action = "right" means walking through the right-hand door. A next action (chosen from the room you arrive in) is , "a-prime."

Why the topic needs it. Value depends on what you do. The action-value function literally asks "how good is choosing door from room ?" — impossible to phrase without a symbol for the door.


3. The point score — the reward and

Two notations, one idea:

  • — a generic reward value (a possible payout, used inside sums).
  • — the actual reward received on the step from time to time . The capital with a subscript is a random variable: before you move you don't know the exact number, you only know its probabilities.

The picture. As the agent hops room→room, a little number pops up on each arrow it crosses. Collect them all and you have a stream of rewards

Why the topic needs it. Reward is the only signal telling the agent what "good" means. Everything — value, policy, optimality — is built to maximise collected reward.


4. Time steps and the subscript

The picture. Freeze the walk into frames. Frame : agent in . Frame : agent in the next room having collected . The subscript on , , just says which frame.

Why the topic needs it. The value is a sum over future time: . Without a clock there is no "future" to sum over.


5. Distant reward counts less — the discount factor

The picture. Stack bars for the reward you get now, next step, the step after… Multiply each successive bar by , then , then . The bars fade toward zero — near reward is tall and bright, far reward is short and dim.

Why this tool and not just "add everything"? If you simply added infinitely many rewards of, say, , you would get — a useless value that can't be compared. Multiplying by with makes a geometric series that converges to a finite number: That is exactly why the parent note insists — the half-open bracket keeps the sum finite. See Discount Factor for the full story.

Recall What does

mean? What about ? makes the agent totally short-sighted: it only cares about the immediate reward, while near makes it far-sighted, weighing distant rewards almost as much as near ones.


6. Averaging over uncertainty — the expectation

The picture. A wheel of fortune split into slices. Each slice is an outcome; the slice's width is its probability. Spin many times, average the payouts — that average is .

Why the topic needs it. Two things are uncertain in RL: which door the policy picks, and where the world actually drops you. Value must be an average over both, so every value function carries an . The subscript just says "averaging while following policy ."


7. The agent's habit — the policy

The picture. In each room, the doors are tinted by how likely the agent is to use them. A "uniform random" policy tints all four doors equally ( each). A confident policy paints one door bright and the rest faint.

Why the topic needs it. Value is always relative to behaviour. means "value if you keep acting like ." Change the habit, change the value. The whole point of RL is to reshape toward the best possible one, written ("pi-star"). Policy Gradient Methods tune directly.

Recall Read

aloud. "The probability that policy ==chooses the action 'right' given we are in state == is 0.25."


8. The rules of the world — the dynamics

The picture. Standing in room , you push door . The world rolls its own dice and lands you in some with some . lists how likely each landing is. In a deterministic grid, one landing has probability and the rest .

Why the topic needs it. The agent's future depends on the world's response, not just its own choice. is the world's contribution to the average — that's the inner in every Bellman equation.

This "the future only depends on the current state and action, not the whole history" property is what makes the world a Markov Decision Process.


9. The number we chase — the return and the value functions

The picture. Take the fading reward bars from §5 and sum their heights. That single total height is the return.

Why two of them? answers "how good is this room?"; answers "how good is this specific door from this room?" — and is what Q-Learning learns directly, because comparing doors is exactly how you pick the best action.

The link between them: since averages over the doors the policy might pick,


10. The whole trick in one line — bootstrapping and the

The return obeys a tiny self-referential identity — split off the first reward: "Total future = one step now + a -shrunk copy of the total future from next step." Taking expectations turns this into the Bellman equation. Replacing an unknown value by an estimate of the next value is called bootstrapping — see Bootstrapping and Temporal Difference Learning.

The picture. Line up the -values for every door out of a room; picks the tallest bar, points to it. This is the optimal agent's rule: always walk through the tallest-value door.

Why vs. the averaging ? A fixed policy averages over its (possibly random) door choices → use . An optimal agent is no longer random — it chooses the best door → use . That single swap turns a Bellman expectation equation into a Bellman optimality equation.


Prerequisite map

State s and Action a

Reward r and R at t+1

Policy pi picks doors

Dynamics p world reacts

Return sum of rewards

Discount gamma shrinks future

Expectation averages over dice

Value V and Q

Bootstrapping split off first step

Max picks best action

Bellman Optimality

Bellman Expectation

Bellman Equations parent topic

Everything on this page pours downward into the parent Bellman Equations note. If any box above is fuzzy, that boxed formula there will feel like magic instead of arithmetic.


Equipment checklist

Test yourself — cover the right side and answer aloud.

I can say in plain words what a state and next-state are
A state is a full snapshot of where the agent stands; is the state it lands in after one move.
I can explain what an action does
It is the agent's choice of which door/move to take from the current state.
I know the difference between a reward and a value
Reward is one step's payout; value is the whole discounted future stream of rewards summed.
I can read
The (random) reward received on the step from frame to frame .
I can explain why is required
It shrinks future rewards so the infinite sum converges to a finite, comparable number.
I know what averages over
Both the policy's random action choices and the world's random transitions, while following .
I can read
The probability the policy chooses action when in state .
I can read
The probability the world sends you to with reward after action in state .
I can state the difference between and
is expected return from a state under ; is expected return from a state when a specific action is forced first, then .
I can write the one-line return identity
.
I know when to use vs.
Averaging for a fixed policy (expectation equations); for the optimal agent (optimality equations).
I can explain bootstrapping in one sentence
Estimating a value by using the estimated value of the next state, rather than waiting for the full future.