- Introduced by
- Rudolf Kalman
- Year
- 1960
- Type
- algorithm
- Family
- Optimal Control
What does it do?
The Linear Quadratic Regulator (LQR) is an optimal control method that computes a linear state-feedback law minimizing a quadratic cost for a linear dynamical system.
Kalman's 1960 paper presents a Riccati-based solution for the state-feedback gain of a general linear system with a quadratic performance criterion. The result is optimal under the assumed linear model and cost, and its online computation is cheap enough for widespread use in control engineering, robotics and aerospace.
The intuition behind the method
LQR addresses steering a linear system toward zero, or tracking a reference, while penalizing both deviation of the state and the size of the control input. For linear dynamics and a quadratic cost, the optimal input is linear in the current state, u = -Kx, where K is a gain matrix. K is found by solving a Riccati equation: a differential equation integrated backward in time for a finite horizon, or an algebraic Riccati equation in the steady-state (infinite-horizon) case. The solution gives the optimal cost-to-go as a quadratic function of the state, from which K follows. Because K is computed beforehand, the online controller only multiplies the state vector by K.
History
Kalman's 1960 paper, 'Contributions to the theory of optimal control', gives a Riccati-based algorithm for the state-feedback gain of a general linear system with a quadratic performance criterion. Its abstract notes that the Riccati equation had earlier appeared in the calculus of variations, and that the paper's analysis concentrates on time-varying systems. Bryson and Ho's textbook on applied optimal control is among the references listed for this method. Combining LQR with a Kalman filter yields the linear-quadratic-Gaussian (LQG) design.
When to use it
Choose LQR when the plant is linear, or is linear enough about an operating point that the controller will stay near it; when the performance goal can be written as a quadratic penalty on state error and control effort; and when the states can be measured or estimated. It suits regulation and tracking tasks, such as stabilizing an inverted-pendulum-type system or attitude control, where a fast linear law is needed. Do not use LQR when hard bounds on states or inputs must be respected, because the quadratic penalty only discourages violations; model predictive control is the usual alternative. It is also a poor fit when the dynamics are strongly nonlinear over the operating range, or when the model is too uncertain for a gain computed from it to be trusted.
Limitations and considerations
- The design model is linear. Nonlinear plants must be linearized, and the resulting gain is only valid locally around the linearization point.
- Hard constraints on states or inputs are not enforced; the quadratic penalties only trade off deviations against each other.
- Choosing Q and R requires engineering judgment; no single correct pair follows from the problem statement.
- Full-state feedback needs all states measured or estimated; when they are not, an estimator such as a Kalman filter must be added, and combining LQR with a Kalman filter gives the linear-quadratic-Gaussian (LQG) design. Gains computed from a nominal model lose accuracy when the true plant differs from it, and the stability and margin properties established for that model do not carry over automatically. Simulate the closed loop with model mismatch and check its stability and margins before deployment.
- The infinite-horizon gain yields a stable closed loop only if (A, B) is stabilizable and the state weighting is detectable (for example Q = C^T C with (A, C) observable). These conditions must be checked before the algebraic Riccati equation is solved.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- For a linear model with quadratic cost, it yields the optimal full-state feedback law; this optimality holds only under those two assumptions.
- Gains are computed offline, so online control reduces to multiplying the state vector by K, which keeps the per-step computation small.
- Standard numerical methods for the Riccati equation exist, including Schur-decomposition-based solvers.
- The matrix formulation handles multi-input, multi-output systems directly through Q and R.
Applications
- Aerospace: attitude control of aircraft and spacecraft, as linear regulation around a nominal flight condition.
- Robotics: stabilizing inverted-pendulum-type systems and tracking control of manipulators linearized about an operating point.
- Mechanical systems: regulation and vibration damping for linear mechanical models.
- Small multirotor vehicles: stabilization using a linearized model near the hover condition.
- Process and automotive control: linear regulation of loops whose dynamics are well approximated by a linear model near the operating point.
How it works
How it works
Specify the linear model (the A and B matrices, in continuous or discrete time), the state weighting matrix Q and the input weighting matrix R. The steady-state case needs no horizon; a finite-horizon problem additionally requires a terminal condition and a time span.
Solve the algebraic Riccati equation (or, for a finite horizon, the differential Riccati equation integrated backward in time) for the symmetric positive-definite matrix P. P encodes the optimal cost-to-go as a quadratic function of the state.
Compute the feedback gain K = R^(-1) * B^T * P.
Apply the feedback law u(t) = -K x(t) at each control step, using the measured or estimated state. K is recomputed only when the model or the weights change.
Common pitfalls
- Linearizing about an unstable equilibrium or around a moving reference without checking that the linearization still describes the system near the operating point.
- Choosing Q and R arbitrarily. Because they set the relative penalty on state error and control effort, their scaling and units shape the closed-loop behaviour.
- Treating K as a fixed design. Any change to A, B, Q or R requires re-solving the Riccati equation and recomputing K.
- Applying the steady-state gain to a finite-horizon problem, where the optimal gain varies with time.
- Solving the infinite-horizon Riccati equation without first checking stabilizability and detectability; in that case a stabilizing solution, and hence a stable closed loop, is not guaranteed.
Frequently asked questions
How do I choose the Q and R weighting matrices?
A systematic starting point is to make Q a diagonal matrix whose entries are proportional to 1/(maximum allowed deviation of state i)^2, and R proportional to 1/(maximum allowed input i)^2. Then tune empirically: increasing Q tightens state regulation, and increasing R reduces control effort. Overshoot and settling time trade off as these weights are adjusted.
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 main computational step 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.
Does LQR guarantee robustness margins?
No general guarantee applies once the design model differs from the real plant. The stability and gain and phase margins of the full-state LQR loop are properties of the nominal linear model together with the chosen Q and R. They must be checked for the actual plant, for example by computing the margins of the closed loop with model mismatch included. The exact margin values depend on the formulation; consult the cited textbooks for the precise statements.
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 referenceBryson, A. E., & Ho, Y. C. (1969). Applied Optimal Control: Optimization, Estimation and Control. Blaisdell Publishing.
Open publication referenceLewis, F. L., Vrabie, D., & Syrmos, V. L. (2012). Optimal Control (3rd ed.). John Wiley & Sons.
Open DOI reference