The Linear–Quadratic Regulator
The Riccati equation, certainty equivalence and LQR as a testbed for RL.
LQR is the one continuous-state control problem with an exact, closed-form solution, which made it both the workhorse of control engineering and the simplest serious testbed for reinforcement learning theory. This lesson proves the dynamic-programming solution with noise, states when the infinite-horizon Riccati equation yields a stabilizing controller and shows what goes wrong when it does not (discounting included), separates optimality from robustness, and asks how many samples it takes to learn LQR: by identifying the model, or by policy gradient on a non-convex but benign landscape.
What you’ll learn
- Prove by dynamic programming that finite-horizon LQR with additive noise has a quadratic cost-to-go, linear optimal feedback and the Riccati recursion, with gains that do not depend on the noise.
- State the conditions (stabilizability and detectability) under which the algebraic Riccati equation has a unique stabilizing solution, and construct examples in which a missing condition or discounting breaks stability.
- Explain certainty equivalence and the LQG separation principle, and why optimality does not imply robustness.
- Derive the LQR policy gradient and the gradient-domination inequality, and compare the guarantees for learning LQR with and without a model.
Finite horizon: the proof by dynamic programming
The claim holds at . Assume it at , with . Because has mean zero the cross terms vanish in expectation, and :
Let and , so that . Collect the terms in and complete the square:
So the stage cost plus the expected cost-to-go is
Since the unique minimizer is , and gives the Riccati recursion; enters only the constant. Finally , because is the minimum over of a sum of nonnegative terms.
Three remarks. The linear policy is not an assumption but the optimum among all policies, however complex. The Riccati recursion is value iteration on the set of quadratic functions, which it maps to itself, at a cost of per step. And the noise changes not what to do but only what it costs: this is certainty equivalence, exact for linear dynamics, quadratic costs and additive noise, and false in general.
Take with , cost per step, horizon and . What is the optimal expected total cost from ?
Show the answer
7
Backward: , , , and . So . The gains and are those of the noiseless problem; the noise adds exactly 1.
Infinite horizon: when the Riccati equation stabilizes
Start the recursion at . Then is the optimal cost of the -step problem, which can only grow with , so is nondecreasing in the positive semidefinite order. Stabilizability gives an upper bound: a stabilizing gain has a finite infinite-horizon cost , and no -step optimum exceeds it.
A bounded monotone sequence of symmetric matrices converges, and the limit solves the algebraic equation because the recursion's right-hand side is continuous.
Detectability makes the limit's gain stabilizing. Along the closed loop the cost is finite, so and ; the state then evolves essentially by alone, and an unstable mode could persist only unseen by the cost, which detectability rules out. Uniqueness, and convergence from every , follow from a comparison argument given in the texts cited.
Reinforcement learning usually discounts. Substituting and turns the discounted cost into an undiscounted one for the system , with the same gain. The theorem then guarantees only that is stable, that is : the discounted optimum may let the real system diverge, as long as it diverges more slowly than the discount shrinks the cost.
Take , , and . The scaled system has and , its Riccati solution is , and the discounted-optimal gain is . What is the true closed-loop multiplier ?
Show the answer
1.382
: the state grows by 38% per step, yet the discounted cost is finite because . The controller is optimal for its objective and unstable in reality, which is why a discount factor chosen too small can make an RL-trained controller unsafe.
Certainty equivalence, LQG and robustness
With noisy measurements and Gaussian noise, the optimal controller of the linear–quadratic–Gaussian (LQG) problem splits into two parts designed independently: a Kalman filter computes the state estimate , and the LQR gain acts on it, . This separation principle is certainty equivalence again: act as if the estimate were the truth. It is the cleanest instance of the recipe model-based RL uses everywhere, and it is exact only in the linear–quadratic–Gaussian world.
The cart of Optimal Control & Model Predictive Control behaves as these margins suggest. When the design model believes the cart weighs 1.9 kg instead of 1 kg, the real loop gain is 1.9 times the designed one, an increase of the kind LQR tolerates, and the cost rose only from 73.4 to 75.3, although the controller's own prediction of its cost, computed on the wrong model, was 91.7, about 22% too high. The guarantee is for continuous time, so the widget's 0.1 s steps make it suggestive, not a proof. Optimality is always relative to a model; robustness is a separate design goal.
Learning LQR: with a model, or by policy gradient
Recht (2019) argued that LQR with unknown and is the right first testbed for reinforcement learning methods: simple enough to analyze, rich enough to tell them apart. Two routes have sharp guarantees.
Identify, then control. Excite the system with random inputs, estimate by least squares, and design a controller for the estimate. Dean, Mania, Matni, Recht & Tu (2020) bounded the estimation error from independent rollouts and synthesized a robust controller that stabilizes every system within the error bounds; its cost exceeds the optimum by a relative amount of order , times a system-dependent constant, with probability once is large enough. Mania, Tu & Recht (2019) showed that the plain certainty-equivalent controller, the LQR gain of the estimate, does better once the parameter error is small: its suboptimality is of order rather than , although it needs a smaller before it is guaranteed to stabilize the true system. Online, certainty equivalence with simple random exploration achieves regret of order up to logarithmic factors, as an optimistic method had earlier (Abbasi-Yadkori & Szepesvári, 2011).
Policy gradient. Parameterize the controller as and descend , where is the closed loop's cost matrix. is not convex: Fazel, Ge, Kakade & Mesbahi (2018) give a system in which two gains have finite cost while their average does not stabilize. Yet gradient descent finds the global optimum.
Cost difference, the performance-difference lemma for LQR. Let and define the advantage . Telescoping along the trajectory of another stabilizing gain :
The advantage is quadratic. Expand with and , then complete the square in :
Sum along the optimal trajectory. Take , average over , and use and :
Convert to the gradient. and , so , which gives the bound with a factor to spare.
Gradient domination is the LQR instance of a pattern that also explains policy gradients in tabular MDPs (Global Convergence of Policy Gradients): a non-convex objective whose stationary points are all global optima. The catch is the start: every iterate must remain stabilizing, which needs a stabilizing initial gain and small enough steps, and finding a stabilizing gain without a model is a problem in its own right.
Open problems
Key takeaways
- Finite-horizon LQR is solved exactly by dynamic programming: the cost-to-go is , the optimal policy is , and additive noise changes only , not the gains.
- With stabilizability and detectability the algebraic Riccati equation has a unique positive semidefinite solution whose gain stabilizes. When the cost cannot see an unstable mode the "optimal" controller can let the state explode, and discounting weakens the guarantee to .
- Certainty equivalence and the LQG separation principle are exact for linear dynamics, quadratic costs and Gaussian noise; optimality still does not imply robustness, since LQR's margins do not survive the Kalman filter.
- Identify-then-control learns LQR with relative suboptimality of order (robust synthesis) or of order in the parameter error (certainty equivalence, once the error is small).
- Policy gradient on LQR is non-convex but gradient-dominated, so from a stabilizing start it converges to the global optimum at a linear rate.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
What does additive process noise change in the finite-horizon LQR solution?
- The gains, which shrink to avoid amplifying the noise
- Only the constant term of the cost-to-go: the expected cost grows by , while the gains stay the same
- The form of the policy, which must become stochastic
- Nothing at all
Show the answer
B. Only the constant term of the cost-to-go: the expected cost grows by , while the gains stay the same
The noise adds to the expected cost-to-go whatever the control, so it cannot change the minimizer: certainty equivalence. The cost of the optimal policy does rise.
For , , , , the Riccati recursion started at stays at and gives . Which condition of the theorem fails?
- Stabilizability
- Detectability: the cost cannot see the unstable state
- None; the theorem says is stabilizing
Show the answer
C. Detectability: the cost cannot see the unstable state
With the unstable mode is invisible to the cost, so doing nothing is optimal and the state explodes. The system is stabilizable (for example ) and .
Why can a discounted-optimal LQR controller be unstable?
- The discounted problem is undiscounted LQR for , so only is guaranteed
- Discounting makes the Riccati equation unsolvable
- Discounting changes the dynamics of the real system
- It cannot: discounting only reweights costs
Show the answer
A. The discounted problem is undiscounted LQR for , so only is guaranteed
Scaling states and controls by absorbs the discount into the dynamics, and the stability the theorem provides is for the scaled system. The real closed loop may grow at any rate below per step.
Fazel et al.'s global convergence result for policy gradient on LQR needs which of these?
- A convex cost
- Known matrices and
- A deterministic initial state
- A stabilizing initial gain and a full-rank covariance of the initial state
Show the answer
D. A stabilizing initial gain and a full-rank covariance of the initial state
A finite cost at the start keeps the iterates among stabilizing gains, and makes invertible, which turns a small gradient into a small suboptimality. The cost is not convex, and the model-free version estimates gradients from rollouts.
Further reading
- D. P. Bertsekas, Dynamic Programming and Optimal Control, Vol. I (Athena Scientific, 4th ed., 2017).
- M. Fazel, R. Ge, S. M. Kakade & M. Mesbahi, "Global convergence of policy gradient methods for the linear quadratic regulator," ICML (2018).
- S. Dean, H. Mania, N. Matni, B. Recht & S. Tu, "On the sample complexity of the linear quadratic regulator," Foundations of Computational Mathematics (2020).
- H. Mania, S. Tu & B. Recht, "Certainty equivalence is efficient for linear quadratic control," NeurIPS (2019).
- B. Recht, "A tour of reinforcement learning: the view from continuous control," Annual Review of Control, Robotics, and Autonomous Systems 2 (2019).