Linear Quadratic Regulator
- Introduced by
- Rudolf Kalman
- Year
- 1960
- Type
- algorithm
- Family
- Optimal Control
What does it do?
The Linear Quadratic Regulator (LQR) is a classical optimal control algorithm that computes a linear feedback law to minimize a quadratic cost function for a linear dynamical system.
Introduced by Kalman in 1960, LQR provides a provably optimal, closed-form solution for linear systems and remains fundamental in control theory, robotics, and aerospace applications because of its theoretical elegance and computational efficiency.
The intuition behind the method
LQR solves the problem of steering a linear system to zero (or tracking a reference) while penalizing both deviation from the desired state and the effort (magnitude of control input). The key insight is that for linear systems with quadratic costs, the optimal control law is linear in the current state: u = −Kx, where K is the feedback gain matrix computed offline. The algorithm first solves a backward-time Riccati differential equation (or algebraic Riccati equation for steady-state) to find the optimal cost-to-go function, then derives the linear feedback gain. This separates the offline computation of gains from online control, enabling extremely fast real-time implementation.
History
Kalman's 1960 paper introduced the Linear Quadratic Optimal Control problem and its solution via the Riccati equation. Bryson and Ho expanded the theory in the late 1960s and published the seminal textbook in 1969. The discrete-time version was developed by Kalman and others in the same era, enabling digital implementation. LQR has since become foundational in modern control theory, with extensions to stochastic systems (Linear Quadratic Gaussian, LQG) and extensions to nonlinear systems (Differential Games, NMPC).
When to use it
Use LQR when your system is linear (or well-approximated by linearization), when the objective naturally combines state error and control effort, and when you need a provably optimal solution with fast computation. LQR excels for problems like stabilizing an inverted pendulum, controlling aircraft attitude, or optimizing spacecraft trajectories. It is less suitable for systems with hard constraints (use MPC instead) or strongly nonlinear dynamics.
Limitations and considerations
- Restricted to linear systems; real systems are often nonlinear and require linearization.
- Does not explicitly handle hard constraints on state or input; quadratic penalties are soft constraints only.
- Cost function design (choosing Q and R) requires engineering judgment and tuning.
- Kalman gain robustness properties assume the model is accurate; model mismatch degrades performance.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Provides the provably optimal feedback law for linear systems with quadratic cost.
- Offline computation of gains; online control is just a matrix-vector multiplication (extremely fast).
- Gain margin and phase margin guarantees; inherent robustness properties (infinite gain margin at the output).
- Straightforward to compute; many numerical algorithms are available (Schur decomposition, eigenvalue methods).
- Naturally handles multivariable systems and decouples the control design from sensor and actuator constraints.
Applications
- Aerospace: Attitude control of aircraft and spacecraft, trajectory optimization for Mars rovers and lunar landers.
- Robotics: Balancing bipedal walkers, manipulator arm trajectory tracking, stabilizing quadrotor drones.
- Manufacturing: Motion control of precision equipment (CNC machines), vibration damping in mechanical systems.
- Energy systems: Stabilizing power grid frequency and voltage, optimizing generator control in microgrids.
- Automotive: Suspension control, traction control, and steering assistance in vehicles.
How it works
How it works
Define the linear system dynamics (A, B matrices), the prediction horizon, and the quadratic cost matrices (Q for state, R for input).
Solve the continuous-time or discrete-time algebraic Riccati equation to obtain the symmetric positive-definite solution matrix P.
Calculate the optimal feedback gain matrix K = R^(-1) * B^T * P using the Riccati solution.
Apply the linear feedback law u(t) = −K x(t) to the system at each control step.
Common pitfalls
- Linearizing about an unstable equilibrium or time-varying reference may render the LQR solution invalid.
- Setting Q and R weights arbitrarily without understanding their physical meaning leads to poor control performance.
- Forgetting that LQR is an offline computation; changes to Q, R, or system parameters require re-solving the Riccati equation.
Frequently asked questions
How do I choose the Q and R weighting matrices?
A systematic approach is to start with Q as a diagonal matrix with each diagonal entry proportional to 1/max_allowed_state_i^2, and R proportional to 1/max_allowed_input_i^2. Then tune empirically: increase Q to tighten state regulation, increase R to reduce control effort. Trade-offs between overshoot and settling time emerge as you adjust these weights.
What is the algebraic Riccati equation and why is it important?
The algebraic Riccati equation (ARE) is a matrix quadratic equation that arises when solving the infinite-horizon LQR problem. Its solution P encodes the optimal cost-to-go from any state. Solving the ARE is the computational bottleneck of LQR; modern algorithms (e.g., via Schur decomposition) do this in O(n^3) time, where n is the state dimension.
Can LQR handle time-varying systems?
Yes, the time-varying LQR solves a differential Riccati equation (DRE) backward in time. However, this requires solving an ODE, which is more computationally expensive than the steady-state case. Time-varying LQR is useful for trajectory tracking or systems with slowly varying parameters.
Why does LQR have guaranteed robustness margins?
LQR's optimal feedback law guarantees infinite gain margin (tolerate arbitrary multiplicative output errors) and 50% phase margin at the output. These stability margins come from the structure of the optimal solution and do not need to be checked separately, unlike PID or other heuristic controllers.
Related methods
Sources
Kalman, R. E. (1960). Contributions to the theory of optimal control. Boletin de la Sociedad Matematica Mexicana, 5(2), 102-119.
Open publication referenceCopied.Bryson, A. E., & Ho, Y. C. (1969). Applied Optimal Control: Optimization, Estimation and Control. Blaisdell Publishing.
Open publication referenceCopied.Lewis, F. L., Vrabie, D., & Syrmos, V. L. (2012). Optimal Control (3rd ed.). John Wiley & Sons.
Open DOI referenceCopied.