Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

Policy Iteration as Newton’s Method

Why policy iteration converges in so few steps.

Value iteration closes a fraction 1−γ1-\gamma of the gap per sweep, so at γ=0.99\gamma=0.99 it crawls. Policy iteration finishes in a handful of rounds almost regardless of γ\gamma. The explanation is that policy iteration is Newton's method on the Bellman equation (Puterman & Brumelle, 1979). This lesson derives the correspondence, proves when convergence is quadratic and why it is finite in finite MDPs, and follows the idea to the Riccati equation of linear–quadratic control, where every round squares the error, and to lookahead search.

What you’ll learn

  • Show that one round of policy iteration is exactly a Newton step on F(V)=T⋆V−VF(V)=\mathcal T^\star V-V, with the greedy policy supplying the Jacobian γPπ−I\gamma P^\pi-I.
  • Prove the error identity behind Newton's convergence, derive a quadratic rate under a Lipschitz condition, and explain finite termination through the action gap.
  • Compute policy iteration and value iteration exactly on a scalar linear–quadratic control problem, and see quadratic against linear convergence.
  • Interpret modified policy iteration as an inexact Newton method and one-step lookahead as a Newton step from a learned value.

One round of policy iteration is one Newton step

Newton's method solves F(V)=0F(V)=0 by linearizing: Vk+1=Vk−JF(Vk)−1F(Vk)V_{k+1}=V_k-J_F(V_k)^{-1}F(V_k). Apply it to the Bellman optimality equation written as F(V)=T⋆V−V=0F(V)=\mathcal T^\star V-V=0.

FF is piecewise affine. On the set of value functions for which a deterministic policy π\pi is greedy, T⋆V=rπ+γPπV\mathcal T^\star V=r^\pi+\gamma P^\pi V, so there F(V)=rπ−(I−γPπ)VF(V)=r^\pi-(I-\gamma P^\pi)V and the Jacobian is γPπ−I\gamma P^\pi-I. Where several policies are greedy at once, FF has a kink, and the matrix of any greedy policy is an element of its generalized Jacobian: this is the setting of semismooth Newton methods (Gargiani et al., 2022).

DerivationProof
  1. V−(γP−I)−1(r+γPV−V)=V+(I−γP)−1(r−(I−γP)V)V-(\gamma P-I)^{-1}\big(r+\gamma PV-V\big)=V+(I-\gamma P)^{-1}\big(r-(I-\gamma P)V\big)

    Greediness means T⋆V=rπV+γPπVV\mathcal T^\star V=r^{\pi_V}+\gamma P^{\pi_V}V. Write P=PπVP=P^{\pi_V} and r=rπVr=r^{\pi_V}, and substitute:

  2. =V+(I−γP)−1r−V=(I−γP)−1r=VπV=V+(I-\gamma P)^{-1}r-V=(I-\gamma P)^{-1}r=V^{\pi_V}

    The two VV terms cancel, leaving the solution of the greedy policy's evaluation equations:

The picture in one dimension. Take a single state in which action aa pays rar_a and then continues with probability qaq_a (otherwise the episode ends). Then T⋆v=max⁡a(ra+γqav)\mathcal T^\star v=\max_a(r_a+\gamma q_av) is a maximum of lines: a convex, piecewise-linear function of the number vv. The optimal value v⋆v^\star is where it crosses the diagonal. A Newton step follows the line of the action that is greedy at vkv_k to the diagonal, landing at ra/(1−γqa)r_a/(1-\gamma q_a), the value of always taking aa.

Because every line lies below the maximum, the landing point is never beyond v⋆v^\star; and because FF decreases, each step moves up. So the iterates rise monotonically and stop after finitely many steps, since there are finitely many lines. In SS dimensions the same convexity, applied state by state, gives the monotone improvement of policy iteration.

Quadratic convergence and finite termination

