Contents · Optimal Control
Part 0 · LQR
- The LQR Problem
Part 1 · Dynamic Programming
Part 2 · Trajectory Optimization
Part 3 · MPC
Part 4 · Continuous Optimal Control
Part 0 · LQR
The LQR Problem
Most optimal-control problems have no closed form: you discretize, you iterate, you hope. The linear-quadratic regulator is the exception. Linear dynamics plus a quadratic cost collapse the whole infinite-horizon problem into one matrix equation, and the optimal policy comes out as a single constant gain. That closed form is why LQR is both a workhorse controller and the local model that iterative methods and reinforcement learning lean on.
Linear dynamics, quadratic cost
Take a discrete linear system with state and input ,
and charge a quadratic cost for both wandering off the origin and spending control effort,
says how much you dislike state error, how much you dislike effort. Their ratio, not their absolute size, sets the behavior: a large buys an aggressive controller, a large a lazy one.
The optimal policy is linear feedback
The optimal cost-to-go is quadratic, , and minimizing the Bellman right-hand side over gives a policy that is linear in the state,
where and the matrix solve the discrete algebraic Riccati equation. The clean way to reach is to run the Riccati recursion backward from until it stops moving,1
This is exact value iteration, but on a quadratic it never leaves the class of quadratics, so a handful of matrix operations per step drive to its fixed point. No sampling, no function approximation. The controller is the gain , and nothing else.
Worked example: balancing a pole
Take a pendulum of mass and length , torque at the pivot, and let be the angle measured from upright. The nonlinear plant is . Linearizing about the upright equilibrium () with state gives
The upright point is unstable: has eigenvalues , one of them positive, so any tilt grows. Euler-discretize with step ,
Plug in , , , :
Its eigenvalues are and : one sits outside the unit circle, the discrete signature of the same instability. Now pick weights (care mostly about the angle) and , and iterate the recursion to convergence. The gain comes out to
Feeding this back moves the closed-loop eigenvalues of to about , both inside the unit circle: the tilt now decays instead of growing. The demo runs exactly this pipeline, then applies (torque-limited) to the full nonlinear pendulum.
- θ (from upright)
- 14.3°
- u (torque)
- +0.00
- K
- [19.48, 6.22]
correcting
Why LQR matters beyond linear systems
Real robots are not linear, but LQR is the atom that nonlinear methods are built from. iLQR / iterative LQG takes a nonlinear system, linearizes the dynamics and quadratizes the cost around the current trajectory, solves the resulting time-varying LQR problem for a local feedback correction, rolls it out, and repeats.2 Each inner solve is exactly the Riccati recursion above, just run over a finite horizon with that change along the trajectory.
For reinforcement learning, LQR is the one continuous-control problem where the optimal policy, value function, and Bellman fixed point are all known in closed form. That makes it the standard sanity check: a policy-gradient or actor-critic method on linear-quadratic dynamics should recover and the quadratic , and if it cannot, the bug is in the algorithm, not the task.
Footnotes
-
Bertsekas, Dynamic Programming and Optimal Control. ↩
-
Todorov & Li, A generalized iterative LQG method for locally-optimal feedback control of constrained nonlinear stochastic systems (ACC 2005). ↩