Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Approximate Bellman Equations

Weighted-residual methods specify approximation spaces and tests for a general functional equation. What changes when the residual contains a Bellman operator whose contraction properties are responsible for convergence?

Consider the Bellman optimality equation v(s)=Lv(s)=maxaAs{r(s,a)+γjSp(js,a)v(j)}v(s) = \Bellman v(s) = \max_{a \in \mathcal{A}_s} \{ r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j) \}. For a candidate approximation v^(s)=i=1nθiφi(s)\hat{v}(s) = \sum_{i=1}^n \theta_i \varphi_i(s), the residual is:

R(s;θ)=Lv^(s)v^(s)=maxaAs{r(s,a)+γjSp(js,a)v^(j)}i=1nθiφi(s).R(s; \theta) = \Bellman\hat{v}(s) - \hat{v}(s) = \max_{a \in \mathcal{A}_s} \left\{ r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) \hat{v}(j) \right\} - \sum_{i=1}^n \theta_i \varphi_i(s).

We examine how collocation and Galerkin, the two most common weighted residual methods for Bellman equations, specialize the general solution approaches from Step 4.

Collocation

For collocation, we choose nn states {s1,,sn}\{s_1, \ldots, s_n\} and require the Bellman equation to hold exactly at these points:

j=1nθjφj(si)=maxaAsi{r(si,a)+γjSp(jsi,a)=1nθφ(j)},i=1,,n.\sum_{j=1}^n \theta_j \varphi_j(s_i) = \max_{a \in \mathcal{A}_{s_i}} \left\{ r(s_i,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s_i,a) \sum_{\ell=1}^n \theta_\ell \varphi_\ell(j) \right\}, \quad i = 1, \ldots, n.

It helps to define the parametric Bellman operator Lφ:RnRn\mathrm{L}_\varphi: \mathbb{R}^n \to \mathbb{R}^n by [Lφ(θ)]i=[Lv^(;θ)](si)[\mathrm{L}_\varphi(\theta)]_i = [\Bellman\hat{v}(\cdot; \theta)](s_i), the Bellman operator evaluated at collocation point sis_i. Let Φ\boldsymbol{\Phi} be the n×nn \times n matrix with entries Φij=φj(si)\Phi_{ij} = \varphi_j(s_i). Then the collocation equations become Φθ=Lφ(θ)\boldsymbol{\Phi} \theta = \mathrm{L}_\varphi(\theta).

Under function iteration, the current coefficients θ(k)\theta^{(k)} produce the target values ti(k)=[Lφ(θ(k))]it_i^{(k)}=[\mathrm{L}_\varphi(\theta^{(k)})]_i at the collocation points. The linear system Φθ(k+1)=t(k)\boldsymbol{\Phi}\theta^{(k+1)}=t^{(k)} then interpolates those values. Each iteration therefore applies the Bellman operator and constructs its polynomial interpolant at the selected points.

When the state space is continuous, we approximate expectations using numerical quadrature (Gauss-Hermite for normal shocks, etc.). The method is simple and robust when the finite-dimensional approximation preserves contraction, but can be slow for large discount factors.

