Inferensys

Glossary

Linear Quadratic Regulator (LQR)

The Linear Quadratic Regulator (LQR) is an optimal feedback controller for linear dynamical systems that minimizes a quadratic cost function over an infinite time horizon.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
CONTROL THEORY

What is Linear Quadratic Regulator (LQR)?

A foundational algorithm in optimal control for linear systems.

The Linear Quadratic Regulator (LQR) is an optimal feedback control algorithm for a linear time-invariant (LTI) system that minimizes a quadratic cost function over an infinite time horizon. It provides a closed-form, static gain matrix (K) that multiplies the system's state vector to produce the optimal control input, balancing the trade-off between state deviation and control effort. This solution is derived by solving the associated Algebraic Riccati Equation (ARE).

LQR is a cornerstone of modern control theory and is extensively applied in robotics for stabilizing systems like inverted pendulums, quadrotors, and robotic arms. Its primary assumptions are perfect knowledge of the linear system model and full state observability. For systems with noise or partial observations, it is commonly combined with a Kalman filter in the Linear Quadratic Gaussian (LQG) control framework. The quadratic cost function typically penalizes both the state error and the control input magnitude.

CONTROL THEORY

Key Characteristics of LQR

The Linear Quadratic Regulator (LQR) is a foundational optimal control algorithm. Its defining characteristics stem from its mathematical formulation, which provides a closed-form, computationally efficient solution for stabilizing linear systems.

01

Optimal Feedback Control

LQR is an optimal feedback controller. It does not compute an open-loop trajectory; instead, it calculates a state-feedback gain matrix (K). This matrix is applied as u = -Kx, where u is the control input and x is the system state. This policy is optimal for the infinite-horizon problem, meaning the control law is constant and stabilizes the system from any initial condition while minimizing the defined cost.

02

Quadratic Cost Function

The 'Quadratic' in LQR refers to its cost function: J = ∫ (xᵀQx + uᵀRu) dt. This function penalizes two things:

  • State Deviation (xᵀQx): The matrix Q (positive semi-definite) penalizes the system for being away from the desired equilibrium (typically zero).
  • Control Effort (uᵀRu): The matrix R (positive definite) penalizes the use of large control inputs. The engineer's primary design task is to tune the Q and R matrices to trade off between performance (fast convergence) and actuator effort/energy consumption.
03

Linear System Dynamics

LQR's theoretical guarantees and solution method are strictly valid for linear time-invariant (LTI) systems described by: ẋ = Ax + Bu. Here, A is the state matrix and B is the input matrix. This is a core limitation. In practice, LQR is often applied to linearized models of nonlinear systems (e.g., a robot arm linearized around an upright pose). The controller's performance is optimal for the linear model and is typically only locally effective for the original nonlinear system.

04

Solution via Algebraic Riccati Equation

The optimal feedback gain matrix K is not found through iterative optimization for each new state. Instead, it is computed offline by solving the Continuous-Time Algebraic Riccati Equation (CARE): AᵀP + PA - PBR⁻¹BᵀP + Q = 0. The solution is a constant matrix P (positive definite), from which the gain is calculated as K = R⁻¹BᵀP. This provides a closed-form solution, making the online control computation (just a matrix multiplication) extremely fast and deterministic, suitable for real-time control loops.

05

Connection to Trajectory Tracking (LQR)

The standard LQR formulation regulates a system to zero. For trajectory tracking—following a time-varying reference—the problem is transformed. A time-varying error state is defined as the deviation from the desired trajectory. If the trajectory is generated by a linear model, the error dynamics are also linear, and an LQR controller can be designed for these error dynamics. This results in a Linear Quadratic Tracker, which is a foundational component in hierarchical control: a planner generates a trajectory, and an LQR-based tracker stabilizes the system to it.

06

Limitations and Practical Extensions

LQR's core assumptions lead to key limitations, which have inspired major extensions:

  • Nonlinear Systems: Linearization is required, limiting validity to regions near the linearization point.
  • No Constraints: The standard LQR solution ignores physical limits on state or control (e.g., torque limits). This is addressed by Model Predictive Control (MPC), which solves a constrained finite-horizon optimization online.
  • Stochastic Noise: The basic LQR assumes a perfect, noise-free model. The Linear Quadratic Gaussian (LQG) controller combines an LQR with a Kalman filter to handle state estimation in the presence of noise.
OPTIMAL CONTROL

How the Linear Quadratic Regulator (LQR) Works

The Linear Quadratic Regulator (LQR) is a foundational optimal feedback controller for linear dynamical systems. It provides a closed-form, computationally efficient solution for infinite-horizon control problems by minimizing a quadratic cost function.

The Linear Quadratic Regulator (LQR) is an optimal state-feedback controller designed for linear time-invariant systems. Given a system defined by linear dynamics, LQR calculates a constant gain matrix K that, when multiplied by the system's state vector, produces optimal control inputs. This minimizes a quadratic cost function that penalizes both deviation from a desired state (tracking error) and excessive control effort. The solution is derived by solving an Algebraic Riccati Equation (ARE), yielding a controller that guarantees stability for controllable systems.

In practice, LQR serves as a core component in trajectory tracking for robotics. A planned path is treated as a time-varying setpoint, and LQR computes the corrective torques or forces to follow it. Its computational efficiency makes it suitable for real-time control loops. While the classic formulation assumes full state observability, it is often paired with a Kalman filter in the Linear Quadratic Gaussian (LQG) framework to handle noisy, partial measurements, forming a complete optimal estimation and control pipeline.

OPTIMAL CONTROL IN PRACTICE

LQR Applications and Use Cases

The Linear Quadratic Regulator (LQR) provides a foundational, computationally efficient optimal controller for linear systems. Its closed-form solution and stability guarantees make it a cornerstone for a wide range of engineering systems requiring precise, automated regulation.

01

Robotic Arm Trajectory Tracking

LQR is the workhorse controller for robotic manipulators performing precise tasks like welding, assembly, or pick-and-place. It is often used as the tracking controller for a pre-planned trajectory.

  • Core Function: The controller calculates the optimal joint torques to follow a desired end-effector path while minimizing a cost function that penalizes tracking error and control effort.
  • Implementation: The robot's nonlinear dynamics are linearized around the reference trajectory. LQR gains are then computed for this linear time-varying (LTV) system, a method known as Linear Quadratic Tracking (LQT) or as the feedback component of a Linear-Quadratic-Gaussian (LQG) controller when combined with a Kalman filter for state estimation.
  • Advantage: Provides a mathematically rigorous, stable controller that optimally balances performance (speed/accuracy) against energy consumption and actuator wear.
02

Inverted Pendulum & Cart-Pole Stabilization

The classic benchmark for modern control theory, the inverted pendulum (and its variant, the cart-pole system) is inherently unstable. LQR is the standard method for balancing it.

  • Control Objective: Stabilize the pendulum in its upright equilibrium point using force applied to the cart.
  • Process: The nonlinear equations of motion are linearized around the unstable upright position (θ = 0). The LQR algorithm then computes the optimal state feedback gains (K) that map the measured state [cart position, cart velocity, pendulum angle, pendulum angular velocity] to a corrective force.
  • Significance: This application demonstrates LQR's ability to stabilize unstable systems, a principle extended to bipedal robot balance, rocket guidance, and high-performance aircraft control.
03

Quadrotor and UAV Flight Control

LQR forms the inner-loop attitude controller for multirotor drones and fixed-wing UAVs, responsible for stable, agile flight.

  • Architecture: Flight control is typically hierarchical. LQR operates on the attitude dynamics (pitch, roll, yaw), which are approximately linear for small angles. A higher-level planner or outer loop generates desired attitude commands for the LQR controller to track.
  • Cost Function Design: The quadratic cost function is tuned to heavily penalize angular errors and angular rates, ensuring rapid disturbance rejection (e.g., from wind gusts) while limiting aggressive, power-hungry control actions.
  • Result: This provides the drone with the inherent stability required for autonomous navigation, hovering, and trajectory following, often serving as the baseline against which more complex nonlinear controllers are compared.
04

Active Suspension and Vibration Damping

