State and prove the policy improvement theorem. If qπ(s,π′(s))≥vπ(s) for every state s, why does it follow that vπ′(s)≥vπ(s) for every s? How does this justify greedy policy improvement in policy iteration?

Reinforcement learning, Dynamic programming
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can prove, by repeatedly unrolling one step of lookahead, that acting greedily with respect to a value function never makes a policy worse.

Key idea

Replace the first action by π′ and keep following π: this is no worse. Repeat the replacement at every later step. The chain vπ(s)≤qπ(s,π′(s))≤⋯≤vπ′(s) closes the proof.

Steps

  1. Take a deterministic π′ with qπ(s,π′(s))≥vπ(s) for all s. Recall qπ(s,a)=E[Rt+1+γvπ(St+1)∣St=s,At=a].
  2. Start from vπ(s)≤qπ(s,π′(s))=Eπ′[Rt+1+γvπ(St+1)∣St=s]. Here the first action comes from π′ and the future value is still that of π.
  3. Apply the assumption again inside the expectation: vπ(St+1)≤qπ(St+1,π′(St+1))=Eπ′[Rt+2+γvπ(St+2)∣St+1]. So vπ(s)≤Eπ′[Rt+1+γRt+2+γ2vπ(St+2)∣St=s].
  4. Repeat this n times to get vπ(s)≤Eπ′[Rt+1+γRt+2+⋯+γn−1Rt+n+γnvπ(St+n)∣St=s].
  5. Let n→∞. With bounded rewards and γ<1, the term γnvπ(St+n)→0, and the sum becomes the full discounted return under π′. So vπ(s)≤vπ′(s) for all s.
  6. Apply this to policy iteration. The greedy policy π′(s)=arg⁡max⁡aqπ(s,a) satisfies qπ(s,π′(s))=max⁡aqπ(s,a)≥qπ(s,π(s))=vπ(s), so the condition holds and π′ is at least as good as π.
  7. If π′ is not strictly better in any state, then vπ(s)=max⁡aqπ(s,a) for all s. That is the Bellman optimality equation, so π is optimal. With finitely many deterministic policies, the loop stops at the optimum after finitely many rounds.

Common mistakes

How long your answer should be

One page; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: In RLHF, a reward model gives scores rc=2.0 to the human-preferred answer and rr=0.5 to the rejected one. Under the Bradley–Terry model, P(chosen preferred)=σ(rc−rr). Compute this probability, the loss −log⁡σ(rc−rr), and the gradients with respect to rc and rr. What happens when the scores are the other way round, and why does the loss depend only on the difference?
Next in Reinforcement learning: What is the "deadly triad" in reinforcement learning? How do you show with a two-state example, with V^(s1)=w and V^(s2)=2w, a single weight w, and reward 0 everywhere, that off-policy semi-gradient TD(0) can diverge when only the transition s1→s2 is updated?