DerivationProof
  1. V⋆−Vk+1=(I−γPk+1)−1(T⋆V⋆−Tπk+1V⋆)V^\star-V_{k+1}=\big(I-\gamma P_{k+1}\big)^{-1}\big(\mathcal T^\star V^\star-\mathcal T^{\pi_{k+1}}V^\star\big)

    The identity. For any policy π\pi, V⋆−Vπ=(V⋆−TπV⋆)+(TπV⋆−TπVπ)=(T⋆V⋆−TπV⋆)+γPπ(V⋆−Vπ)V^\star-V^\pi=(V^\star-\mathcal T^\pi V^\star)+(\mathcal T^\pi V^\star-\mathcal T^\pi V^\pi)=(\mathcal T^\star V^\star-\mathcal T^\pi V^\star)+\gamma P^\pi(V^\star-V^\pi). Solve for V⋆−VπV^\star-V^\pi and take π=πk+1\pi=\pi_{k+1}:

  2. T⋆V⋆−Tπk+1V⋆=(r⋆−rk+1)+γ(P⋆−Pk+1)V⋆≤γ(Pk+1−P⋆)(Vk−V⋆)\mathcal T^\star V^\star-\mathcal T^{\pi_{k+1}}V^\star=(r^\star-r_{k+1})+\gamma(P^\star-P_{k+1})V^\star\le\gamma\big(P_{k+1}-P^\star\big)\big(V_k-V^\star\big)

    The bracket. It is nonnegative because T⋆\mathcal T^\star maximizes. For the upper bound, use that πk+1\pi_{k+1} is greedy at VkV_k, so rk+1+γPk+1Vk≥r⋆+γP⋆Vkr_{k+1}+\gamma P_{k+1}V_k\ge r^\star+\gamma P^\star V_k, that is r⋆−rk+1≤γ(Pk+1−P⋆)Vkr^\star-r_{k+1}\le\gamma(P_{k+1}-P^\star)V_k:

  3. ∥V⋆−Vk+1∥∞≤γ1−γ∥Pk+1−P⋆∥∞∥Vk−V⋆∥∞≤γL1−γ∥Vk−V⋆∥∞2\norm{V^\star-V_{k+1}}_\infty\le\frac{\gamma}{1-\gamma}\norm{P_{k+1}-P^\star}_\infty\norm{V_k-V^\star}_\infty\le\frac{\gamma L}{1-\gamma}\norm{V_k-V^\star}_\infty^2

    Norms. (I−γPk+1)−1(I-\gamma P_{k+1})^{-1} is nonnegative with max norm 1/(1−γ)1/(1-\gamma), which gives item 3; the Lipschitz condition turns it into the quadratic bound. Item 1 is the policy improvement theorem plus the identity, whose right-hand side is nonnegative.