LQR is applied in mechatronic systems to isolate sensitive components from vibrations or to improve ride quality by actively controlling suspension elements.

  • System Model: The vehicle or platform is modeled as a multi-mass spring-damper system. The states typically represent displacements and velocities of the chassis, wheels, and/or payload.
  • Optimization Goal: The cost function is designed to minimize a weighted sum of:
    • Payload acceleration (for ride comfort or instrument protection).
    • Suspension travel (to avoid hitting mechanical limits).
    • Control force (actuator energy).
  • Applications: High-performance automotive suspensions, precision manufacturing stages, satellite instrument isolation, and seismic damping systems for buildings.
05

Power System and Network Regulation

In electrical engineering, LQR is used for wide-area damping control in power grids and for voltage/frequency regulation in microgrids and spacecraft power systems.

  • Challenge: Power networks are large-scale, interconnected linear systems susceptible to low-frequency oscillations following disturbances like a fault or load change.
  • LQR Solution: A centralized or decentralized LQR controller uses measurements from phasor measurement units (PMUs) to compute optimal damping signals for generator exciters or FACTS devices. The cost function penalizes deviations in rotor speeds and angles across the network.
  • Outcome: Enhances the transient stability and dynamic performance of the grid, preventing cascading failures. Similarly, LQR regulates the output of DC-DC converters in satellite power systems.
06

Chemical Process Control

In industrial process control, LQR manages continuous stirred-tank reactors (CSTRs), distillation columns, and other unit operations by regulating temperatures, pressures, and concentrations.

  • Linearization: The highly nonlinear chemical process dynamics are linearized around a desired operating point (e.g., a specific temperature and reactant concentration for optimal yield).
  • Multivariable Control: LQR excels here as a Multi-Input Multi-Output (MIMO) controller. It can simultaneously adjust heater power, coolant flow, and inlet valve positions to maintain all process variables at their setpoints while minimizing energy use.
  • Economic Optimization: The quadratic cost can be tuned to reflect operating economics, penalizing expensive control actions (like steam consumption) more heavily than cheaper ones, leading to optimal steady-state operation.
CONTROL ALGORITHMS

LQR vs. Model Predictive Control (MPC): A Comparison

A feature comparison of two foundational optimal control methods used in robotics and autonomous systems, highlighting their core operational principles, computational characteristics, and typical use cases.

Feature / CharacteristicLinear Quadratic Regulator (LQR)Model Predictive Control (MPC)

Core Formulation

Infinite-horizon, continuous-time optimal control.

Finite, receding-horizon optimal control.

Solution Method

Closed-form algebraic solution (Riccati equation).

Online numerical optimization (e.g., QP, NLP).

Control Law

Static linear state feedback: u = -Kx.

Dynamic, time-varying sequence of control inputs.

Constraint Handling

None (unconstrained optimization).

Explicit handling of state/input constraints (e.g., bounds).], [

Model Linearity

Requires a linear system model.

Can use linear or nonlinear dynamic models.

Computational Load

Very low (pre-computed gain matrix).

High (solves optimization at each time step).], ["Prediction Horizon", "Infinite.",

Finite (typically 10-50 steps).

Real-Time Suitability

Excellent for high-frequency loops (< 1 ms).

Suitable for moderate-frequency loops (1-100 ms).], ["Robustness to Model Error", "Low (no online correction).",

Higher (re-planning at each step).

Primary Use Case

Stabilization and regulation of linear systems.

Constrained trajectory tracking and complex maneuvers.

CONTROL THEORY

Frequently Asked Questions about LQR

The Linear Quadratic Regulator (LQR) is a foundational optimal control algorithm. These FAQs address its core principles, applications, and relationship to other control methods in robotics and autonomous systems.

The Linear Quadratic Regulator (LQR) is an optimal feedback controller for linear dynamical systems that minimizes a quadratic cost function over an infinite time horizon. It works by solving the Algebraic Riccati Equation (ARE) to compute a constant gain matrix K. This gain matrix is then used in the control law u = -Kx, where u is the control input and x is the system state. This feedback law optimally balances the cost of deviating from a desired state (penalized by matrix Q) against the cost of using control effort (penalized by matrix R). The resulting controller provides guaranteed stability and performance for the linearized system model.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.