Newton’s method for collocation treats the problem as rootfinding: G(θ)=ΦθLφ(θ)=0G(\theta) = \boldsymbol{\Phi} \theta - \mathrm{L}_\varphi(\theta) = 0. The Jacobian is JG=ΦJLφJ_G = \boldsymbol{\Phi} - J_{\mathrm{L}_\varphi}, where the Envelope Theorem (Step 4) gives us [JLφ]ij=γsp(ssi,ai(θ))φj(s)[J_{\mathrm{L}_\varphi}]_{ij} = \gamma \sum_{s'} p(s'|s_i, a_i^*(\theta)) \varphi_j(s'). Here ai(θ)a_i^*(\theta) is the optimal action at collocation point sis_i given the current coefficients.

This converges rapidly near the solution but requires good initialization and more computation per iteration than function iteration. The method is equivalent to policy iteration: each step evaluates the value of the current greedy policy, then improves it.

Why is collocation popular for Bellman equations? Because it avoids integration when testing the residual. We only evaluate the Bellman operator at nn discrete points. In contrast, Galerkin requires integrating the residual against each basis function.

Worked Example: Collocation on the Optimal Stopping Problem

Returning to our motivating example, let us trace through the collocation algorithm with n=4n = 4 polynomial basis functions at Chebyshev nodes:

Source
import numpy as np
from scipy.integrate import quad

gamma = 0.9
n = 4

# Chebyshev nodes on [0, 1]
k = np.arange(1, n + 1)
nodes = 0.5 + 0.5 * np.cos((2*k - 1) * np.pi / (2*n))
nodes = np.sort(nodes)

# Vandermonde matrix
Phi = np.vander(nodes, n, increasing=True)

# Exact solution
v_bar_exact = (1 - np.sqrt(1 - gamma**2)) / gamma**2
s_star_exact = gamma * v_bar_exact
def v_exact(s):
    return np.where(s >= s_star_exact, s, gamma * v_bar_exact)

# Collocation iteration
theta = np.zeros(n)
print("Collocation iteration trace:")
print(f"{'Iter':<6} {'||theta||':<12} {'Max error':<12}")
print("-" * 30)

for iteration in range(15):
    def v_approx(s, th=theta):
        return sum(th[j] * s**j for j in range(n))
    v_bar, _ = quad(v_approx, 0, 1)
    test_points = np.linspace(0, 1, 100)
    max_error = max(abs(v_approx(s) - v_exact(s)) for s in test_points)
    print(f"{iteration:<6} {np.linalg.norm(theta):<12.6f} {max_error:<12.6f}")
    
    targets = np.maximum(nodes, gamma * v_bar)
    theta_new = np.linalg.solve(Phi, targets)
    if np.linalg.norm(theta_new - theta) < 1e-10:
        print(f"\nConverged in {iteration + 1} iterations")
        break
    theta = theta_new
Collocation iteration trace:
Iter   ||theta||    Max error   
------------------------------
0      0.000000     1.000000    
1      1.000000     0.626789    
2      1.613062     0.198576    
3      0.706118     0.087935    
4      1.044850     0.039335    
5      1.292433     0.032162    
6      1.412062     0.033449    
7      1.467070     0.034028    
8      1.492030     0.034289    
9      1.503301     0.034406    
10     1.508381     0.034459    
11     1.510668     0.034483    
12     1.511698     0.034493    
13     1.512161     0.034498    
14     1.512370     0.034500    

Galerkin

For Galerkin, we use the basis functions themselves as test functions. The conditions are:

S[Lv^(s;θ)v^(s;θ)]φi(s)w(s)ds=0,i=1,,n.\int_{\mathcal{S}} [\Bellman\hat{v}(s; \theta) - \hat{v}(s; \theta)] \varphi_i(s) w(s) ds = 0, \quad i = 1, \ldots, n.

where w(s)w(s) is a weight function (often the stationary distribution dπ(s)d^\pi(s) in RL applications, or simply w(s)=1w(s) = 1). Expanding this:

S[maxa{r(s,a)+γE[v(s)]}jθjφj(s)]φi(s)w(s)ds=0.\int_{\mathcal{S}} \left[ \max_a \left\{ r(s,a) + \gamma \mathbb{E}[v(s')] \right\} - \sum_j \theta_j \varphi_j(s) \right] \varphi_i(s) w(s) ds = 0.

Function iteration for Galerkin works differently than for collocation. Given θ(k)\theta^{(k)}, we cannot simply evaluate the Bellman operator and fit. Instead, we must solve an integral equation. At each iteration, we seek θ(k+1)\theta^{(k+1)} satisfying:

Sjθj(k+1)φj(s)φi(s)w(s)ds=S[Lv^(s;θ(k))]φi(s)w(s)ds.\int_{\mathcal{S}} \sum_j \theta_j^{(k+1)} \varphi_j(s) \varphi_i(s) w(s) ds = \int_{\mathcal{S}} [\Bellman\hat{v}(s; \theta^{(k)})] \varphi_i(s) w(s) ds.

The left side is a linear system (the “mass matrix” Mij=φiφjwM_{ij} = \int \varphi_i \varphi_j w), and the right side requires integrating the Bellman operator output against each test function. When the basis functions are orthogonal polynomials with matching weight ww, the mass matrix is diagonal, simplifying the solve. But we still need numerical integration to evaluate the right side. This makes Galerkin substantially more expensive than collocation per iteration.

Newton’s method for Galerkin similarly requires integration. The residual is R(s;θ)=Lv^(s;θ)v^(s;θ)R(s; \theta) = \Bellman\hat{v}(s; \theta) - \hat{v}(s; \theta), and we need Gi(θ)=R(s;θ)φi(s)w(s)ds=0G_i(\theta) = \int R(s; \theta) \varphi_i(s) w(s) ds = 0. The Jacobian entry is:

Jij=[Lv^(s;θ)θjφj(s)]φi(s)w(s)ds.J_{ij} = \int \left[ \frac{\partial \Bellman\hat{v}(s; \theta)}{\partial \theta_j} - \varphi_j(s) \right] \varphi_i(s) w(s) ds.

The Envelope Theorem gives Lv^(s;θ)θj=γE[φj(s)s,a(s;θ)]\frac{\partial \Bellman\hat{v}(s; \theta)}{\partial \theta_j} = \gamma \mathbb{E}[\varphi_j(s') \mid s, a^*(s;\theta)], so we must integrate expected basis function values (under optimal actions) against test functions and weight. This requires both numerical integration and careful tracking of optimal actions across the state space, making it substantially more complex than collocation’s pointwise evaluation.

The advantage of Galerkin over collocation lies in its theoretical properties: when using orthogonal polynomials, Galerkin provides optimal approximation in the weighted L2L^2 norm. For smooth problems, this can yield better accuracy per degree of freedom than collocation. In practice, collocation’s computational simplicity usually outweighs Galerkin’s theoretical optimality for Bellman equations, especially in high-dimensional problems where integration becomes prohibitively expensive.

The algorithms above reduce the infinite-dimensional Bellman fixed-point problem to finite-dimensional coefficient computation. Collocation avoids integration entirely by requiring exact satisfaction at discrete points, while Galerkin imposes weighted orthogonality conditions requiring numerical quadrature. Both can be solved via function iteration (when contraction is preserved) or Newton’s method (for faster convergence near the solution). The discrete MDP specialization below reveals connections to algorithms widely used in reinforcement learning.

Galerkin for Discrete MDPs: LSTD and LSPI

When the state space is discrete and finite, the Galerkin conditions simplify dramatically. The integrals become sums, and we can write everything in matrix form. This specialization shows the connection to algorithms widely used in reinforcement learning.

For a discrete state space S={s1,,sm}\mathcal{S} = \{s_1, \ldots, s_m\}, the Galerkin orthogonality conditions

S[Lv^(s;θ)v^(s;θ)]φi(s)w(s)ds=0\int_{\mathcal{S}} [\Bellman\hat{v}(s; \theta) - \hat{v}(s; \theta)] \varphi_i(s) w(s) ds = 0

become weighted sums over states:

sSξ(s)[Lv^(s;θ)v^(s;θ)]φi(s)=0,i=1,,n,\sum_{s \in \mathcal{S}} \xi(s) [\Bellman\hat{v}(s; \theta) - \hat{v}(s; \theta)] \varphi_i(s) = 0, \quad i = 1, \ldots, n,

where ξ(s)0\xi(s) \geq 0 with sξ(s)=1\sum_s \xi(s) = 1 is a probability distribution over states. Define the feature matrix ΦRm×n\boldsymbol{\Phi} \in \mathbb{R}^{m \times n} with entries Φsi=φi(s)\Phi_{si} = \varphi_i(s) (each row contains the features for one state), and let Ξ=diag(ξ)\boldsymbol{\Xi} = \text{diag}(\xi) be the diagonal matrix with the state distribution on the diagonal.

Policy Evaluation: LSTD

For policy evaluation with a fixed policy π\pi, the Bellman operator is linear:

[Lπv^](s)=r(s,π(s))+γjSp(js,π(s))v^(j).[\BellmanPi \hat{v}](s) = r(s, \pi(s)) + \gamma \sum_{j \in \mathcal{S}} p(j|s, \pi(s)) \hat{v}(j).

With linear function approximation v^(s)=φ(s)θ=iθiφi(s)\hat{v}(s) = \boldsymbol{\varphi}(s)^\top \theta = \sum_i \theta_i \varphi_i(s), this becomes:

[Lπv^](s)=r(s,π(s))+γjSp(js,π(s))iθiφi(j).[\BellmanPi \hat{v}](s) = r(s, \pi(s)) + \gamma \sum_{j \in \mathcal{S}} p(j|s, \pi(s)) \sum_i \theta_i \varphi_i(j).

Let rπRm\mathbf{r}_\pi \in \mathbb{R}^m be the vector of rewards [rπ]s=r(s,π(s))[\mathbf{r}_\pi]_s = r(s, \pi(s)), and PπRm×m\mathbf{P}_\pi \in \mathbb{R}^{m \times m} be the transition matrix with [Pπ]sj=p(js,π(s))[\mathbf{P}_\pi]_{sj} = p(j|s, \pi(s)). Then Lπv^=rπ+γPπΦθ\BellmanPi \hat{v} = \mathbf{r}_\pi + \gamma \mathbf{P}_\pi \boldsymbol{\Phi} \theta in vector form.

The Galerkin conditions require Lπv^v^,φiξ=0\langle \BellmanPi \hat{v} - \hat{v}, \varphi_i \rangle_\xi = 0 for all basis functions, which in matrix form is:

ΦΞ(rπ+γPπΦθΦθ)=0.\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\mathbf{r}_\pi + \gamma \mathbf{P}_\pi \boldsymbol{\Phi} \theta - \boldsymbol{\Phi} \theta) = \mathbf{0}.

Rearranging:

ΦΞ(ΦγPπΦ)θ=ΦΞrπ.\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_\pi \boldsymbol{\Phi}) \theta = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_\pi.

This is the LSTD (Least Squares Temporal Difference) solution. The matrix A=ΦΞ(ΦγPπΦ)\mathbf{A} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_\pi \boldsymbol{\Phi}) and vector b=ΦΞrπ\mathbf{b} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_\pi give the linear system Aθ=b\mathbf{A} \theta = \mathbf{b}.

When ξ\xi is the stationary distribution of policy π\pi (so ξPπ=ξ\xi^\top \mathbf{P}_\pi = \xi^\top), this system has a unique solution, and the projected Bellman operator PLπ\Proj \BellmanPi is a contraction in the weighted L2L^2 norm ξ\|\cdot\|_\xi. This is the theoretical foundation for TD learning with linear function approximation. The fixed point computed here is the same one that TD(0) converges to stochastically; we derive the incremental algorithm in the Monte Carlo chapter.

Check that the dimensions work out: if we have mm states and nn basis functions, what are the dimensions of Φ\boldsymbol{\Phi}, Ξ\boldsymbol{\Xi}, Pπ\mathbf{P}_\pi, and the matrix A=ΦΞ(ΦγPπΦ)\mathbf{A} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi}(\boldsymbol{\Phi} - \gamma \mathbf{P}_\pi \boldsymbol{\Phi})?

Worked Example: LSTD for Policy Evaluation

To illustrate LSTD concretely, consider a 3-state Markov chain under a fixed policy:

Pπ=(0.70.20.10.30.40.30.10.30.6),rπ=(120).\mathbf{P}_\pi = \begin{pmatrix} 0.7 & 0.2 & 0.1 \\ 0.3 & 0.4 & 0.3 \\ 0.1 & 0.3 & 0.6 \end{pmatrix}, \quad \mathbf{r}_\pi = \begin{pmatrix} 1 \\ 2 \\ 0 \end{pmatrix}.
Source
import numpy as np

P_pi = np.array([[0.7, 0.2, 0.1], [0.3, 0.4, 0.3], [0.1, 0.3, 0.6]])
r_pi = np.array([1.0, 2.0, 0.0])
gamma = 0.9

# Feature matrix: phi_1(s) = 1, phi_2(s) = s
states = np.array([1, 2, 3])
Phi = np.column_stack([np.ones(3), states])

# Uniform weighting
xi = np.ones(3) / 3
Xi = np.diag(xi)

# LSTD matrices
A = Phi.T @ Xi @ (Phi - gamma * P_pi @ Phi)
b = Phi.T @ Xi @ r_pi

theta_lstd = np.linalg.solve(A, b)
v_lstd = Phi @ theta_lstd
v_exact = np.linalg.solve(np.eye(3) - gamma * P_pi, r_pi)

print(f"LSTD solution: theta = ({theta_lstd[0]:.4f}, {theta_lstd[1]:.4f})")
print(f"\n{'State':<8} {'Exact':<12} {'LSTD':<12} {'Error':<12}")
print("-" * 44)
for s in range(3):
    print(f"{s+1:<8} {v_exact[s]:<12.4f} {v_lstd[s]:<12.4f} {v_lstd[s] - v_exact[s]:<12.4f}")

# Verify orthogonality
residual = r_pi + gamma * P_pi @ v_lstd - v_lstd
print(f"\nGalerkin orthogonality: <residual, phi_1> = {np.sum(xi * residual * Phi[:,0]):.6f}")
LSTD solution: theta = (12.2772, -0.9901)

State    Exact        LSTD         Error       
--------------------------------------------
1        10.0207      11.2871      1.2664      
2        10.8717      10.2970      -0.5746     
3        8.3418       9.3069       0.9652      

Galerkin orthogonality: <residual, phi_1> = 0.000000

The Bellman Optimality Equation: Function Iteration and Newton’s Method

For the Bellman optimality equation, the max operator introduces nonlinearity:

[Lv^](s)=maxaAs{r(s,a)+γjSp(js,a)v^(j)}.[\Bellman\hat{v}](s) = \max_{a \in \mathcal{A}_s} \left\{ r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) \hat{v}(j) \right\}.

The Galerkin conditions become:

F(θ)ΦΞ(Lv^(;θ)Φθ)=0,F(\theta) \equiv \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\Bellman\hat{v}(\cdot; \theta) - \boldsymbol{\Phi} \theta) = \mathbf{0},

where the Bellman operator must be evaluated at each state ss to find the optimal action and compute the target value. This is a system of nn nonlinear equations in nn unknowns.

Function iteration applies the Bellman operator and projects back. Given θ(k)\theta^{(k)}, compute the greedy policy π(k)(s)=argmaxa{r(s,a)+γjSp(js,a)φ(j)θ(k)}\pi^{(k)}(s) = \arg\max_a \{r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) \boldsymbol{\varphi}(j)^\top \theta^{(k)}\} at each state, then solve:

ΦΞ(ΦγPπ(k)Φ)θ(k+1)=ΦΞrπ(k).\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi}) \theta^{(k+1)} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_{\pi^{(k)}}.

This evaluates the current greedy policy using LSTD, then implicitly improves by computing a new greedy policy at the next iteration. However, convergence can be slow when the finite-dimensional approximation poorly preserves contraction.

Newton’s method treats G(θ)=0G(\theta) = 0 as a rootfinding problem and uses the Jacobian to accelerate convergence. The Jacobian of GG is:

JG(θ)=Gθ=ΦΞ(Lv^(;θ)θΦ).J_G(\theta) = \frac{\partial G}{\partial \theta} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \left( \frac{\partial \Bellman\hat{v}(\cdot; \theta)}{\partial \theta} - \boldsymbol{\Phi} \right).

To compute Lv^(s;θ)θj\frac{\partial \Bellman\hat{v}(s; \theta)}{\partial \theta_j}, we use the Envelope Theorem from Step 4. At the current θ(k)\theta^{(k)}, let a(s;θ(k))a^*(s; \theta^{(k)}) be the optimal action at state ss. Then:

[Lv^](s;θ(k))θj=γjSp(js,a(s;θ(k)))φj(j).\frac{\partial [\Bellman\hat{v}](s; \theta^{(k)})}{\partial \theta_j} = \gamma \sum_{j \in \mathcal{S}} p(j|s, a^*(s; \theta^{(k)})) \varphi_j(j).

Define the policy π(k)(s)=a(s;θ(k))\pi^{(k)}(s) = a^*(s; \theta^{(k)}). The Jacobian becomes:

JG(θ(k))=ΦΞ(γPπ(k)ΦΦ)=ΦΞ(ΦγPπ(k)Φ).J_G(\theta^{(k)}) = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi} - \boldsymbol{\Phi}) = -\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi}).

The Newton update θ(k+1)=θ(k)JG(θ(k))1G(θ(k))\theta^{(k+1)} = \theta^{(k)} - J_G(\theta^{(k)})^{-1} G(\theta^{(k)}) simplifies. We have:

G(θ(k))=ΦΞ(Lv^(;θ(k))Φθ(k)).G(\theta^{(k)}) = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\Bellman\hat{v}(\cdot; \theta^{(k)}) - \boldsymbol{\Phi} \theta^{(k)}).

At each state ss, the greedy value is [Lv^(;θ(k))](s)=r(s,π(k)(s))+γjp(js,π(k)(s))φ(j)θ(k)[\Bellman\hat{v}(\cdot; \theta^{(k)})](s) = r(s, \pi^{(k)}(s)) + \gamma \sum_j p(j|s, \pi^{(k)}(s)) \boldsymbol{\varphi}(j)^\top \theta^{(k)}, which equals [Lπ(k)v^(;θ(k))](s)[\mathrm{L}_{\pi^{(k)}} \hat{v}(\cdot; \theta^{(k)})](s). Thus:

G(θ(k))=ΦΞ(rπ(k)+γPπ(k)Φθ(k)Φθ(k)).G(\theta^{(k)}) = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\mathbf{r}_{\pi^{(k)}} + \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi} \theta^{(k)} - \boldsymbol{\Phi} \theta^{(k)}).

The Newton step becomes:

θ(k+1)=θ(k)+[ΦΞ(ΦγPπ(k)Φ)]1ΦΞ(rπ(k)+γPπ(k)Φθ(k)Φθ(k)).\theta^{(k+1)} = \theta^{(k)} + [\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi})]^{-1} \boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\mathbf{r}_{\pi^{(k)}} + \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi} \theta^{(k)} - \boldsymbol{\Phi} \theta^{(k)}).

Multiplying through and simplifying:

ΦΞ(ΦγPπ(k)Φ)θ(k+1)=ΦΞrπ(k).\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_{\pi^{(k)}} \boldsymbol{\Phi}) \theta^{(k+1)} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_{\pi^{(k)}}.

This is LSPI (Least Squares Policy Iteration). Each Newton step:

  1. Computes the greedy policy π(k)(s)=argmaxa{r(s,a)+γjp(js,a)φ(j)θ(k)}\pi^{(k)}(s) = \arg\max_a \{r(s,a) + \gamma \sum_j p(j|s,a) \boldsymbol{\varphi}(j)^\top \theta^{(k)}\}

  2. Solves the LSTD equation for this policy to get θ(k+1)\theta^{(k+1)}

Newton’s method for the Galerkin-projected Bellman optimality equation is equivalent to policy iteration in the function approximation setting. Just as Newton’s method for collocation corresponded to policy iteration (Step 4), Newton’s method for discrete Galerkin gives LSPI.

Galerkin projection with linear function approximation reduces policy iteration to a sequence of linear systems, each solvable in closed form. For discrete MDPs, we can compute the matrices ΦΞΦ\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \boldsymbol{\Phi} and ΦΞPπΦ\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{P}_\pi \boldsymbol{\Phi} exactly.

Extension to Nonlinear Approximators

What remains of the residual formulation when the value function is represented by a nonlinear model rather than a linear basis expansion?

The weighted residual methods developed so far have focused on linear function classes: polynomial bases, piecewise linear interpolants, and linear combinations of fixed basis functions. Neural networks, kernel methods, and decision trees do not fit this template. How does the framework extend to nonlinear approximators?

Recall the Galerkin approach for linear approximation vθ=i=1dθiφiv_{\boldsymbol{\theta}} = \sum_{i=1}^d \theta_i \varphi_i. The orthogonality conditions vLv,φiw=0\langle v - \Bellman v, \varphi_i \rangle_w = 0 for all ii define a linear system with a closed-form solution. These equations arise from minimizing vLvw2\|v - \Bellman v\|_w^2 over the subspace, since at the minimum, the gradient with respect to each coefficient must vanish. The connection between norm minimization and orthogonality holds generally. For any norm w\|\cdot\|_w induced by an inner product ,w\langle \cdot, \cdot \rangle_w, minimizing f(θ)w2\|f(\boldsymbol{\theta})\|_w^2 with respect to parameters requires θif(θ)w2=0\frac{\partial}{\partial \theta_i} \|f(\boldsymbol{\theta})\|_w^2 = 0. Since fw2=f,fw\|f\|_w^2 = \langle f, f \rangle_w, the chain rule gives 2f,fθiw=02\langle f, \frac{\partial f}{\partial \theta_i} \rangle_w = 0. Minimizing the residual norm is thus equivalent to requiring orthogonality f,fθiw=0\langle f, \frac{\partial f}{\partial \theta_i} \rangle_w = 0 for all ii. The equivalence holds for any choice of inner product: weighted L2L^2 integrals for Galerkin, sums over collocation points for collocation, or sampled expectations for neural networks.

For nonlinear function classes parameterized by θRp\boldsymbol{\theta} \in \mathbb{R}^p (neural networks, kernel expansions), the same minimization principle applies:

θ=argminθvθLvθw2.\boldsymbol{\theta}^* = \arg\min_{\boldsymbol{\theta}} \|v_{\boldsymbol{\theta}} - \Bellman v_{\boldsymbol{\theta}}\|_w^2.

The first-order stationarity condition yields orthogonality:

vθLvθ,vθθiw=0for all i.\Big\langle v_{\boldsymbol{\theta}} - \Bellman v_{\boldsymbol{\theta}}, \frac{\partial v_{\boldsymbol{\theta}}}{\partial \theta_i} \Big\rangle_w = 0 \quad \text{for all } i.

The test functions are now the partial derivatives vθθi\frac{\partial v_{\boldsymbol{\theta}}}{\partial \theta_i}, which span the tangent space to the manifold {vθ:θRp}\{v_{\boldsymbol{\theta}} : \boldsymbol{\theta} \in \mathbb{R}^p\} at the current parameters. In the linear case vθ=iθiφiv_{\boldsymbol{\theta}} = \sum_i \theta_i \varphi_i, the partial derivative vθθi=φi\frac{\partial v_{\boldsymbol{\theta}}}{\partial \theta_i} = \varphi_i recovers the fixed basis functions of Galerkin. For nonlinear parameterizations, the test functions change with θ\boldsymbol{\theta}, and the orthogonality conditions define a nonlinear system solved by iterative gradient descent.

The dual pairing formulation Legrand & Junca (2025) extends this framework to settings where test objects need not be regular functions. We have been informal about this distinction in our treatment of collocation, but the Dirac deltas δ(xxi)\delta(x - x_i) used there are not classical functions. They are distributions, defined rigorously only through their action on test functions via N(v),δ(xxi)=(Nv)(xi)\langle \Residual(v), \delta(x - x_i) \rangle = (\Residual v)(x_i). The simple calculus argument for orthogonality does not apply directly to such objects; the dual pairing framework provides the proper mathematical foundation. The induced dual norm N(v)=supw=1N(v),w\|\Residual(v)\|_* = \sup_{\|w\|=1} |\langle \Residual(v), w \rangle| measures residuals by their worst-case effect on test functions, a perspective that has inspired adversarial formulations Zang et al. (2020) where both trial and test functions are learned.

The minimum residual framework thus connects classical projection methods to modern function approximation. The unifying principle is orthogonality of residuals to test functions. Linear methods use fixed test functions and admit closed-form solutions. Nonlinear methods use parameter-dependent test functions and require iterative optimization.

We now turn to the question of convergence: when does the iteration vk+1=PLvkv_{k+1} = \Proj \Bellman v_k converge?

Monotone Projection and the Preservation of Contraction

Which approximation maps preserve order and sup-norm contraction when composed with a Bellman operator?

The informal discussion of shape preservation hints at a deeper theoretical question: when does the function iteration method converge? Recall from our discussion of collocation that function iteration proceeds in two steps:

  1. Apply the Bellman operator at collocation points: t(k)=v(θ(k))t^{(k)} = v(\theta^{(k)}) where ti(k)=Lv^(k)(si)t_i^{(k)} = \Bellman\hat{v}^{(k)}(s_i)

  2. Fit new coefficients to match these targets: Φθ(k+1)=t(k)\boldsymbol{\Phi} \theta^{(k+1)} = t^{(k)}, giving θ(k+1)=Φ1v(θ(k))\theta^{(k+1)} = \boldsymbol{\Phi}^{-1} v(\theta^{(k)})

We can reinterpret this iteration in function space rather than coefficient space. Let P\Proj be the projection operator that takes any function ff and returns its approximation in span{φ1,,φn}\text{span}\{\varphi_1, \ldots, \varphi_n\}. For collocation, P\Proj is the interpolation operator: (Pf)(s)(\Proj f)(s) is the unique linear combination of basis functions that matches ff at the collocation points. Then Step 2 can be written as: fit v^(k+1)\hat{v}^{(k+1)} so that v^(k+1)(si)=Lv^(k)(si)\hat{v}^{(k+1)}(s_i) = \Bellman\hat{v}^{(k)}(s_i) for all collocation points, which means v^(k+1)=P(Lv^(k))\hat{v}^{(k+1)} = \Proj(\Bellman\hat{v}^{(k)}).

In other words, function iteration is equivalent to projected value iteration in function space:

v^(k+1)=PLv^(k).\hat{v}^{(k+1)} = \Proj \Bellman \hat{v}^{(k)}.

We know that standard value iteration vk+1=Lvkv_{k+1} = \Bellman v_k converges because L\Bellman is a γ\gamma-contraction in the sup norm. But now we’re iterating with the composed operator PL\Proj \Bellman instead of L\Bellman alone.

This PL\Proj \Bellman structure is not specific to collocation. It is inherent in all projection methods. The general pattern is always the same: apply the Bellman operator to get a target function Lv^(k)\Bellman\hat{v}^{(k)}, then project it back onto our approximation space to get v^(k+1)\hat{v}^{(k+1)}. The projection step defines an operator P\Proj that depends on our choice of test functions:

But regardless of which projection method we use, iteration takes the form v^(k+1)=PLv^(k)\hat{v}^{(k+1)} = \Proj \Bellman\hat{v}^{(k)}.

The central question is whether the composition PL\Proj \Bellman inherits the contraction property of L\Bellman. If not, the iteration may diverge, oscillate, or converge to a spurious fixed point even though the original problem is well-posed.

Monotone Approximators and Stability

The answer turns out to depend on specific properties of the approximation operator P\Proj. This theory was developed independently across multiple research communities: computational economics Judd (1992)Judd (1996)McGrattan (1997)Santos & Vigo-Aguiar (1998), economic dynamics Stachurski (2009), and reinforcement learning Gordon (1995)Gordon (1999). These communities arrived at essentially the same mathematical conditions.

Monotonicity Implies Nonexpansiveness

It turns out that approximation operators satisfying simple structural properties automatically preserve contraction.

This proposition shows that monotonicity and constant preservation automatically imply nonexpansiveness. There is no need to verify this separately. The intuition is that a monotone, constant-preserving operator acts like a weighted average that respects order structure and cannot amplify differences between functions.

Preservation of Contraction

Combining nonexpansiveness with the contraction property of the Bellman operator yields the main stability result.

This error bound tells us that the fixed-point error is controlled by how well P\Proj can represent vv^*. If vRange(P)v^* \in \text{Range}(\Proj), then Pv=v\Proj v^* = v^* and the error vanishes. Otherwise, the error is proportional to the approximation error Pvv\|\Proj v^* - v^*\|_\infty, amplified by the factor (1γ)1(1-\gamma)^{-1}.

Averagers in Discrete-State Problems

For discrete-state problems, the monotonicity conditions have a natural interpretation as averaging with nonnegative weights. This characterization was developed by Gordon in the context of reinforcement learning.

Averagers automatically satisfy the monotonicity conditions: linearity follows from matrix multiplication, monotonicity follows from nonnegativity of entries, and constant preservation follows from row sums equaling one.

This specializes the Santos-Vigo-Aguiar theorem to discrete states, expressed in the probabilistic language of stochastic matrices. The stochastic matrix characterization connects to Markov chain theory: Pv\Proj v represents expected values after one transition, and the monotonicity property reflects the fact that expectations preserve order.

Examples of averagers include state aggregation (averaging values within groups), K-nearest neighbors (averaging over nearest states), kernel smoothing with positive kernels, and multilinear interpolation on grids (barycentric weights are nonnegative and sum to one). Counterexamples include linear least squares regression (projection matrix may have negative entries) and high-order polynomial interpolation (Runge phenomenon produces negative weights).

The following table summarizes which common approximation operators satisfy the monotonicity conditions:

MethodMonotone?Notes
Piecewise linear interpolationYesAlways an averager; guaranteed stability
Multilinear interpolation (grid)YesBarycentric weights are nonnegative and sum to one
Shape-preserving splines (Schumaker)YesDesigned to maintain monotonicity
State aggregationYesExact averaging within groups
Kernel smoothing (positive kernels)YesIf kernel integrates to one
High-order polynomial interpolationNoOscillations violate monotonicity (Runge phenomenon)
Least squares projection (arbitrary basis)NoProjection matrix may have negative entries
Fourier/spectral methodsNoNot monotone-preserving in general
Neural networksNoHighly flexible but no monotonicity guarantees

The distinction between “safe” (monotone) and “potentially unstable” (non-monotone) approximators provides rigorous foundation for the folk wisdom that linear interpolation is reliable while high-order polynomials can be dangerous for value iteration. But notice that the table’s verdict on “least squares projection” is somewhat abstract. It doesn’t specifically address the three weighted residual methods we introduced at the start of this chapter.

The choice of solution method determines which approximation operators are safe to use. Successive approximation (fixed-point iteration) requires monotone approximators to guarantee convergence. Rootfinding methods like Newton’s method do not require monotonicity. Stability depends on numerical properties of the Jacobian rather than contraction preservation. These considerations suggest hybrid strategies. One approach runs a few iterations with a monotone method to generate an initial guess, then switches to Newton’s method with a smooth approximation for rapid final convergence.

Connecting Back to Collocation, Galerkin, and Least Squares

We have now developed a general stability theory for projected value iteration and surveyed which approximation operators are monotone. But what does this mean for the three specific weighted residual methods we introduced at the start of this chapter: collocation, Galerkin, and least squares? Each method defines a different projection operator P\Proj, and we now need to determine which satisfy the monotonicity conditions that guarantee convergence.

Collocation with piecewise linear interpolation is monotone. When we use collocation with piecewise linear basis functions on a grid, the projection operator performs linear interpolation between grid points. At any state ss between grid points sis_i and si+1s_{i+1}, the interpolated value is:

(Pv)(s)=si+1ssi+1siv(si)+ssisi+1siv(si+1).(\Proj v)(s) = \frac{s_{i+1} - s}{s_{i+1} - s_i} v(s_i) + \frac{s - s_i}{s_{i+1} - s_i} v(s_{i+1}).

The interpolation weights (barycentric coordinates) are nonnegative and sum to one, making this an averager in Gordon’s sense. Therefore collocation with piecewise linear bases satisfies the monotonicity conditions and the Santos-Vigo-Aguiar stability theorem applies. The folk wisdom that “linear interpolation is safe for value iteration” has rigorous theoretical foundation.

Galerkin projection is generally not monotone. The Galerkin projection operator for a general basis {φ1,,φn}\{\varphi_1, \ldots, \varphi_n\} has the form:

P=Φ(ΦWΦ)1ΦW,\Proj = \boldsymbol{\Phi}(\boldsymbol{\Phi}^\top \mathbf{W} \boldsymbol{\Phi})^{-1} \boldsymbol{\Phi}^\top \mathbf{W},

where W\mathbf{W} is a diagonal weight matrix and Φ\boldsymbol{\Phi} contains the basis function evaluations. This projection matrix typically has negative entries. To see why, consider a simple example with polynomial basis functions {1,x,x2}\{1, x, x^2\} on [1,1][-1, 1]. The projection of a function onto this space involves computing (ΦWΦ)1(\boldsymbol{\Phi}^\top \mathbf{W} \boldsymbol{\Phi})^{-1}, and the resulting operator can map nonnegative functions to functions with negative values. This is the same phenomenon underlying the Runge phenomenon in high-order polynomial interpolation: the projection weights oscillate in sign.

Since Galerkin projection is not monotone, the sup norm contraction theory does not guarantee convergence of projected value iteration vk+1=PLvkv_{k+1} = \Proj \Bellman v_k with Galerkin.

Least squares methods share the non-monotonicity issue. The least squares projection operator minimizes N(f^)w2\|\Residual(\hat{f})\|_w^2 and has the same mathematical form as Galerkin projection. It is a linear projection onto span{φ1,,φn}\text{span}\{\varphi_1, \ldots, \varphi_n\} with respect to a weighted inner product. Like Galerkin, the projection matrix typically contains negative entries and violates monotonicity.

The monotone approximator framework successfully covers collocation with simple bases, but leaves two important methods, Galerkin and least squares, without convergence guarantees. These methods are used in least-squares temporal difference learning (LSTD) and modern reinforcement learning with linear function approximation. We need a different analytical framework to understand when these non-monotone projections lead to convergent algorithms.

Monotone projections (piecewise linear interpolation, state aggregation) automatically preserve the Bellman operator’s contraction property, guaranteeing convergence of projected value iteration. Non-monotone projections (Galerkin, high-order polynomials) may destroy contraction in the sup norm, requiring either different solution methods (Newton) or analysis in different norms. The next section develops the latter approach for policy evaluation.

Beyond Monotone Approximators

If an orthogonal projection is not monotone, which weighting and policy conditions can still make the projected Bellman map contractive?

The monotone approximator theory gives us a clean sufficient condition for convergence: if P\Proj is monotone (and constant-preserving), then P\Proj is non-expansive in the sup norm \|\cdot\|_\infty. Since L\Bellman is a γ\gamma-contraction in the sup norm, their composition PL\Proj \Bellman is also a γ\gamma-contraction in the sup norm, guaranteeing convergence of projected value iteration.

But what if P\Proj is not monotone? Can we still guarantee convergence? Galerkin and least squares projections typically violate monotonicity, yet they are widely used in practice, particularly in reinforcement learning through least-squares temporal difference learning (LSTD). In general, proving convergence for non-monotone projections is difficult. However, for the special case of policy evaluation, computing the value function vπv_\pi of a fixed policy π\pi, we can establish convergence by working in a different norm.

The Policy Evaluation Problem and LSTD

Consider the policy evaluation problem: given policy π\pi, we want to solve the policy Bellman equation vπ=rπ+γPπvπv_\pi = r_\pi + \gamma \mathbf{P}_\pi v_\pi, where rπr_\pi and Pπ\mathbf{P}_\pi are the reward vector and transition matrix under π\pi. This is the core computational task in policy iteration, actor-critic algorithms, and temporal difference learning. In reinforcement learning, we typically learn from sampled experience: trajectories (s0,a0,r1,s1,a1,r2,s2,)(s_0, a_0, r_1, s_1, a_1, r_2, s_2, \ldots) generated by following π\pi. If the Markov chain induced by π\pi is ergodic, the state distribution converges to a stationary distribution ξ\xi satisfying ξPπ=ξ\xi^\top \mathbf{P}_\pi = \xi^\top.

This distribution determines which states appear frequently in our data. States visited often contribute more samples and have more influence on any learned approximation. States visited rarely contribute little. For a linear approximation vθ(s)=jθjφj(s)v_\theta(s) = \sum_j \theta_j \varphi_j(s), the least-squares temporal difference (LSTD) algorithm computes coefficients by solving:

ΦΞ(ΦγPπΦ)θ=ΦΞrπ,\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} - \gamma \mathbf{P}_\pi \boldsymbol{\Phi}) \boldsymbol{\theta} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_\pi,

where Φ\boldsymbol{\Phi} is the matrix of basis function evaluations and Ξ=diag(ξ)\boldsymbol{\Xi} = \text{diag}(\xi). We write this matrix equation for analysis purposes, but the actual algorithm does not compute it this way. For large state spaces, we cannot enumerate all states to form Φ\boldsymbol{\Phi} or explicitly represent the transition matrix Pπ\mathbf{P}_\pi. Instead, the practical algorithm accumulates sums from sampled transitions (s,r,s)(s, r, s'), incrementally building the matrices ΦΞΦ\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \boldsymbol{\Phi} and ΦΞPπΦ\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{P}_\pi \boldsymbol{\Phi} without ever forming the full objects. The algorithm is derived from first principles through temporal difference learning, and the Galerkin perspective provides an interpretation of what it computes.

LSTD as Projected Bellman Equation

To see what this equation means, let v^=Φθ\hat{v} = \boldsymbol{\Phi} \boldsymbol{\theta} be the solution. Expanding the parentheses:

ΦΞΦθγΦΞPπΦθ=ΦΞrπ.\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \boldsymbol{\Phi} \boldsymbol{\theta} - \gamma \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{P}_\pi \boldsymbol{\Phi} \boldsymbol{\theta} = \boldsymbol{\Phi}^\top \boldsymbol{\Xi} \mathbf{r}_\pi.

Moving all terms to the left side and factoring out ΦΞ\boldsymbol{\Phi}^\top \boldsymbol{\Xi}:

ΦΞ(ΦθγPπΦθrπ)=0.\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\boldsymbol{\Phi} \boldsymbol{\theta} - \gamma \mathbf{P}_\pi \boldsymbol{\Phi} \boldsymbol{\theta} - \mathbf{r}_\pi) = \mathbf{0}.

Since v^=Φθ\hat{v} = \boldsymbol{\Phi} \boldsymbol{\theta} and the policy Bellman operator is Lπv^=rπ+γPπv^\BellmanPi \hat{v} = \mathbf{r}_\pi + \gamma \mathbf{P}_\pi \hat{v}, we can write:

ΦΞ(v^Lπv^)=0.\boldsymbol{\Phi}^\top \boldsymbol{\Xi} (\hat{v} - \BellmanPi \hat{v}) = \mathbf{0}.

Let φj\boldsymbol{\varphi}_j denote the jj-th column of Φ\boldsymbol{\Phi}, which contains the evaluations of the jj-th basis function at all states. The equation above says that for each jj:

φjΞ(v^Lπv^)=0.\boldsymbol{\varphi}_j^\top \boldsymbol{\Xi} (\hat{v} - \BellmanPi \hat{v}) = 0.

But φjΞ(v^Lπv^)\boldsymbol{\varphi}_j^\top \boldsymbol{\Xi} (\hat{v} - \BellmanPi \hat{v}) is exactly the ξ\xi-weighted inner product φj,v^Lπv^ξ\langle \boldsymbol{\varphi}_j, \hat{v} - \BellmanPi \hat{v} \rangle_\xi. So the residual v^Lπv^\hat{v} - \BellmanPi \hat{v} is orthogonal to every basis function, and therefore orthogonal to the entire subspace span(Φ)\text{span}(\boldsymbol{\Phi}).

By definition, the orthogonal projection Py\Proj y of a vector yy onto a subspace is the unique vector in that subspace such that yPyy - \Proj y is orthogonal to the subspace. Here, v^\hat{v} lies in span(Φ)\text{span}(\boldsymbol{\Phi}) (since v^=Φθ\hat{v} = \boldsymbol{\Phi} \boldsymbol{\theta}), and we have just shown that Lπv^v^\BellmanPi \hat{v} - \hat{v} is orthogonal to span(Φ)\text{span}(\boldsymbol{\Phi}). Therefore, v^=PLπv^\hat{v} = \Proj \BellmanPi \hat{v}, where P\Proj is orthogonal projection onto span(Φ)\text{span}(\boldsymbol{\Phi}) with respect to the ξ\xi-weighted inner product:

u,vξ=uΞv,vξ=vΞv,P=Φ(ΦΞΦ)1ΦΞ.\langle u, v \rangle_\xi = u^\top \boldsymbol{\Xi} v, \qquad \|v\|_\xi = \sqrt{v^\top \boldsymbol{\Xi} v}, \qquad \Proj = \boldsymbol{\Phi}(\boldsymbol{\Phi}^\top \boldsymbol{\Xi} \boldsymbol{\Phi})^{-1} \boldsymbol{\Phi}^\top \boldsymbol{\Xi}.

