A deterministic MDP has two states, A and B, and γ=0.9. In A you can "stay" (reward 1, remain in A) or "go" (reward 0, move to B). In B the only action is "stay" (reward 2, remain in B). Starting from V0=0, what are the values after three iterations of value iteration, and what are V∗ and the optimal policy?

Reinforcement learning, Dynamic programming
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can apply the Bellman optimality backup mechanically and read the greedy policy off the values.

Key idea

Each sweep applies Vk+1(s)=max⁡a[R(s,a)+γ∑s′P(s′∣s,a) Vk(s′)]. The values converge to V∗, and the greedy action can change along the way as the value of distant rewards propagates back.

Steps

  1. Write the two backups: Vk+1(A)=max⁡(1+0.9 Vk(A),  0+0.9 Vk(B)) and Vk+1(B)=2+0.9 Vk(B).
  2. Iteration 1: V1(A)=max⁡(1,0)=1 (stay), V1(B)=2.
  3. Iteration 2: V2(A)=max⁡(1+0.9×1, 0.9×2)=max⁡(1.9, 1.8)=1.9 (stay); V2(B)=2+0.9×2=3.8.
  4. Iteration 3: V3(A)=max⁡(1+0.9×1.9, 0.9×3.8)=max⁡(2.71, 3.42)=3.42 (go); V3(B)=2+0.9×3.8=5.42.
  5. Solve the fixed point. V∗(B)=2/(1−0.9)=20. Staying in A forever is worth 1/(1−0.9)=10; going is worth 0+0.9×20=18. So V∗(A)=18 and π∗(A)= go.
  6. Comment: the greedy action in A switched from stay to go at iteration 3, and the max-norm error shrinks by at least a factor γ=0.9 per sweep.

Common mistakes

How long your answer should be

A small table of Vk(A) and Vk(B) for k=0,…,3, plus three lines for V∗; about 3 minutes.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: What is the difference between the state-value Vπ(s) and the action-value Qπ(s,a), and how are they related? If π(a1∣s)=0.7, π(a2∣s)=0.3, Qπ(s,a1)=4 and Qπ(s,a2)=2, what is Vπ(s)?
Next in Reinforcement learning: Write the Q-learning update. With α=0.1, γ=0.9, Q(s,a)=2, reward r=1 and max⁡a′Q(s′,a′)=5, compute the new Q(s,a). Why is Q-learning called off-policy?