Linear-Quadratic Regulation & Riccati Equations

A complete continuous- and discrete-time LQR derivation: quadratic HJB ansatz, optimal feedback, differential and algebraic Riccati equations, stabilizing-solution conditions, value function, weight scaling, and actuator-limit boundaries.

The linear-quadratic regulator (LQR) is the rare optimal-control problem whose nonlinear HJB equation closes into a matrix differential equation. Linear dynamics preserve quadratic value functions, and a positive-definite quadratic input penalty makes the pointwise minimizer unique. The result is linear state feedback, but its validity depends on the model, weights, horizon, and absence of hard constraints.

Finite-horizon problem #

Let

x˙(t)=A(t)x(t)+B(t)u(t),\dot x(t)=A(t)x(t)+B(t)u(t),

and minimize

J[u]=12x(tf)TSfx(tf)+12∫t0tf[x(t)TQ(t)x(t)+u(t)TR(t)u(t)]dt,J[u]=\frac12x(t_f)^TS_fx(t_f) +\frac12\int_{t_0}^{t_f} \left[x(t)^TQ(t)x(t)+u(t)^TR(t)u(t)\right]dt,

with

Sf⪰0,Q(t)⪰0,R(t)≻0.S_f\succeq0,\qquad Q(t)\succeq0,\qquad R(t)\succ0.

The factor 1/21/2 simplifies derivatives and does not change the minimizer. Positive definiteness of RR makes control effort strictly convex and ensures R−1R^{-1} exists.

Quadratic HJB ansatz #

The terminal value is quadratic, and the dynamics are linear, so try

V(t,x)=12xTP(t)x,P(t)=P(t)T.V(t,x)=\frac12x^TP(t)x, \qquad P(t)=P(t)^T.

Then

Vt=12xTP˙x,∇xV=Px.V_t=\frac12x^T\dot P x, \qquad \nabla_xV=P x.

The HJB equation becomes

0=12xTP˙x+min⁡u[12xTQx+12uTRu+xTP(Ax+Bu)].0=\frac12x^T\dot P x +\min_u\left[ \frac12x^TQx +\frac12u^TRu +x^TP(Ax+Bu) \right].

Only two terms depend on uu:

12uTRu+xTPBu.\frac12u^TRu+x^TPBu.

Differentiate with respect to uu:

Ru+BTPx=0.Ru+B^TPx=0.

Therefore

u∗(t)=−K(t)x(t),K(t)=R(t)−1B(t)TP(t).\boxed{u^*(t)=-K(t)x(t), \qquad K(t)=R(t)^{-1}B(t)^TP(t).}

Completing the square makes global pointwise optimality explicit:

12uTRu+xTPBu=12(u+R−1BTPx)TR(u+R−1BTPx)−12xTPBR−1BTPx.\frac12u^TRu+x^TPBu =\frac12(u+R^{-1}B^TPx)^TR(u+R^{-1}B^TPx) -\frac12x^TPBR^{-1}B^TPx.

Differential Riccati equation #

Substitute the minimizing control into HJB and use

xTPAx=12xT(PA+ATP)x.x^TPAx=\frac12x^T(PA+A^TP)x.

Because the resulting quadratic form must vanish for every xx,

−P˙=ATP+PA−PBR−1BTP+Q,P(tf)=Sf.\boxed{ -\dot P =A^TP+PA-PBR^{-1}B^TP+Q, \qquad P(t_f)=S_f.}

This is the continuous-time Riccati differential equation (RDE). Its boundary condition is at tft_f, so PP is integrated backward. The state has its boundary condition at t0t_0 and is integrated forward under

x˙=(A−BK)x.\dot x=(A-BK)x.

Finite-horizon LQR propagates Riccati and state equations in opposite time directions The Riccati matrix starts from the terminal matrix and propagates backward to form the gain. The state starts from the initial condition and propagates forward under that gain. t₀ t_f P(t) backward from P(t_f)=S_f x(t) forward from x(t₀)=x₀ K(t)=R⁻¹BᵀP(t) u(t)=−K(t)x(t)
Finite-horizon LQR couples a matrix boundary condition at the final time to a state initial condition at the initial time. Solve P backward, form K(t), then propagate x forward.

The optimal cost from (t0,x0)(t_0,x_0) is

J∗=V(t0,x0)=12x0TP(t0)x0.\boxed{J^*=V(t_0,x_0)=\frac12x_0^TP(t_0)x_0.}

Direct PMP cross-check #

Using the maximum-convention Hamiltonian

H=pT(Ax+Bu)−12(xTQx+uTRu),H=p^T(Ax+Bu)-\frac12(x^TQx+u^TRu),

maximization gives

BTp−Ru=0,u=R−1BTp.B^Tp-Ru=0, \qquad u=R^{-1}B^Tp.

Because this convention has p=−Vxp=-V_x, set

p=−Px.p=-P x.

Then

u=−R−1BTPx,u=-R^{-1}B^TPx,

and substituting into the costate equation recovers the same RDE. This is a useful sign audit: if PMP produces positive feedback for the regulator, the Hamiltonian/costate convention has been mixed.

Infinite horizon and the algebraic Riccati equation #

For constant A,B,Q,RA,B,Q,R, consider

J=12∫0∞(xTQx+uTRu)dt.J=\frac12\int_0^\infty(x^TQx+u^TRu)dt.

If the finite-horizon stabilizing solution converges to a constant PP, then P˙=0\dot P=0 and

ATP+PA−PBR−1BTP+Q=0.\boxed{A^TP+PA-PBR^{-1}B^TP+Q=0.}

This is the continuous algebraic Riccati equation (CARE). The feedback and closed-loop matrix are

K=R−1BTP,Acl=A−BK.K=R^{-1}B^TP, \qquad A_{cl}=A-BK.

An algebraic equation can have multiple symmetric solutions. LQR uses the stabilizing solution: the one for which A−BKA-BK is Hurwitz.

A standard sufficient set of conditions is:

  • (A,B)(A,B) is stabilizable: every uncontrollable mode is already stable;
  • (Q1/2,A)(Q^{1/2},A) is detectable: every mode invisible to the state penalty is stable;
  • R≻0R\succ0 and Q⪰0Q\succeq0.

Full controllability and Q≻0Q\succ0 are stronger than necessary. Conversely, a numerical CARE routine returning a matrix does not by itself prove that the chosen branch is stabilizing; inspect P=PTP=P^T, its definiteness, the residual, and the eigenvalues of A−BKA-BK.

Scalar CARE worked completely #

Take

x˙=x+u,J=12∫0∞(x2+u2)dt.\dot x=x+u, \qquad J=\frac12\int_0^\infty(x^2+u^2)dt.

Here A=B=Q=R=1A=B=Q=R=1. The CARE is

2P−P2+1=0,2P-P^2+1=0,

or

P2−2P−1=0.P^2-2P-1=0.

The two algebraic roots are

P=1±2.P=1\pm\sqrt2.

The feedback is u=−Pxu=-Px, so the closed-loop pole is

A−BK=1−P.A-BK=1-P.

For P=1−2P=1-\sqrt2, the pole is +2+\sqrt2 and the system is unstable. For

P=1+2,K=1+2,\boxed{P=1+\sqrt2,\qquad K=1+\sqrt2,}

the pole is −2-\sqrt2. The stabilizing requirement selects the correct Riccati root.

Discrete-time LQR #

For

xk+1=Akxk+Bkukx_{k+1}=A_kx_k+B_ku_k

and

J=12xNTSNxN+12∑k=0N−1(xkTQkxk+ukTRkuk),J=\frac12x_N^TS_Nx_N +\frac12\sum_{k=0}^{N-1} (x_k^TQ_kx_k+u_k^TR_ku_k),

assume Vk+1(x)=12xTPk+1xV_{k+1}(x)=\tfrac12x^TP_{k+1}x. Minimizing the one-step Bellman expression gives

Kk=(Rk+BkTPk+1Bk)−1BkTPk+1Ak,\boxed{ K_k=(R_k+B_k^TP_{k+1}B_k)^{-1}B_k^TP_{k+1}A_k,}

uk∗=−Kkxk,\boxed{u_k^*=-K_kx_k,}

and the backward discrete Riccati recursion

Pk=Qk+AkTPk+1Ak−AkTPk+1Bk(Rk+BkTPk+1Bk)−1BkTPk+1Ak,\boxed{ P_k=Q_k+A_k^TP_{k+1}A_k -A_k^TP_{k+1}B_k (R_k+B_k^TP_{k+1}B_k)^{-1} B_k^TP_{k+1}A_k,}

with PN=SNP_N=S_N. The continuous formula K=R−1BTPK=R^{-1}B^TP must not be pasted into a sampled system; the BTPBB^TPB term is a real consequence of one-step state propagation.

Choosing state and input weights #

Bryson's rule is an initial normalization, not an optimizer of design intent. For acceptable magnitudes xi,max⁡x_{i,\max} and uj,max⁡u_{j,\max},

Qii=1xi,max⁡2,Rjj=1uj,max⁡2.\boxed{Q_{ii}=\frac{1}{x_{i,\max}^2}, \qquad R_{jj}=\frac{1}{u_{j,\max}^2}.}

Each normalized variable contributes roughly one when it reaches its declared scale. The inverse square is essential: a larger acceptable excursion receives a smaller weight. The KPI lecture's opposite proportionality is corrected here using the NASA-sponsored Stanford report's explicit statement of the rule.

Then iterate using physical outcomes:

  • transient state peaks and settling;
  • actuator magnitude, rate, and thermal load;
  • closed-loop poles and dominant eigenvectors;
  • sensitivity to model uncertainty and sensor noise;
  • units and coordinate scaling.

Multiplying both QQ and RR by the same positive scalar leaves KK unchanged, because only their relative tradeoff matters.

What unconstrained LQR does not solve #

The derivation minimizes over all u∈Rmu\in\mathbb R^m. If the actuator saturates, clipping

u=sat(−Kx)u=\mathop{\mathrm{sat}}(-Kx)

creates a nonlinear closed loop that is not the solution of the constrained LQR problem. Stability and performance must be re-evaluated, and an observer or integrator can wind up.

Likewise, LQR does not enforce:

  • state constraints;
  • input rate or slew limits;
  • a prescribed sparse or low-order feedback architecture;
  • robustness to an uncertainty set;
  • estimation from partial measurements.

Use observers for state reconstruction, constrained optimal control or MPC for hard limits, and fixed-structure optimization when the controller architecture itself is restricted.

Sources

  1. bookCalculus of Variations and Optimal Control Theory: A Concise Introductionpdfnotes
  2. paperContributions to the Theory of Optimal Controlpdfnotes
  3. bookControl Methods for Aiding a Pilot During STOL Engine Failure Transientspdfnotes

Searches titles, aliases, headings, summaries, and full text.↑↓ move ↵ open esc close