Finite MDPs: the extreme case of fast convergence. Let Δ\Delta be the action gap, the smallest amount by which a non-optimal action falls short: Δ=min⁡{V⋆(s)−Q⋆(s,a): a not optimal in s}>0\Delta=\min\{V^\star(s)-Q^\star(s,a):\ a\text{ not optimal in }s\}>0. If ∥V−V⋆∥∞<Δ/(2γ)\norm{V-V^\star}_\infty<\Delta/(2\gamma), every action that is greedy for VV is optimal, because one-step lookaheads move by at most γ∥V−V⋆∥∞<Δ/2\gamma\norm{V-V^\star}_\infty<\Delta/2. So near V⋆V^\star the greedy matrix is P⋆P^\star (or another optimal policy's), item 3 gives Vk+1=V⋆V_{k+1}=V^\star, and Newton's method stops exactly.

Combined with ∥V⋆−Vk∥∞≤γk∥V⋆−V0∥∞\norm{V^\star-V_k}_\infty\le\gamma^k\norm{V^\star-V_0}_\infty (policy iteration is never behind value iteration), policy iteration stops after at most about log⁡(2γ∥V⋆−V0∥∞/Δ)/log⁡(1/γ)+1\log\big(2\gamma\norm{V^\star-V_0}_\infty/\Delta\big)/\log(1/\gamma)+1 rounds. That is fast when the gap is large, but the count depends on Δ\Delta, which can be arbitrarily small. Bounds that depend only on SS, AA and γ\gamma need a different argument (How Fast Is Policy Iteration?).

Check your understanding

Newton's method usually converges only in the limit. Why does policy iteration on a finite MDP stop exactly after finitely many rounds?

  1. Because the discount factor is less than 1
  2. Because F=T⋆V−VF=\mathcal T^\star V-V is piecewise affine with finitely many pieces: once the greedy policy is optimal, the Newton step lands exactly on V⋆V^\star
  3. Because each evaluation is done by exact Gaussian elimination, with no rounding error
  4. Because the values are integers
Show the answer

B. Because F=T⋆V−VF=\mathcal T^\star V-V is piecewise affine with finitely many pieces: once the greedy policy is optimal, the Newton step lands exactly on V⋆V^\star

On each piece, FF is affine and Newton's step solves it exactly. Once the iterate is within Δ/(2γ)\Delta/(2\gamma) of V⋆V^\star, the greedy policy is optimal, its piece contains V⋆V^\star, and the next step lands there. Policy improvement also forbids revisiting a piece, and there are finitely many pieces.

Newton beyond finite MDPs: the Riccati equation

Quadratic convergence shows itself when there are infinitely many policies. Take the simplest linear–quadratic regulator: state xt+1=xt+utx_{t+1}=x_t+u_t, cost xt2+ut2x_t^2+u_t^2 per step to be minimized, no discount. A linear policy u=−Kxu=-Kx has cost JK(x)=PKx2J_K(x)=P_Kx^2, and the optimal P⋆P^\star solves the Riccati equation P=1+P−P21+PP=1+P-\frac{P^2}{1+P}, that is P2−P−1=0P^2-P-1=0. So P⋆=1+52=φ≈1.618P^\star=\frac{1+\sqrt5}{2}=\varphi\approx1.618, the golden ratio, with optimal gain K⋆=1/φ≈0.618K^\star=1/\varphi\approx0.618.

  • Value iteration is the Riccati recursion Pk+1=1+Pk1+PkP_{k+1}=1+\frac{P_k}{1+P_k} from P0=0P_0=0.
  • Policy iteration (Hewer, 1971; Kleinman, 1968, in continuous time) evaluates a gain exactly, PK=1+K21−(1−K)2P_K=\frac{1+K^2}{1-(1-K)^2}, and improves it greedily, K′=PK1+PKK'=\frac{P_K}{1+P_K}, from a stabilizing start K0=1K_0=1.
kkValue iteration PkP_kIts errorPolicy iteration PkP_kIts error
00−1.6-1.622+0.38+0.38
11−0.62-0.6213/8=1.62513/8=1.625+7.0×10−3+7.0\times10^{-3}
23/23/2−0.12-0.12610/377≈1.6180371610/377\approx1.6180371+3.1×10−6+3.1\times10^{-6}
38/58/5−0.018-0.0181346269/8320401346269/832040+6.5×10−13+6.5\times10^{-13}
421/1321/13−2.6×10−3-2.6\times10^{-3}F63/F62F_{63}/F_{62}+2.7×10−26+2.7\times10^{-26}
Exact iterates (round 4 of policy iteration is below double precision). Both sequences are ratios of consecutive Fibonacci numbers. Value iteration's are F2k/F2k−1F_{2k}/F_{2k-1}: the index grows by 2 per step and the error shrinks by a constant factor. Policy iteration's are F3/F2F_3/F_2, F7/F6F_7/F_6, F15/F14F_{15}/F_{14}, F31/F30F_{31}/F_{30}, F63/F62F_{63}/F_{62}: the index roughly doubles per round, so the error is squared. Policy iteration approaches from above because every PkP_k is the cost of an actual stabilizing policy.
Predict before you look

Value iteration's error in this example shrinks by a constant factor per step. What is that factor, the derivative of P↦1+P1+PP\mapsto1+\frac{P}{1+P} at P⋆=φP^\star=\varphi?

Show the answer

0.15

The derivative is 1(1+P)2\frac{1}{(1+P)^2}, which at φ\varphi is 1φ4≈0.146\frac{1}{\varphi^4}\approx0.146 (using 1+φ=φ21+\varphi=\varphi^2). It equals (1−K⋆)2(1-K^\star)^2, the square of the optimal closed-loop factor 1/φ2≈0.3821/\varphi^2\approx0.382: value iteration forgets its initial guess as fast as the optimally controlled system forgets its initial state, squared. Linear convergence at a rate set by the dynamics, against Newton's squaring.

Hewer's iteration needs a stabilizing initial gain, here ∣1−K0∣<1\abs{1-K_0}<1; every later gain then stays stabilizing and PkP_k decreases monotonically to P⋆P^\star at a quadratic rate. The same structure, an exact evaluation (a Lyapunov equation) followed by a greedy gain update, is policy iteration for LQR in any dimension, and its convergence analysis is the matrix version of the theorem above (Optimal Control & Model Predictive Control).

Inexact Newton steps: partial evaluation and lookahead

Modified policy iteration solves the Newton system (I−γPk+1)V=rk+1(I-\gamma P_{k+1})V=r_{k+1} only approximately, with mm sweeps started from VkV_k: Vk+1=(Tπk+1)mVkV_{k+1}=(\mathcal T^{\pi_{k+1}})^mV_k. The solve error is Vk+1−Vπk+1=(γPk+1)m(Vk−Vπk+1)V_{k+1}-V^{\pi_{k+1}}=(\gamma P_{k+1})^m(V_k-V^{\pi_{k+1}}), a relative error of at most γm\gamma^m. In the theory of inexact Newton methods (Dembo, Eisenstat & Steihaug, 1982), solving each Newton system to a relative residual bounded by a forcing term η<1\eta<1 gives local linear convergence, and forcing terms that shrink to 0 give superlinear convergence. Here, once the greedy policy is optimal, each iteration contracts the error by exactly (γP⋆)m(\gamma P^\star)^m; letting mm grow recovers policy iteration's finish. λ-policy iteration replaces the Newton matrix (I−γP)−1(I-\gamma P)^{-1} by (I−λγP)−1(I-\lambda\gamma P)^{-1}, a damped step between the fixed-point iteration (λ=0\lambda=0) and Newton (λ=1\lambda=1) (Modified & Generalized Policy Iteration).

Lookahead from a learned value. An agent with an offline-trained value V~\tilde V that acts by one-step lookahead uses the policy greedy for V~\tilde V, whose value is precisely the Newton step from V~\tilde V. The error identity holds for any V~\tilde V, not only for policy values: V⋆−VπV~V^\star-V^{\pi_{\tilde V}} is controlled by (PπV~−P⋆)(V~−V⋆)(P^{\pi_{\tilde V}}-P^\star)(\tilde V-V^\star), which vanishes once V~\tilde V is within half an action gap. Bertsekas (2022) uses this to explain why online lookahead, such as AlphaZero's search at play time, improves so sharply on an imperfect trained value: near the solution, the error after the lookahead is of higher order than the error before it.

Key takeaways

  • A round of policy iteration is a Newton step on T⋆V−V=0\mathcal T^\star V-V=0: the greedy policy's matrix γPπ−I\gamma P^\pi-I is the Jacobian of the active affine piece, and solving the linearization gives exactly the greedy policy's value.
  • V⋆−Vπk+1=(I−γPk+1)−1(T⋆V⋆−Tπk+1V⋆)V^\star-V^{\pi_{k+1}}=(I-\gamma P_{k+1})^{-1}(\mathcal T^\star V^\star-\mathcal T^{\pi_{k+1}}V^\star), bounded by γ1−γ∥Pk+1−P⋆∥∞∥V⋆−Vπk∥∞\frac{\gamma}{1-\gamma}\norm{P_{k+1}-P^\star}_\infty\norm{V^\star-V^{\pi_k}}_\infty; Lipschitz greedy transitions give quadratic convergence, and in finite MDPs an action gap gives exact termination.
  • On the scalar LQR the golden ratio appears: policy iteration's iterates are Fibonacci ratios whose index doubles per round (error squared), value iteration's gain two indices per step (error times 1/φ4≈0.1461/\varphi^4\approx0.146).
  • Modified and λ-policy iteration are inexact or damped Newton methods, and acting by lookahead on a learned value is a Newton step from it.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

In policy iteration's Newton step from VπkV^{\pi_k}, which matrix plays the role of the Jacobian of F(V)=T⋆V−VF(V)=\mathcal T^\star V-V?

  1. γPπk−I\gamma P^{\pi_k}-I, from the current policy
  2. I−γPπ⋆I-\gamma P^{\pi^\star}, from an optimal policy
  3. The Hessian of VV
  4. γPπk+1−I\gamma P^{\pi_{k+1}}-I, from the policy greedy for VπkV^{\pi_k}
Show the answer

D. γPπk+1−I\gamma P^{\pi_{k+1}}-I, from the policy greedy for VπkV^{\pi_k}

FF is affine on the region where πk+1\pi_{k+1} is greedy, with slope γPπk+1−I\gamma P^{\pi_{k+1}}-I. Solving the linearization there gives Vπk+1V^{\pi_{k+1}}, the next policy's value.

Question 2

In the scalar LQR example, policy iteration's errors are about 0.380.38, 7×10−37\times10^{-3} and 3×10−63\times10^{-6}. About how large is the next one?

  1. 10−610^{-6}
  2. 10−910^{-9}
  3. 10−1210^{-12}
  4. 10−2410^{-24}
Show the answer

C. 10−1210^{-12}

Quadratic convergence squares the error up to a constant: (3×10−6)2≈10−11(3\times10^{-6})^2\approx10^{-11}, times a constant of about 0.065, gives 6.5×10−136.5\times10^{-13}, matching the exact iterate F31/F30F_{31}/F_{30}.

Question 3

A finite MDP has action gap Δ\Delta. Policy iteration reaches ∥Vπk−V⋆∥∞<Δ/(2γ)\norm{V^{\pi_k}-V^\star}_\infty<\Delta/(2\gamma). What happens next?

  1. The next policy is optimal, so Vπk+1=V⋆V^{\pi_{k+1}}=V^\star
  2. The error keeps shrinking by a factor γ\gamma per round
  3. The greedy policy may still pick non-optimal actions
  4. Policy iteration must switch to value iteration to finish
Show the answer

A. The next policy is optimal, so Vπk+1=V⋆V^{\pi_{k+1}}=V^\star

One-step lookaheads computed from VπkV^{\pi_k} are within γ∥Vπk−V⋆∥∞<Δ/2\gamma\norm{V^{\pi_k}-V^\star}_\infty<\Delta/2 of the true Q⋆Q^\star, so no non-optimal action can win the argmax. The greedy policy is optimal and its exact evaluation is V⋆V^\star.

Question 4

In the cost-minimizing LQR example, Hewer's policy iteration produces Pk=2, 13/8, 610/377,…P_k=2,\ 13/8,\ 610/377,\dots, decreasing to φ\varphi. Why does it approach from above?

  1. Because the initial gain was chosen too large
  2. Because value iteration approaches from below and the two must differ
  3. Each PkP_k is the cost of an actual stabilizing policy, so it is at least P⋆P^\star, and improvement never makes it worse
  4. Because Newton's method always overshoots
Show the answer

C. Each PkP_k is the cost of an actual stabilizing policy, so it is at least P⋆P^\star, and improvement never makes it worse

Policy iteration only ever evaluates real policies, whose costs are at least the optimal cost, and the improvement theorem (for costs: never larger) makes the sequence monotone. Value iteration from P0=0P_0=0 instead counts the optimal cost of ever-longer horizons, which is why it approaches from below.

Further reading

  • M. L. Puterman & S. L. Brumelle, "On the convergence of policy iteration in stationary dynamic programming," Mathematics of Operations Research 4(1), 60–69 (1979).
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, ch. 6 (Wiley, 1994).
  • G. A. Hewer, "An iterative technique for the computation of the steady state gains for the discrete optimal regulator," IEEE Transactions on Automatic Control 16(4), 382–384 (1971).
  • M. Gargiani, A. Zanelli, D. Liao-McPherson, T. H. Summers & J. Lygeros, "Dynamic programming through the lens of semismooth Newton-type methods," IEEE Control Systems Letters (2022).
  • D. P. Bertsekas, Lessons from AlphaZero for Optimal, Model Predictive, and Adaptive Control (Athena Scientific, 2022).