WHY this cost? It is a steel-man of engineering trade-offs. You cannot make error zero instantly — that would need infinite control. You cannot save all fuel — the system would drift. The integral of a quadratic form is the smoothest way to trade the two, and quadratics make the math solvable in closed form.
WHY quadratic (not ∣x∣ or x4)? Because with a linear plant + quadratic cost, the optimal control turns out to be linear in the state (u=−Kx). That is the magic marriage: Linear + Quadratic → Linear controller.
Define the optimal "cost-to-go" from state x:
V(x)=minu(⋅)∫t∞(x⊤Qx+u⊤Ru)dt.
Why guess V(x)=x⊤Px (with P=P⊤⪰0)? Because the cost is quadratic and the dynamics linear, the cost-to-go must also be a quadratic form — there is no linear or constant term (at x=0 cost is 0), and no higher powers survive linear dynamics.
The Bellman principle says: at the optimum, the instantaneous cost plus the rate of change of cost-to-go is zero:
0=minu[x⊤Qx+u⊤Ru+∇V⊤(Ax+Bu)].
With V=x⊤Px, we have ∇V=2Px, so:
0=minu[x⊤Qx+u⊤Ru+2x⊤P(Ax+Bu)].
Put u∗=−R−1B⊤Px into the HJB bracket. Note u∗⊤Ru∗=x⊤PBR−1B⊤Px and 2x⊤PBu∗=−2x⊤PBR−1B⊤Px. These combine to −x⊤PBR−1B⊤Px:
0=x⊤(Q+A⊤P+PA−PBR−1B⊤P)x.
This must hold for allx, so the matrix in brackets is zero:
Why is it "algebraic"? In the infinite-horizon steady state P˙=0, so the differential Riccati equation collapses to this algebraic one. Why nonlinear? The term −PBR−1B⊤P is quadratic in P.
Plant: x˙=ax+bu with a,b scalars; cost weights q>0,r>0.
Riccati (scalars):2ap−rb2p2+q=0.
Why?A⊤P+PA=2ap; PBR−1B⊤P=rb2p2; add Q=q.
Solve the quadratic for p (take the positive root, since P⪰0):
p=b2ar+a2r2+qrb2.Why positive root?V=px2 is a cost — must be non-negative; only the + root gives p>0.
Gain: K=rbp. Closed loop: x˙=(a−bK)x.
Check stability:a−bK=a−rb2p<0 always, so the controller always stabilizes even an unstable open-loop plant (a>0).
A satellite axis: position x1, velocity x2, control acceleration u:
A=[0010],B=[01],Q=[1000],R=[ρ].
Let P=[p1p2p2p3]. Expand CARE. Key equations:
(1,1):1−p22/ρ=0⇒p2=ρ.
(1,2):p1−p2p3/ρ=0⇒p1=p2p3/ρ.
(2,2):2p2−p32/ρ=0⇒p3=2ρp2=2ρ3/4.
Gain: K=R−1B⊤P=ρ1[p2,p3]=[ρ1,ρ1/42].
Why this matters:K=[kp,kd] is exactly a PD controller! The first gain acts on position (spring), the second on velocity (damper). LQR derived PD control optimally. With ρ=1: K=[1,2], giving closed-loop poles at −21±j21 — a nicely damped response (damping ratio =1/2).
Recall Feynman: explain to a 12-year-old
Imagine steering a wobbly shopping cart to a spot. Being far from the spot is annoying (that's Q), but shoving the cart really hard is tiring and jerky (that's R). LQR figures out the perfect amount of push for every situation so you get there smoothly without wearing yourself out. And the amazing part: the perfect rule is simply "push in proportion to how far off you are" — one recipe (u=−Kx) that works everywhere. The Riccati equation is just the puzzle you solve once to find that recipe.
Dekho, LQR ka basic idea bahut simple hai. Tumhare paas ek linear system hai — x˙=Ax+Bu — matlab satellite ya rocket jaisa kuch jise tum control input u se steer karte ho. Ab tumhe do cheezein manage karni hain: ek to state error kam karna (target par pahunchna), aur doosra control effort bacha na (fuel/actuator zyada na jale). In dono ka trade-off ek cost function J=∫(x⊤Qx+u⊤Ru)dt mein likhte hain, jahan Q error ko punish karta hai aur R effort ko.
Kamaal ki baat yeh hai: kyunki system linear hai aur cost quadratic, optimal control bhi linear nikalta hai — u=−Kx. Bas ek matrix K nikalna hai. Yeh K tumhe Riccati equation se milta hai: A⊤P+PA−PBR−1B⊤P+Q=0. Ise solve karke positive-definite P nikalo, phir K=R−1B⊤P. Ho gaya! Ek baar offline solve karo, phir wahi gain hamesha use karo.
Practical intuition: agar tum R bada karoge to controller "aaram se" chalega (kam effort, slow response); agar Q bada karoge to controller "aggressive" ho jayega (fast, zyada effort). Sirf Q aur R ka ratio matter karta hai. Aur ek zabardast fact — double integrator ke liye LQR automatically ek PD controller bana deta hai, matlab position par spring aur velocity par damper. Isiliye GNC mein LQR itna popular hai: yeh classical PID ko optimally derive kar deta hai, guess-work ke bina.
Yaad rakhna common galti: log sochte hain bada R matlab fast response — galat! Bada R matlab effort pe zyada penalty, isliye gentle/slow response. Aur Riccati ka jo term hai −PBR−1B⊤P, uska sign minus hota hai — yeh mat bhoolna.