Module 3 — Value functions and Bellman equations
Two questions organize the rest of the course. How good is this state? — that is the value function V. How good is this action in this state? — that is the action-value function Q. The Bellman equations tie both to themselves through one step of the MDP, and every algorithm of modules 4 to 9 is a way of turning that self-reference into a computation.
Two value functions, two uses
The state-value function of a policy π is the expected return starting from state s and following π from there:
The action-value function is the same but starting by forcing action a before letting π take over:
The relation between them is direct: V^π(s) = Σ_a π(a|s) Q^π(s, a). Why keep both, then? Because they answer different questions. V tells you the score of a policy; Q tells you which action to try next without needing to know the transition model. That distinction is the reason model-free algorithms — Q-learning, DQN — work at all.
The Bellman expectation equation
V^π and Q^π satisfy a self-referential equation that follows from the one-step decomposition of the return:
Read it aloud: the value of s under π equals the immediate reward plus γ times the value of the next state, averaged over what the policy does and what the environment does. This is a system of |S| linear equations in |S| unknowns — for FrozenLake, 16 equations in 16 unknowns. It is solvable in closed form.
The analogous equation for Q:
Both are called expectation equations because they express V (or Q) as an expectation over what would happen next under the current policy.
The Bellman optimality equation
Now stop evaluating a fixed policy and ask about the best possible one. The optimality equations replace the average over actions with a max: