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 . For a candidate approximation , the residual is:
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 states and require the Bellman equation to hold exactly at these points:
It helps to define the parametric Bellman operator by , the Bellman operator evaluated at collocation point . Let be the matrix with entries . Then the collocation equations become .
Under function iteration, the current coefficients produce the target values at the collocation points. The linear system 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: . The Jacobian is , where the Envelope Theorem (Step 4) gives us . Here is the optimal action at collocation point 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 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 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_newCollocation 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:
where is a weight function (often the stationary distribution in RL applications, or simply ). Expanding this:
Function iteration for Galerkin works differently than for collocation. Given , we cannot simply evaluate the Bellman operator and fit. Instead, we must solve an integral equation. At each iteration, we seek satisfying:
The left side is a linear system (the “mass matrix” ), and the right side requires integrating the Bellman operator output against each test function. When the basis functions are orthogonal polynomials with matching weight , 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 , and we need . The Jacobian entry is:
The Envelope Theorem gives , 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 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.
Exercises: Collocation and Galerkin
Effect of collocation points. For the optimal stopping problem, compare collocation with Chebyshev nodes versus equally-spaced nodes. Which choice gives smaller maximum error?
Threshold location. The optimal stopping policy has a threshold structure. Using your polynomial approximation , estimate the threshold by finding where . Compare to the exact threshold.
Orthogonal polynomials. For , write out the Galerkin conditions using Chebyshev polynomials and weight . What makes this choice computationally convenient?
Newton vs. function iteration. How does the iteration count depend on ? Try .
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 , the Galerkin orthogonality conditions
become weighted sums over states:
where with is a probability distribution over states. Define the feature matrix with entries (each row contains the features for one state), and let be the diagonal matrix with the state distribution on the diagonal.
Policy Evaluation: LSTD¶
For policy evaluation with a fixed policy , the Bellman operator is linear:
With linear function approximation , this becomes:
Let be the vector of rewards , and be the transition matrix with . Then in vector form.
The Galerkin conditions require for all basis functions, which in matrix form is:
Rearranging:
This is the LSTD (Least Squares Temporal Difference) solution. The matrix and vector give the linear system .
When is the stationary distribution of policy (so ), this system has a unique solution, and the projected Bellman operator is a contraction in the weighted norm . 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 states and basis functions, what are the dimensions of , , , and the matrix ?
Worked Example: LSTD for Policy Evaluation¶
To illustrate LSTD concretely, consider a 3-state Markov chain under a fixed policy:
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:
The Galerkin conditions become:
where the Bellman operator must be evaluated at each state to find the optimal action and compute the target value. This is a system of nonlinear equations in unknowns.
Function iteration applies the Bellman operator and projects back. Given , compute the greedy policy at each state, then solve:
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 as a rootfinding problem and uses the Jacobian to accelerate convergence. The Jacobian of is:
To compute , we use the Envelope Theorem from Step 4. At the current , let be the optimal action at state . Then:
Define the policy . The Jacobian becomes:
The Newton update simplifies. We have:
At each state , the greedy value is , which equals . Thus:
The Newton step becomes:
Multiplying through and simplifying:
This is LSPI (Least Squares Policy Iteration). Each Newton step:
Computes the greedy policy
Solves the LSTD equation for this policy to get
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 and 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 . The orthogonality conditions for all define a linear system with a closed-form solution. These equations arise from minimizing 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 induced by an inner product , minimizing with respect to parameters requires . Since , the chain rule gives . Minimizing the residual norm is thus equivalent to requiring orthogonality for all . The equivalence holds for any choice of inner product: weighted integrals for Galerkin, sums over collocation points for collocation, or sampled expectations for neural networks.
For nonlinear function classes parameterized by (neural networks, kernel expansions), the same minimization principle applies:
The first-order stationarity condition yields orthogonality:
The test functions are now the partial derivatives , which span the tangent space to the manifold at the current parameters. In the linear case , the partial derivative recovers the fixed basis functions of Galerkin. For nonlinear parameterizations, the test functions change with , 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 used there are not classical functions. They are distributions, defined rigorously only through their action on test functions via . 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 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 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:
Apply the Bellman operator at collocation points: where
Fit new coefficients to match these targets: , giving
We can reinterpret this iteration in function space rather than coefficient space. Let be the projection operator that takes any function and returns its approximation in . For collocation, is the interpolation operator: is the unique linear combination of basis functions that matches at the collocation points. Then Step 2 can be written as: fit so that for all collocation points, which means .
In other words, function iteration is equivalent to projected value iteration in function space:
We know that standard value iteration converges because is a -contraction in the sup norm. But now we’re iterating with the composed operator instead of alone.
This 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 , then project it back onto our approximation space to get . The projection step defines an operator that depends on our choice of test functions:
For collocation, interpolates values at collocation points
For Galerkin, is orthogonal projection with respect to
For least squares, minimizes the weighted residual norm
But regardless of which projection method we use, iteration takes the form .
The central question is whether the composition inherits the contraction property of . 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 . 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 can represent . If , then and the error vanishes. Otherwise, the error is proportional to the approximation error , amplified by the factor .
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: 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:
| Method | Monotone? | Notes |
|---|---|---|
| Piecewise linear interpolation | Yes | Always an averager; guaranteed stability |
| Multilinear interpolation (grid) | Yes | Barycentric weights are nonnegative and sum to one |
| Shape-preserving splines (Schumaker) | Yes | Designed to maintain monotonicity |
| State aggregation | Yes | Exact averaging within groups |
| Kernel smoothing (positive kernels) | Yes | If kernel integrates to one |
| High-order polynomial interpolation | No | Oscillations violate monotonicity (Runge phenomenon) |
| Least squares projection (arbitrary basis) | No | Projection matrix may have negative entries |
| Fourier/spectral methods | No | Not monotone-preserving in general |
| Neural networks | No | Highly 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 , 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 between grid points and , the interpolated value is:
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 has the form:
where is a diagonal weight matrix and contains the basis function evaluations. This projection matrix typically has negative entries. To see why, consider a simple example with polynomial basis functions on . The projection of a function onto this space involves computing , 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 with Galerkin.
Least squares methods share the non-monotonicity issue. The least squares projection operator minimizes and has the same mathematical form as Galerkin projection. It is a linear projection onto 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.
Exercises: Monotonicity and Convergence
Verifying monotonicity. Consider piecewise linear interpolation on a 5-point grid. Write out the interpolation weights for a point between grid points 2 and 3. Verify that all weights are nonnegative and sum to one.
A non-monotone example. Using Lagrange interpolation with 4 equally spaced nodes on , compute the interpolation weights for the point . Show that some weights are negative.
State aggregation. Consider a discrete MDP with states aggregated into two groups: and . Write out the aggregation operator as a matrix.
Contraction constant. For the composed operator with a monotone , prove that the contraction constant is exactly .
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 is monotone (and constant-preserving), then is non-expansive in the sup norm . Since is a -contraction in the sup norm, their composition is also a -contraction in the sup norm, guaranteeing convergence of projected value iteration.
But what if 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 of a fixed policy , we can establish convergence by working in a different norm.
The Policy Evaluation Problem and LSTD¶
Consider the policy evaluation problem: given policy , we want to solve the policy Bellman equation , where and are the reward vector and transition matrix under . 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 generated by following . If the Markov chain induced by is ergodic, the state distribution converges to a stationary distribution satisfying .
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 , the least-squares temporal difference (LSTD) algorithm computes coefficients by solving:
where is the matrix of basis function evaluations and . 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 or explicitly represent the transition matrix . Instead, the practical algorithm accumulates sums from sampled transitions , incrementally building the matrices and 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 be the solution. Expanding the parentheses:
Moving all terms to the left side and factoring out :
Since and the policy Bellman operator is , we can write:
Let denote the -th column of , which contains the evaluations of the -th basis function at all states. The equation above says that for each :
But is exactly the -weighted inner product . So the residual is orthogonal to every basis function, and therefore orthogonal to the entire subspace .
By definition, the orthogonal projection of a vector onto a subspace is the unique vector in that subspace such that is orthogonal to the subspace. Here, lies in (since ), and we have just shown that is orthogonal to . Therefore, , where is orthogonal projection onto with respect to the -weighted inner product:
The weighting by is not arbitrary. Temporal difference learning performs stochastic updates using individual transitions: , with states sampled from . 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 -weighted projected Bellman operator. LSTD is an algorithm that computes this analytical fixed point.
Orthogonal Projection is Non-Expansive¶
Suppose is the steady-state distribution: . Our goal is to establish that is a contraction in . If we can establish that is non-expansive in this norm and that is a -contraction in , then their composition will be a -contraction:
First, we establish that orthogonal projection is non-expansive. For any vector , we can decompose , where is orthogonal to the subspace . By the Pythagorean theorem in the inner product:
Since , we have:
Taking square roots of both sides (which preserves the inequality since both norms are non-negative):
This holds for all , so is non-expansive in .
Contraction of in ¶
To show is a -contraction, we need to verify:
This will be at most if is non-expansive, meaning for any vector . We therefore need to establish that is non-expansive in .
Before reading the proof below, try to show that is non-expansive in . Hint: what property of relates it to ?
Consider the squared norm of . By definition of the weighted norm:
The -th component of is . This is a weighted average of the values with weights that sum to one. Therefore:
Since the function is convex, Jensen’s inequality applied to the probability distribution gives:
Substituting this into the norm expression:
The stationarity condition means for all . Therefore:
Taking square roots, , so is non-expansive in . This makes a -contraction in . Composing with the non-expansive projection:
By Banach’s fixed-point theorem, 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 norm and expect to be a contraction. Instead, the weighting must have a specific relationship with the transition matrix in the operator : namely, must be the stationary distribution of . 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 in the norm, and the composition inherits the contraction property.
In reinforcement learning, this has a practical interpretation. When we learn by following policy and collecting transitions , the states we visit are distributed according to the stationary distribution of . 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 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 itself (monotonicity, constant preservation) to guarantee that preserves the sup-norm contraction property of . Here, we place no such restriction on . Galerkin projection is not monotone. Instead, convergence depends on matching the norm to the operator. When 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 need not be non-expansive in , and may fail to contract. This explains divergence phenomena such as Baird’s counterexample Baird (1995).
Exercises: LSTD and the On-Policy Condition
Computing the stationary distribution. For the 3-state Markov chain in the LSTD example, compute the stationary distribution satisfying .
LSTD with stationary weighting. Recompute the LSTD solution using the stationary distribution instead of uniform weighting. Compare the approximation error.
Off-policy divergence. Consider a weighting that does not match the stationary distribution. Implement projected value iteration and observe whether it converges.
Proving non-expansiveness fails off-policy. For , find a vector such that .
The Bellman Optimality Case¶
Can we extend this weighted analysis to the Bellman optimality operator ? The answer is no, at least not with this approach. The obstacle appears at the Jensen inequality step. For policy evaluation, we had:
The inner term is a convex combination of the values , which allowed us to apply Jensen’s inequality to the convex function . For the optimal Bellman operator, we would need to bound:
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 is non-expansive in any weighted norm.
Is convergence of 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 , 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 define a fixed-point problem , where is a projection operator onto . We can solve this by iteration: . Under appropriate conditions (monotonicity of , 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 states. Let be the matrix of basis evaluations, the diagonal weight matrix, and the vector of Bellman operator evaluations: . The projection is:
This is weighted least-squares regression of on the targets . Collocation instead requires the exact interpolation 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 where , each method produces a function from the targets. The projection operator is one such approximation rule. Galerkin uses weighted projection, while square collocation uses exact interpolation at the selected points.
The operation may solve a linear system, run gradient descent, or train an ensemble. For a linear space , 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 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.
- Legrand, M., & Junca, S. (2025). Weighted Residual Solution Methods.
- 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
- Judd, K. L. (1992). Projection methods for solving aggregate growth models. Journal of Economic Theory, 58(2), 410–452.
- 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.
- McGrattan, E. R. (1997). Application of Weighted Residual Methods to Dynamic Economic Models.
- Santos, M. S., & Vigo-Aguiar, J. (1998). Analysis of a numerical dynamic programming algorithm applied to economic models. Econometrica, 66(2), 409–426.
- Stachurski, J. (2009). Economic Dynamics: Theory and Computation. MIT Press.
- Gordon, G. J. (1995). Stable function approximation in dynamic programming. Proceedings of the Twelfth International Conference on International Conference on Machine Learning, 261–268.
- Gordon, G. J. (1999). Approximate Solutions to Markov Decision Problems [Phdthesis]. Carnegie Mellon University.
- Baird, L. (1995). Residual algorithms: Reinforcement learning with function approximation. Proceedings of the Twelfth International Conference on Machine Learning, 30–37.