The weighting by ξ\xi is not arbitrary. Temporal difference learning performs stochastic updates using individual transitions: θk+1=θk+αk(r+γvθk(s)vθk(s))vθk(s)\theta_{k+1} = \theta_k + \alpha_k (r + \gamma v_{\theta_k}(s') - v_{\theta_k}(s)) \nabla v_{\theta_k}(s), with states sampled from ξ\xi. The ODE analysis of this stochastic process (Borkar-Meyn theory) shows convergence to a fixed point, which can be expressed in closed form as the ξ\xi-weighted projected Bellman operator. LSTD is an algorithm that computes this analytical fixed point.

Orthogonal Projection is Non-Expansive

Suppose ξ\xi is the steady-state distribution: ξPπ=ξ\xi^\top \mathbf{P}_\pi = \xi^\top. Our goal is to establish that PLπ\Proj \BellmanPi is a contraction in ξ\|\cdot\|_\xi. If we can establish that P\Proj is non-expansive in this norm and that Lπ\BellmanPi is a γ\gamma-contraction in ξ\|\cdot\|_\xi, then their composition will be a γ\gamma-contraction:

PLπvPLπwξLπvLπwξγvwξ.\|\Proj \BellmanPi v - \Proj \BellmanPi w\|_\xi \leq \|\BellmanPi v - \BellmanPi w\|_\xi \leq \gamma \|v - w\|_\xi.

First, we establish that orthogonal projection is non-expansive. For any vector vv, we can decompose v=Pv+(vPv)v = \Proj v + (v - \Proj v), where (vPv)(v - \Proj v) is orthogonal to the subspace span(Φ)\text{span}(\boldsymbol{\Phi}). By the Pythagorean theorem in the ξ\|\cdot\|_\xi inner product:

vξ2=Pvξ2+vPvξ2.\|v\|_\xi^2 = \|\Proj v\|_\xi^2 + \|v - \Proj v\|_\xi^2.

Since vPvξ20\|v - \Proj v\|_\xi^2 \geq 0, we have:

vξ2Pvξ2.\|v\|_\xi^2 \geq \|\Proj v\|_\xi^2.

Taking square roots of both sides (which preserves the inequality since both norms are non-negative):

Pvξvξ.\|\Proj v\|_\xi \leq \|v\|_\xi.

This holds for all vv, so P\Proj is non-expansive in ξ\|\cdot\|_\xi.

Contraction of Lπ\BellmanPi in ξ\|\cdot\|_\xi

To show Lπ=rπ+γPπ\BellmanPi = r_\pi + \gamma \mathbf{P}_\pi is a γ\gamma-contraction, we need to verify:

LπvLπwξ=γPπ(vw)ξ=γPπ(vw)ξ.\|\BellmanPi v - \BellmanPi w\|_\xi = \|\gamma \mathbf{P}_\pi (v - w)\|_\xi = \gamma \|\mathbf{P}_\pi (v - w)\|_\xi.

This will be at most γvwξ\gamma \|v - w\|_\xi if Pπ\mathbf{P}_\pi is non-expansive, meaning Pπzξzξ\|\mathbf{P}_\pi z\|_\xi \leq \|z\|_\xi for any vector zz. We therefore need to establish that Pπ\mathbf{P}_\pi is non-expansive in ξ\|\cdot\|_\xi.

Before reading the proof below, try to show that Pπ\mathbf{P}_\pi is non-expansive in ξ\|\cdot\|_\xi. Hint: what property of ξ\xi relates it to Pπ\mathbf{P}_\pi?

Consider the squared norm of Pπz\mathbf{P}_\pi z. By definition of the weighted norm:

Pπzξ2=sξ(s)[(Pπz)(s)]2.\|\mathbf{P}_\pi z\|_\xi^2 = \sum_s \xi(s) [(\mathbf{P}_\pi z)(s)]^2.

The ss-th component of Pπz\mathbf{P}_\pi z is (Pπz)(s)=sp(ss,π(s))z(s)(\mathbf{P}_\pi z)(s) = \sum_{s'} p(s'|s,\pi(s)) z(s'). This is a weighted average of the values z(s)z(s') with weights p(ss,π(s))p(s'|s,\pi(s)) that sum to one. Therefore:

Pπzξ2=sξ(s)[sp(ss,π(s))z(s)]2.\|\mathbf{P}_\pi z\|_\xi^2 = \sum_s \xi(s) \left[\sum_{s'} p(s'|s,\pi(s)) z(s')\right]^2.

Since the function xx2x \mapsto x^2 is convex, Jensen’s inequality applied to the probability distribution p(s,π(s))p(\cdot|s,\pi(s)) gives:

[sp(ss,π(s))z(s)]2sp(ss,π(s))z(s)2.\left[\sum_{s'} p(s'|s,\pi(s)) z(s')\right]^2 \leq \sum_{s'} p(s'|s,\pi(s)) z(s')^2.

Substituting this into the norm expression:

Pπzξ2sξ(s)sp(ss,π(s))z(s)2=sz(s)2sξ(s)p(ss,π(s)).\|\mathbf{P}_\pi z\|_\xi^2 \leq \sum_s \xi(s) \sum_{s'} p(s'|s,\pi(s)) z(s')^2 = \sum_{s'} z(s')^2 \sum_s \xi(s) p(s'|s,\pi(s)).

The stationarity condition ξPπ=ξ\xi^\top \mathbf{P}_\pi = \xi^\top means sξ(s)p(ss,π(s))=ξ(s)\sum_s \xi(s) p(s'|s,\pi(s)) = \xi(s') for all ss'. Therefore:

Pπzξ2sz(s)2ξ(s)=zξ2.\|\mathbf{P}_\pi z\|_\xi^2 \leq \sum_{s'} z(s')^2 \xi(s') = \|z\|_\xi^2.

Taking square roots, Pπzξzξ\|\mathbf{P}_\pi z\|_\xi \leq \|z\|_\xi, so Pπ\mathbf{P}_\pi is non-expansive in ξ\|\cdot\|_\xi. This makes Lπ=rπ+γPπ\BellmanPi = r_\pi + \gamma \mathbf{P}_\pi a γ\gamma-contraction in ξ\|\cdot\|_\xi. Composing with the non-expansive projection:

PLπvPLπwξLπvLπwξγvwξ.\|\Proj \BellmanPi v - \Proj \BellmanPi w\|_\xi \leq \|\BellmanPi v - \BellmanPi w\|_\xi \leq \gamma \|v - w\|_\xi.

By Banach’s fixed-point theorem, PLπ\Proj \BellmanPi has a unique fixed point and iterates converge from any initialization.

Interpretation: The On-Policy Condition

The result shows that convergence depends on matching the weighting to the operator. We cannot choose an arbitrary weighted L2L^2 norm and expect PLπ\Proj \BellmanPi to be a contraction. Instead, the weighting ξ\xi must have a specific relationship with the transition matrix Pπ\mathbf{P}_\pi in the operator Lπ\BellmanPi: namely, ξ\xi must be the stationary distribution of Pπ\mathbf{P}_\pi. This is what makes the weighted geometry compatible with the operator’s structure. When this match holds, Jensen’s inequality gives us non-expansiveness of Pπ\mathbf{P}_\pi in the ξ\|\cdot\|_\xi norm, and the composition PLπ\Proj \BellmanPi inherits the contraction property.

In reinforcement learning, this has a practical interpretation. When we learn by following policy π\pi and collecting transitions (s,a,r,s)(s, a, r, s'), the states we visit are distributed according to the stationary distribution of π\pi. This is on-policy learning. The LSTD algorithm uses data sampled from this distribution, which means the empirical weighting naturally matches the operator structure. Our analysis shows that the iterative algorithm vk+1=PLπvkv_{k+1} = \Proj \BellmanPi v_k converges to the same fixed point that LSTD computes in closed form.

This is fundamentally different from the monotone approximator theory. There, we required structural properties of P\Proj itself (monotonicity, constant preservation) to guarantee that P\Proj preserves the sup-norm contraction property of L\Bellman. Here, we place no such restriction on P\Proj. Galerkin projection is not monotone. Instead, convergence depends on matching the norm to the operator. When ξ\xi does not match the stationary distribution, as in off-policy learning where data comes from a different behavior policy, the Jensen inequality argument breaks down. The operator Pπ\mathbf{P}_\pi need not be non-expansive in ξ\|\cdot\|_\xi, and PLπ\Proj \BellmanPi may fail to contract. This explains divergence phenomena such as Baird’s counterexample Baird (1995).

The Bellman Optimality Case

Can we extend this weighted L2L^2 analysis to the Bellman optimality operator Lv=maxa[ra+γPav]\Bellman v = \max_a [r_a + \gamma \mathbf{P}_a v]? The answer is no, at least not with this approach. The obstacle appears at the Jensen inequality step. For policy evaluation, we had:

Pπzξ2=sξ(s)[sp(ss,π(s))z(s)]2.\|\mathbf{P}_\pi z\|_\xi^2 = \sum_s \xi(s) \left[\sum_{s'} p(s'|s,\pi(s)) z(s')\right]^2.

The inner term is a convex combination of the values z(s)z(s'), which allowed us to apply Jensen’s inequality to the convex function xx2x \mapsto x^2. For the optimal Bellman operator, we would need to bound:

[maxasp(ss,a)z(s)]2.\left[\max_{a} \sum_{s'} p(s'|s,a) z(s')\right]^2.

But the maximum of convex combinations is not itself a convex combination. It is a pointwise maximum. Jensen’s inequality does not apply. We cannot conclude that maxa[Paz]\max_a [\mathbf{P}_a z] is non-expansive in any weighted L2L^2 norm.

Is convergence of PL\Proj \Bellman with Galerkin projection impossible, or merely difficult to prove? The situation is subtle. In practice, fitted Q-iteration and approximate value iteration with neural networks often work well, suggesting that some form of stability exists. But there are also well-documented divergence examples (e.g., Q-learning with linear function approximation can diverge). The theoretical picture remains incomplete. Some results exist for restricted function classes or under strong assumptions on the MDP structure, but no general convergence guarantee like the policy evaluation result is available. The interplay between the max operator, the projection, and the norm geometry is not well understood. This is an active area of research in reinforcement learning theory.

Despite these theoretical gaps, the practical algorithm template is straightforward. We now present fitted-value iteration as a meta-algorithm that combines any supervised learning method with the Bellman operator.

Fitted-Value/Q Iteration (FVI/FQI)

How does projected fixed-point iteration become a repeated supervised fitting problem for values or action values?

We have developed weighted residual methods through abstract functional equations: choose test functions, impose orthogonality conditions R,piw=0\langle R, p_i \rangle_w = 0, solve for coefficients. What are we actually computing when we solve these equations by successive approximation? The answer is simpler than the formalism suggests: function iteration with a fitting step.

Recall that the weighted residual conditions vLv,piw=0\langle v - \Bellman v, p_i \rangle_w = 0 define a fixed-point problem v=PLvv = \Proj \Bellman v, where P\Proj is a projection operator onto span(Φ)\text{span}(\boldsymbol{\Phi}). We can solve this by iteration: vk+1=PLvkv_{k+1} = \Proj \Bellman v_k. Under appropriate conditions (monotonicity of P\Proj, or matching the weight to the operator for policy evaluation), this converges to a solution.

In parameter space, this iteration becomes a fitting procedure. Consider Galerkin projection with a finite state space of nn states. Let Φ\boldsymbol{\Phi} be the n×dn \times d matrix of basis evaluations, W\mathbf{W} the diagonal weight matrix, and y\mathbf{y} the vector of Bellman operator evaluations: yi=(Lvk)(si)y_i = (\Bellman v_k)(s_i). The projection is:

θk+1=(ΦWΦ)1ΦWy.\boldsymbol{\theta}_{k+1} = (\boldsymbol{\Phi}^\top \mathbf{W} \boldsymbol{\Phi})^{-1} \boldsymbol{\Phi}^\top \mathbf{W} \mathbf{y}.

This is weighted least-squares regression of Φθ\boldsymbol{\Phi}\boldsymbol{\theta} on the targets y\mathbf{y}. Collocation instead requires the exact interpolation Φθk+1=y\boldsymbol{\Phi}\boldsymbol{\theta}_{k+1}=\mathbf{y} at the selected points. In continuous state spaces, sampled states can approximate the Galerkin integrals and produce a finite-dimensional regression problem.

This extends beyond linear basis functions. Neural networks, decision trees, and kernel methods all implement variants of this procedure. Given data {(si,yi)}\{(s_i, y_i)\} where yi=(Lvk)(si)y_i = (\Bellman v_k)(s_i), each method produces a function vk+1:SRv_{k+1}: \mathcal{S} \to \mathbb{R} from the targets. The projection operator P\Proj is one such approximation rule. Galerkin uses weighted projection, while square collocation uses exact interpolation at the selected points.

The operation fit\mathtt{fit} may solve a linear system, run gradient descent, or train an ensemble. For a linear space F\mathcal{F}, weighted squared-error fitting gives the Galerkin projection. A square collocation system gives exact interpolation when its evaluation matrix is nonsingular. Fitted-value iteration alternates between generating Bellman targets and constructing a new function from them.

The following code demonstrates fitted-value iteration on the optimal stopping problem:

Source
import numpy as np
from sklearn.linear_model import Ridge
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline

gamma = 0.9
v_bar_exact = (1 - np.sqrt(1 - gamma**2)) / gamma**2
s_star_exact = gamma * v_bar_exact
def v_exact(s):
    return np.where(s >= s_star_exact, s, gamma * v_bar_exact)

def fitted_value_iteration(s_grid, gamma, degree, max_iter=50, tol=1e-6):
    X = s_grid.reshape(-1, 1)
    v = np.zeros(len(s_grid))
    
    for k in range(max_iter):
        # Use trapezoidal rule for E[v] under uniform distribution on [0,1]
        v_bar = np.trapezoid(v, s_grid)
        targets = np.maximum(s_grid, gamma * v_bar)
        
        model = make_pipeline(PolynomialFeatures(degree), Ridge(alpha=1e-6))
        model.fit(X, targets)
        v_new = model.predict(X)
        
        if np.linalg.norm(v_new - v) < tol:
            return v_new, k + 1
        v = v_new
    return v, max_iter

s_grid = np.linspace(0, 1, 50)
print(f"{'Degree':<10} {'Iterations':<12} {'Max Error':<12}")
print("-" * 34)
for deg in [3, 5, 8]:
    v, iters = fitted_value_iteration(s_grid, gamma, deg)
    max_error = np.max(np.abs(v - v_exact(s_grid)))
    print(f"{deg:<10} {iters:<12} {max_error:<12.6f}")
Degree     Iterations   Max Error   
----------------------------------
3          26           0.035112    
5          25           0.022469    
8          25           0.020715    

A limitation of FVI/FQI is that it assumes we can evaluate the Bellman operator exactly. Computing yi=(Lvk)(si)y_i = (\Bellman v_k)(s_i) requires knowing transition probabilities and summing over all next states. In practice, we often have only a simulator or observed data. The next chapter shows how to approximate these expectations from samples, connecting the fitted-value iteration framework to simulation-based methods.

Summary

Projected Bellman iteration composes an approximation map with a Bellman operator. Monotone interpolation and state aggregation preserve sup-norm contraction, while non-monotone projections require a compatible weighting and can lose the fixed-point guarantee. Fitted value and Q iteration expose the computational pattern: evaluate Bellman targets, fit an approximator, and repeat.

Exact target evaluation still assumes access to the transition probabilities or an exact expectation. How can the same Bellman update be estimated when the model supplies only samples? Monte Carlo Bellman estimation replaces the exact integral by sampled averages and makes their variance and maximization bias explicit.

Self-checks

Solution to Exercise 1

The approximation may be accurate under the weighted norm yet poor in that neglected region, leading to bad values or decisions there.

References
  1. Legrand, M., & Junca, S. (2025). Weighted Residual Solution Methods.
  2. Zang, Y., Bao, G., Ye, X., & Zhou, H. (2020). Weak adversarial networks for high-dimensional partial differential equations. Journal of Computational Physics, 411, 109409. 10.1016/j.jcp.2020.109409
  3. Judd, K. L. (1992). Projection methods for solving aggregate growth models. Journal of Economic Theory, 58(2), 410–452.
  4. Judd, K. L. (1996). Approximation, perturbation, and projection methods in economic analysis. In H. M. Amman, D. A. Kendrick, & J. Rust (Eds.), Handbook of Computational Economics (Vol. 1, pp. 509–585). Elsevier.
  5. McGrattan, E. R. (1997). Application of Weighted Residual Methods to Dynamic Economic Models.
  6. Santos, M. S., & Vigo-Aguiar, J. (1998). Analysis of a numerical dynamic programming algorithm applied to economic models. Econometrica, 66(2), 409–426.
  7. Stachurski, J. (2009). Economic Dynamics: Theory and Computation. MIT Press.
  8. Gordon, G. J. (1995). Stable function approximation in dynamic programming. Proceedings of the Twelfth International Conference on International Conference on Machine Learning, 261–268.
  9. Gordon, G. J. (1999). Approximate Solutions to Markov Decision Problems [Phdthesis]. Carnegie Mellon University.
  10. Baird, L. (1995). Residual algorithms: Reinforcement learning with function approximation. Proceedings of the Twelfth International Conference on Machine Learning, 30–37.