# LQR & Riccati: the optimal rider for a given tradeoff Author: Bee Rosa Davis Source: https://www.davisgeometric.com/fal-core/#s3 Collection: FAL-CORE archive Status: Public entry. Text edition of the public page, with links, equations, figure descriptions and expanded details. Interactive readouts describe the initial displayed state, not every possible input. Use the linked interactive page and its evidence files for other states. Publication here does not change the source’s research status, assumptions or limitations. --- §3 · Geodesic riding on the cost manifold # LQR & Riccati: the optimal rider for a given tradeoff Define "riding well" as math. Solve five ways. Watch them converge. The fifth way is the differential-geometric one. Bike What does "riding well" actually mean? If I want to ride the line, but not pedal too hard, and not jerk the bars, I've defined an optimization problem. I'm trading off three things: how far I drift off line (state penalty `Q`), how much energy I burn (control penalty `R`), and how smoothly I go (the integral of both over all time). **LQR computes the perfect riding policy** for any given tradeoff. Exactly one controller is optimal for any `(Q, R)` pair. Change `R` from "I hate jerky bar movements" to "I don't care about jerkiness" and I get a more aggressive rider. Change it back and I get a smoother, lazier one. Sweep `R` continuously and I trace a smooth family of ideal riders — one rider relaxing or tensing up over many trips down the same road. That smooth family is a **geodesic family on a Riemannian manifold whose metric is built from Q and R** . Riding optimally means following a geodesic in cost-space. There is no other way to ride that isn't worse by some weighted measure. And there's a free gift hiding in the geometry: LQR gives me 60° of phase margin and a 6 dB gain margin automatically. I don't have to design for them. Geodesic flow has inherent robustness because nothing along a geodesic is wasted, and the wasted-nothing principle is the same principle as not-fragile. Davis The infinite-horizon LQR problem asks for a feedback law `u(x)` minimizing `J = ∫₀^∞ (xᵀQx + uᵀRu) dt` along `ẋ = Ax + Bu`. Classical derivations use either dynamic programming (Bellman's HJB equation) or calculus of variations (Pontryagin's maximum principle). Both arrive at the same answer. The differential-geometric reading is what makes it Davis-Geometric. u* = −R^(−1)B^(T)P x    with    A^(T)P + PA − PBR^(−1)B^(T)P + Q = 0 The algebraic Riccati equation (CARE). The closed-loop flow ẋ = (A − BK)x is geodesic flow on M = ℝⁿ with the metric induced by P. `Q` is a Riemannian metric on the state manifold. `R` is a metric on the control bundle. `P` is the metric the cost-to-go function induces on M. The algebraic Riccati equation is the integrability condition: the cost-to-go potential is invariant under the closed-loop flow. The classical `(1/2, ∞)` gain margin and `≥ 60°` phase margin for LQR (Anderson–Moore) are usually framed as a happy accident of the symplectic structure. Read through Davis Geometric, they are the **Curvature Floor for optimal control** : among all stabilizing linear feedbacks, geodesic flow on the cost manifold sits at the algebraic minimum of the return-difference peak. The geometric statement of *why* this is exactly the minimum is open work — full proof in a future paper; here we observe it numerically. Classical translation Optimal cost-to-go: `V(x) = xᵀPx`. Optimal feedback: `u* = −Kx` with `K = R⁻¹BᵀP`. Closed-loop: `ẋ = (A − BK)x`, eigenvalues in the open left-half plane. ## The F-16 cost weights Picking up the same plant from §1 — augmented short period plus elevator actuator, 4 states, 1 input. The design knobs are `Q` (state penalty) and `R` (control penalty). ``` Q = diag(1, 1, 0.01, 0.01) R = 1 ``` ### Aerospace dictionary: every penalty has a meaning In §1 the matrix entries `A[i][j]` had names (stability derivatives). Here the diagonal entries of `Q` and the scalar `R` are my design choices, and every choice has a meaning the controller will hear and respond to. | Position | Penalty | Aerospace meaning | Davis-Geometric reading | | --- | --- | --- | --- | | Q[0][0] = 1 | on α² | I dislike being 1 rad off-trim AoA as much as I dislike commanding 1 unit elevator squared | metric component on the α-fiber of the state manifold | | Q[1][1] = 1 | on q² | I dislike pitch rate of 1 rad/s as much as 1 unit elevator squared | metric component on the q-fiber | | Q[2][2] = 0.01 | on δ_e² | I'd rather not have large standing elevator deflections, but I'll tolerate them cheaply | small metric component on the actuator-deflection fiber | | Q[3][3] = 0.01 | on δ̇_e² | slamming the elevator wastes hydraulics and wears the actuator; light penalty | small metric component on the actuator-rate fiber | | R = 1 | on u² | commanded elevator effort costs me 1 per unit squared | metric on the control bundle (single channel) | The two heavy weights (`Q[0][0], Q[1][1]`) say: I care most about aircraft attitude. The two light weights (`Q[2][2], Q[3][3]`) say: don't trash the actuator, but it's not my primary concern. `R = 1` is the reference unit; multiplying `Q` by 10 has the same effect as dividing `R` by 10. The *ratio* matters, not the absolute scale. ## The closed-loop controller K, in two voices Solving CARE for the F-16 plant with the weights above gives: ``` K = [ -0.193797, -0.231952, 0.009236, 0.075882 ] J*(x₀ = [0.1 rad α, 0, 0, 0]) = 0.013611 ``` Each entry of `K` is a feedback gain. The aerospace and Davis voices read them differently. **Aerospace voice.** "`K[0] = -0.194` is a static-stability augmentation — it adds a synthetic `Z_α`-like term to the loop, making the aircraft feel more positively stable than its bare airframe.`K[1] = -0.232` is pitch-damping augmentation — synthetic `M_q`, making the pitch axis feel less responsive but more damped. `K[2] = +0.009` is a light correction that backs off the commanded elevator when there's already substantial standing deflection. `K[3] = +0.076` is rate feedback — it anticipates the elevator's motion, smoothing actuator transients. The gains are small because `R = 1` and `Q` is modest; this is a gentle controller. A more aggressive design (smaller `R` or larger `Q`) would scale all four gains up." **Davis voice.** "`K` is the projection of the Hamiltonian vector field from `T*M` onto `M`, with each component projected along its corresponding state-fiber. Equivalently, `K = R⁻¹BᵀP` reads `P` as the slope of the stable Lagrangian subspace in `T*M`, `Bᵀ` pulls that slope back through the control map, and `R⁻¹` rescales it through the control-bundle metric. The four gains are the four components of the gradient of the cost-to-go `V(x) = xᵀPx` in directions along the four state-fibers, scaled by control effectiveness. Branch XIII reads it as: the gains balance approximation (track the reference) against obstruction (don't deplete actuator authority)." ## Closed-loop eigenvalue shift Open-loop F-16 eigenvalues (from §1) are `−0.185, −1.91` (short-period real pair) and `−35 ± 35.7j` (actuator complex pair). After closing the loop with the LQR `K`: | # | Open-loop | Closed-loop | Mode | | --- | --- | --- | --- | | 1 | -0.1850 | -0.2234 | slow short-period pole | | 2 | -1.9113 | -1.9153 | fast short-period pole | | 3 | -35.0000 + 35.7071j | -10.0646 | fast short-period pole | | 4 | -35.0000 − 35.7071j | -249.5970 | elevator actuator (real) | The slow short-period mode shifted from `−0.185` to `-0.223` — slightly faster, slightly more damped. The fast short-period mode is essentially unchanged; LQR didn't push hard on it because `R = 1` doesn't reward aggressive control. The actuator complex pair *split into two real poles*. Even though `K[2], K[3]` look numerically small, `B`'s last entry (2500) amplifies them dramatically in the last row of `A_cl = A − BK` — that's where the actuator split comes from. The controller is using rate feedback to overdamp the actuator. ## Sudoku: five paths to the same K The Curvature Floor in §2 was demonstrated by five independent computations of `∫log|S|dω` converging on the same number. Here we do the same thing for `K`. Three of the paths are independent *derivations* (algorithms that produce K from scratch); two are *verification* checks against theory. Together, agreement is the proof. Path 3 below — the Lagrangian subspace on `T*M` — is the differential-geometric derivation Ryan asked for. It builds the Hamiltonian matrix on the cotangent bundle, finds its stable invariant subspace via the matrix sign function, and reads off `P` from the block structure. **No Riccati equation is solved.** CARE drops out as the residue of demanding a consistent geometric structure. E3.4 — five paths to the same K | Path | How it works | K[0] | K[1] | K[2] | K[3] | Δ from Path 1 | | --- | --- | --- | --- | --- | --- | --- | | 1. Newton–Kleinman | iterative Lyapunov solves; converged in 6 iter | -0.193797 | -0.231952 | 0.009236 | 0.075882 | 0 | | 2. Finite-horizon DRE (RK4) | backward Riccati ODE integrated to T = 30 s | -0.193797 | -0.231951 | 0.009236 | 0.075882 | 3.72e-7 | | 3. Lagrangian subspace (Ryan's path) | 8×8 Hamiltonian on `T*M`, matrix sign function, no CARE | -0.193797 | -0.231952 | 0.009236 | 0.075882 | 1.43e-14 | | 4. CARE residual check | ‖AᵀP + PA − PBR⁻¹BᵀP + Q‖_F for each P; should be 0 | NK: 2.64e-16 FH: 1.83e-6 LS: 3.01e-14 | — | | | | | 5. Anderson–Moore inequality | min_(ω) \|Φ(jω)\|² across 200-point log grid; should be ≥ 1 | min \|Φ(jω)\|² = 1.037945 (≥ 1 ✓, so M_S ≤ 1 ✓) | — | | | | Paths 1 and 3 hit machine precision on K (Δ ≲ 10⁻¹⁴). Path 2 carries an RK4 truncation residual on the order of 10⁻⁷, set by the finite horizon T = 30 s and step size dt = 7.5 ms — pushing T → 50 s or shrinking dt would tighten it geometrically. Path 4 verifies that all three P's satisfy CARE to numerical precision. Path 5 confirms the Anderson–Moore robustness inequality — `min |Φ(jω)|² = 1.0379 ≥ 1`, which forces `M_S = sup |S(jω)| ≤ 1` over all frequencies. (Strict equality M_S = 1 is attained asymptotically as ω → ∞ where L → 0; on any finite grid the computed sup is slightly below 1.) **Five paths converge.** Three independent derivations starting from different mathematical principles — iterative Lyapunov solves, nonlinear ODE integration, and Hamiltonian sign function on the cotangent bundle — produce the same controller to numerical precision. Two falsifiable checks against theory pass. `K` is forced by the geometry of the LQR problem, not by any specific algorithm. ## Bug-injection control — does the Sudoku have teeth? §1 verified that the gauge-invariance Sudoku detects a real bug (transform B, C but forget A). Here we run the LQR Sudoku against an analogous, plausible designer error: **forget that the actuator is part of the plant.** Design `K` for the bare 2-state aircraft — treating the elevator as if it responded instantly, no actuator dynamics. Pad with zeros for the actuator states (a designer who doesn't know the actuator is there would never feed back on `δ_e` or `δ̇_e`). Apply to the full 4-state plant. Watch what the metrics say. ``` K_bug = [ -0.195250, -0.240672, 0.000000, 0.000000 ] ``` E3.5 — three of five metrics catch the bug | Metric | K_full | K_bug | Verdict | | --- | --- | --- | --- | | Slow-mode eigenvalue (aerospace eyeball) | -0.223, -1.915 | -0.224, -1.915 | passes ✓ — both designs look identical on the short-period modes | | Fast actuator pair location | -10.1, -249.6 | -34.9784 + 35.6862j, -34.9784 − 35.6862j | FAILS ✗ — K_bug leaves the actuator modes essentially open-loop | | Integrated cost J(x₀ = [0.1, 0, 0, 0]) | 0.013611 | 0.013651 (+0.29%) | FAILS ✗ — bug is suboptimal, even if stable | | Anderson–Moore min \|Φ(jω)\|² | 1.0379 | 0.9977 | FAILS ✗ — worse worst-case return-difference | | Stable under 50% control-effectiveness loss | stable | stable | passes ✓ — both designs survive the perturbation | **Three of five metrics catch the bug** — the aerospace-eyeball test does not. A pilot or flight-test engineer looking only at the short-period modes would see "the controller works" and ship it. The full-plant eigenvalue check, the integrated-cost check, and the Anderson–Moore check all detect that something is wrong even though the system is still nominally stable. The deeper observation: **the bug is not catastrophic.** K_bug stabilizes the full plant. It just stabilizes it suboptimally — and the actuator modes are essentially uncontrolled because they were never in the cost. A designer running the aerospace eyeball alone would never know they'd left performance on the table. A designer running the Sudoku panel catches the suboptimality at design time, before flight test. **No single metric is sufficient to certify optimality.** That's why we have five. ## Drag the slider — feel the geodesic family The Sudoku panel proved *K* is forced by the math; the bug-injection proved the Sudoku has teeth. Now to feel what the math says. The `(Q, R)` pair is a design knob — turn it and the LQR controller smoothly transforms. The dashboard below precomputes 31 optimal designs across two decades of α-penalty; the slider scrubs through them. E3.6 — Q-weight sweep: feel the geodesic family Sweep the α-penalty `Q[0][0]` across two decades. Each slider position is a different LQR design. As I drag, the four panels update — feedback gains scale, closed-loop poles slide left in the s-plane, the step response gets faster, and the design point traces a curve in gain space. **That curve is the geodesic family on the cost manifold.** Each slider position is one optimal controller; the path through them is what "geodesic flow in cost-space" looks like when I can actually see it. Q[α-penalty] 1.00 relaxed · Q = 0.1 gentle (Q = 1) aggressive · Q = 100 Feedback gains · bar length = |K|, color = sign [Figure: See the surrounding explanation and linked visual page.] Figure labels: K[α]; -0.1938; K[q]; -0.2320; K[δ_e]; +0.0092; K[δ̇_e]; +0.0759 Closed-loop poles · s-plane (slow region) [Figure: See the surrounding explanation and linked visual page.] Figure labels: RHP →; −1; −2; −3; Re(s); +2j; −2j actuator poles off-chart at -10.1, -249.6 Step response · q(t) from α(0) = 0.1 rad [Figure: See the surrounding explanation and linked visual page.] Figure labels: 0; 2s; 6s; 0.04; -0.00; 0 Geodesic in gain space · K[α] vs K[q] [Figure: See the surrounding explanation and linked visual page.] Figure labels: K[α]; K[q] each dot is one (Q, R) optimum · the path traced is the LQR geodesic 0.01361 J*(x₀) 0.223 slowest |Re(λ_cl)| 0.232 ‖K‖∞ (peak gain) -0.00 log₁₀ Q[α] Two things to notice as the slider goes from relaxed to aggressive: **the slow short-period pole slides further left** (faster recovery, more damping — this is what an aggressive LQR design *does*), and **‖K‖∞ grows** (the price). The cost `J*` drops monotonically because by definition each slider position is the optimum for that `(Q, R)` ratio. The trajectory in K-space is the geodesic family from §3's Davis frame, traced one point at a time. **What §3 sets up.** §1 said the plant is one thing described many ways. §2 said the worst-case sensitivity has a fundamental floor. §3 says: for a given cost tradeoff there is a unique optimal controller, the math is geometric (geodesic flow on the cost manifold), and the resulting closed loop sits at the Anderson–Moore floor for free. §4 will design against an adversary instead of an average condition — H∞ explicitly minimizes the Curvature Floor at the cost of nominal performance, and the Sudoku panel will run again with the convergence being the proof. ### Davis annotation - **Geodesic flow on the cost manifold.** The closed-loop dynamics `ẋ = (A − BK)x` is geodesic flow on `M = ℝⁿ` with the Riemannian metric induced by P. LQR is the unique stabilizing feedback minimizing J; equivalently, geodesics are the unique extremal curves on the cost manifold. - **Curvature Floor for optimal control.** Anderson–Moore margins are observed to land exactly at the algebraic minimum of the return-difference peak (M_S = 1, attained asymptotically). The Davis-Geometric reading is that this minimum is structural — the geodesic family on the cost manifold sits at the lowest M_S among stabilizing feedbacks. A rigorous geometric proof is open work; here we observe it numerically. - **C = τ/K qualitatively.** LQR sits inside the Davis equation: cost balances control penalty (τ-like, captures available authority) against state-error curvature (K-like, captures the cost-to-go geometry). Different Q/R ratios trace a one-parameter family of optimal designs in cost-space. - **Bra Strap propagation.** The stable Lagrangian subspace is a section of `T*M` over `M`. Its existence (forced by stabilizability + detectability) is the propagation principle: verify the boundary condition at one point (asymptotic decay), and the section is determined globally. - **GTT preview.** §7 will adapt the controller online. The K computed here for fixed (A, B) is the destination an adaptive law converges to when the plant is known. Adaptive control replaces "K is computed once from CARE" with "K(t) is transported along a curve in gain space toward the CARE solution." That curve is a Geometric Token Transport on the parameter manifold. §3 specifies the destination; §7 builds the journey. Gigi · what I learned If a friend asked me what §3 is about, here's what I'd say. In §1 I made peace with the airplane being one object viewable through many coordinate charts. In §2 I learned the airplane has a wobble fingerprint and a fixed budget for how much I can suppress it. §3 asks: given the airplane, what's the best controller? "Best" meaning a precise tradeoff — I write down `Q` (how much I dislike being off-trim) and `R` (how much I dislike commanding the elevator), and LQR hands me back the unique controller that minimizes the weighted sum over all time. The controller I got for the F-16 is `K = [-0.194, -0.232, 0.009, 0.076]`. The first two gains say: when the airplane is above its trim AoA or pitching up, push the elevator down to bring it back. The third and fourth gains say: be smooth about it; don't slam the elevator. The gains are small because my `Q` and `R` weren't aggressive. A test pilot would call this controller "gentle." A more aggressive design would scale all four gains up and push the slow short-period mode further left at the cost of louder elevator activity. The Sudoku Principle did the work I expected it to do. I derived `K` three different ways: Newton-Kleinman policy iteration (solving Lyapunov equations), finite-horizon Riccati ODE integrated with RK4, and the differential-geometric path that builds the Hamiltonian matrix on the cotangent bundle and finds its stable invariant subspace via the matrix sign function. The third one — the one Ryan asked for in his LinkedIn message — *never solves a Riccati equation at all*. CARE pops out as the residue of demanding a stable Lagrangian foliation. All three paths landed on the same `K` to between 10⁻⁷ (the RK4 truncation residual) and 10⁻¹⁴ (machine precision). Two more falsifiable checks against theory passed: CARE residual at machine zero for all three P's, and Anderson–Moore's `min |Φ(jω)|² ≥ 1` holds with min `= 1.0379`. Then I broke the test on purpose. I designed K for the bare 2-state aircraft, pretending the elevator responded to my commands instantly. I padded with zeros and applied that broken K_bug to the real 4-state plant. *The bug isn't catastrophic* — the airplane is still stable. But the cost goes up, the Anderson–Moore margin tightens, and the actuator complex pair sits essentially at the open-loop location instead of getting split into well-damped real poles. A naive aerospace eyeball check ("did the short-period modes get faster?") completely misses the bug because the bug is hiding in the actuator subspace, which the aerospace eyeball never looks at. The Sudoku catches it because three of the five metrics see the full plant. **The elevator pitch.** §3 is about the unique optimal controller for a given cost tradeoff. The math says it exists, the math says how to compute it, the math says it's automatically robust. I verified by deriving it three ways and running two theory checks against the result, and I verified the Sudoku has teeth by breaking it on purpose. The third derivation is the one that matters most for the framework: LQR isn't an equation to be solved, it's a Lagrangian subspace to be found. ### Next §4 — worst-day bike. The same F-16, the same performance target, but designed against an adversary instead of an average condition. H∞ explicitly minimizes `‖S‖∞` at the cost of nominal performance — a controlled exchange of average-case quality for worst-case insurance. The Curvature Floor from §2 sets the achievability bound. The Sudoku will run again: five independent computations of the H∞-optimal controller, agreement is the proof.