The value of a state is a promise about the future: the expected total discounted reward from here on. The Bellman equation says that promise can be split into two pieces, what you get right now and a discounted promise about the state you land in next. That is it. Every value based algorithm in reinforcement learning is a way of making both sides of that equation agree.
The reason this is powerful rather than merely true is that it turns an infinite sum over trajectories into a local consistency condition between a state and its neighbors. You never have to enumerate futures. You only have to make each state consistent with the states one step away, and the Markov property guarantees that local consistency everywhere implies global correctness.
The Bellman expectation equations
Fix a policy . Start from the definition and the return recursion :
For the second term, condition on the next state and use the tower property of conditional expectation:
By the Markov property, once is known, the earlier state carries no further information about , so the inner expectation is . Expanding the outer expectation over the action and the transition gives the Bellman expectation equation:
The same argument on action values, conditioning on instead, gives
Both are systems of (or ) linear equations in as many unknowns. In matrix form, , with the unique solution as shown in the previous note. Linearity is the important feature: for a fixed policy, evaluation is a linear solve.
The Bellman optimality equations
Now consider the optimal value functions and . They satisfy the Bellman optimality equations:
The sum over actions weighted by the policy has become a max over actions. The optimal agent, at every state, picks whichever action has the highest one step lookahead value. Intuitively that must be right: if really is the best achievable from every state, then the best thing to do now is whatever leads to the best combination of immediate reward and best achievable continuation.
That intuition is not a proof, and it is worth being clear about what needs proving. Two separate claims are hiding here:
- The optimality equation has a solution, and only one.
- That solution is , the supremum over policies, and a policy achieving it exists.
The max makes the equation nonlinear, so the matrix inverse that solved the expectation equation is unavailable. The route to both claims is through operators and contraction.
The Bellman operators
Value functions on a finite state space are vectors in . Define the Bellman expectation operator for a policy and the Bellman optimality operator as maps from value vectors to value vectors:
In this language the Bellman expectation equation says is a fixed point of , and the optimality equation says is a fixed point of . The question of existence and uniqueness of solutions becomes the question of whether these operators have unique fixed points.
Two elementary properties of the operators will be used repeatedly.
Monotonicity. If componentwise, then and . This is immediate, since each operator is a nonnegative combination of the entries of its input plus a constant, and a max of larger things is larger.
Constant shift. For a constant and the all ones vector , , and likewise for . Adding to every value adds to every backed up value, because the probabilities sum to one.
Theorem: the Bellman operators are contractions
The norm that makes this work is the sup norm, .
Theorem. For any policy , is a contraction in , and so is . That is, for all ,
Proof for . Fix a state . The immediate reward terms cancel in the difference, leaving
The double sum is a convex combination of the entries of , since and are probability distributions. A convex combination of numbers is bounded in absolute value by the largest absolute value among them, so
This holds for every , so it holds for the max over .
Proof for . The max requires one extra lemma.
Lemma. For any two functions on a finite set, .
Proof of lemma. Let attain . Then . Swapping the roles of and gives the same bound on the negative, hence on the absolute value.
Now fix and set and the same with . By the lemma,
by the same convex combination argument as before. Taking the max over finishes the proof.
The content of the proof is small: every Bellman backup is an average of neighboring values scaled by , and averaging cannot increase the largest gap between two vectors, while strictly shrinks it. The max in does not change this because a max of averages is still no worse than the largest average.
The Banach fixed point theorem
Theorem (Banach). Let be a nonempty complete metric space and a contraction with constant . Then has exactly one fixed point , and for any starting point the iterates converge to with
Proof. The iterates are Cauchy. Applying the contraction times, . For , the triangle inequality and the geometric series give
which goes to zero as .
The limit is a fixed point. By completeness the sequence converges to some . A contraction is Lipschitz and therefore continuous, so .
Uniqueness. If and , then , which with forces .
Rates. Letting in the Cauchy estimate gives the second bound. For the first, , and iterate.
with the sup norm is complete (it is finite dimensional, and all norms on a finite dimensional space are equivalent), so the theorem applies to both Bellman operators.
Consequences
Put the two theorems together and the first of the two claims above is settled, with a convergence rate as a bonus.
Corollary 1 (existence and uniqueness). has a unique fixed point, which must therefore be . has a unique fixed point; call it for now.
Corollary 2 (value iteration converges). From any , the sequence satisfies
Convergence is geometric with ratio , from any initialization. The same holds for converging to , which is iterative policy evaluation.
Corollary 3 (a computable error bound). From the second Banach bound, after observing consecutive iterates,
This is what turns value iteration into an algorithm with a stopping rule. You do not need to know to bound your distance from it; the size of the last step is enough.
The fixed point is the optimal value, and a greedy policy achieves it
Corollary 1 gave a unique solution to the optimality equation. It remains to show that , the supremum over policies, and that an optimal policy exists. This is the second claim, and it is the one that makes the whole thing worth anything.
Define a greedy policy with respect to a value vector as any deterministic policy with
By construction, : for the greedy policy, the expectation backup of equals the max backup of .
Theorem. Let be the fixed point of and a greedy policy with respect to . Then , and for every policy . Hence and is an optimal policy, deterministic and stationary.
Proof. The greedy policy achieves . Since is greedy for and is a fixed point of ,
So is a fixed point of . But has a unique fixed point, namely . Therefore .
No policy does better. Take any policy . For any vector , componentwise, because an average over actions is at most the max over actions. Apply this to and use monotonicity of repeatedly:
The first equality is Corollary 2 applied to started from . The inequality is by induction: , using at each step. The last equality is because is fixed.
So for every , which says and that attains the supremum in every state simultaneously.
This is the theorem that was promised in the previous note: every finite discounted MDP has an optimal policy, and a deterministic stationary one at that. The proof also shows something practical. If you can compute , or , then acting optimally is just taking the argmax. All the difficulty of the problem lives in the value function.
The same statements hold for , with the operator
which is a contraction on by the identical argument. The form matters because a greedy policy with respect to needs no model: with no in sight. That is the reason model free methods learn rather than .
What the theory buys you
- A target. and exist and are unique, so "learn the optimal value function" is a well posed goal.
- An algorithm. Iterating converges geometrically from anywhere. Dynamic programming is that algorithm and its relatives, for when the model is known.
- A stopping rule. The distance to the optimum is bounded by the size of the last update.
- A template for the model free case. Temporal difference learning replaces the expectation in with a single sampled transition. The contraction is what makes those noisy iterations converge too.
Where this breaks
The contraction constant is , so as the guarantees weaken and the number of iterations to a given accuracy grows like . At the operator is only nonexpansive and the theorem says nothing; convergence then needs a separate argument about termination.
More seriously, everything above is for a tabular value function, a vector with one entry per state. Once the value function is approximated by a parametric model, the projection back onto the model class need not be a contraction in the sup norm, and the combination of bootstrapping, off policy sampling and function approximation can diverge. The theory in this note is exact for small problems and a guide, not a guarantee, for large ones.
References
- Bellman. Dynamic Programming. Princeton University Press, 1957.
- Puterman. Markov Decision Processes. Wiley, 1994, chapter 6.
- Sutton, Barto. Reinforcement Learning: An Introduction, 2nd ed. MIT Press, 2018, chapters 3 and 4.
- Bertsekas. Dynamic Programming and Optimal Control, vol. 2. Athena Scientific.