Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 3.11 — the gradient of the LQR cost is 2(RKC−B⊤X)YC⊤2(RKC-B^\top X)YC^\top2(RKC−B⊤X)YC⊤

Proved
FatkhullinPolyak.Flow.lqr_gradient_formula

by mikedeng1 · Sep 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

gradientlqrp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let Q,R,Σ≻0Q, R, \Sigma\succ0Q,R,Σ≻0 and let K∈SK\in\mathcal SK∈S be a stabilizing gain. Then the LQR cost fff is (Fréchet) differentiable at KKK, and its derivative is the linear functional

E  ⟼  Tr(∇f(K)⊤E)=⟨∇f(K),E⟩F,∇f(K)=2 (RKC−B⊤X(K)) Y(K) C⊤,E \;\longmapsto\; \mathrm{Tr}\big(\nabla f(K)^\top E\big) = \langle \nabla f(K), E\rangle_F,\qquad \nabla f(K) = 2\,(RKC - B^\top X(K))\,Y(K)\,C^\top,E⟼Tr(∇f(K)⊤E)=⟨∇f(K),E⟩F​,∇f(K)=2(RKC−B⊤X(K))Y(K)C⊤,

where X(K)X(K)X(K) solves (2.7) and Y(K)Y(K)Y(K) solves the Lyapunov equation (3.4) AKY+YAK⊤+Σ=0A_KY + YA_K^\top + \Sigma = 0AK​Y+YAK⊤​+Σ=0.

In other words, (3.3) is the gradient of fff with respect to the Frobenius inner product ⟨M,N⟩=Tr(M⊤N)\langle M, N\rangle = \mathrm{Tr}(M^\top N)⟨M,N⟩=Tr(M⊤N), so the flow (4.1) is the gradient flow of fff.

Formalization Note Differentiability is taken with respect to the Frobenius norm on Rm×r\mathbb R^{m\times r}Rm×r (Mathlib's Matrix.frobeniusNormedAddCommGroup, used as a local instance); all norms on this finite-dimensional space give the same notion. The standing assumptions rank⁡C=r\operatorname{rank}C=rrankC=r and B≠0B\ne0B=0 are not needed for this statement and are omitted, which makes it only stronger.

Preamble
import Mathlib
import Definitions.Def_FatkhullinPolyak_Flow_LQR
Formal statement
namespace FatkhullinPolyak.Flow

open Matrix

attribute [local instance] Matrix.frobeniusNormedAddCommGroup Matrix.frobeniusNormedSpace

theorem lqr_gradient_formula {n m r : ℕ}
    (A : Matrix (Fin n) (Fin n) ℝ) (B : Matrix (Fin n) (Fin m) ℝ) (C : Matrix (Fin r) (Fin n) ℝ)
    (Q : Matrix (Fin n) (Fin n) ℝ) (R : Matrix (Fin m) (Fin m) ℝ) (Sig : Matrix (Fin n) (Fin n) ℝ)
    (hQ : Q.PosDef) (hR : R.PosDef) (hSig : Sig.PosDef)
    (K : Matrix (Fin m) (Fin r) ℝ) (hK : K ∈ stabSet A B C) :
    ∃ f' : Matrix (Fin m) (Fin r) ℝ →L[ℝ] ℝ,
      HasFDerivAt (fun K' => cost A B C Q R Sig K') f' K ∧
        ∀ E : Matrix (Fin m) (Fin r) ℝ, f' E = trace ((grad A B C Q R Sig K)ᵀ * E) := by sorry

end FatkhullinPolyak.Flow
Source
Fatkhullin, Polyak, Optimizing Static Linear Feedback: Gradient Method, arXiv:2004.09875v2, p. 7, Lemma 3.11, (3.3)–(3.4)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. Let

A∈Rn×n,B∈Rn×m,C∈Rr×n,Q∈Rn×n,R∈Rm×m,Σ∈Rn×n.A\in\mathbb R^{n\times n},\quad B\in\mathbb R^{n\times m},\quad C\in\mathbb R^{r\times n},\quad Q\in\mathbb R^{n\times n},\quad R\in\mathbb R^{m\times m},\quad \Sigma\in\mathbb R^{n\times n}.A∈Rn×n,B∈Rn×m,C∈Rr×n,Q∈Rn×n,R∈Rm×m,Σ∈Rn×n.

Gains KKK are m×rm\times rm×r real matrices. The notions used are:

  • S\mathcal SS is the set of gains with every complex eigenvalue of A−BKCA-BKCA−BKC having negative real part.
  • X(K)X(K)X(K) is the unique solution of (A−BKC)⊤X+X(A−BKC)+C⊤K⊤RKC+Q=0(A-BKC)^\top X+X(A-BKC)+C^\top K^\top RKC+Q=0(A−BKC)⊤X+X(A−BKC)+C⊤K⊤RKC+Q=0, or 000 if the solution is not unique.
  • Y(K)Y(K)Y(K) is the unique solution of (A−BKC)Y+Y(A−BKC)⊤+Σ=0(A-BKC)Y+Y(A-BKC)^\top+\Sigma=0(A−BKC)Y+Y(A−BKC)⊤+Σ=0, or 000 if the solution is not unique.
  • The cost is f(K)=tr⁡(X(K)Σ)f(K)=\operatorname{tr}(X(K)\Sigma)f(K)=tr(X(K)Σ), defined for every K∈Rm×rK\in\mathbb R^{m\times r}K∈Rm×r.
  • ∇f(K):=2(RKC−B⊤X(K))Y(K)C⊤\nabla f(K):=2\big(RKC-B^\top X(K)\big)Y(K)C^\top∇f(K):=2(RKC−B⊤X(K))Y(K)C⊤ is the explicit formula.

The space Rm×r\mathbb R^{m\times r}Rm×r carries the Frobenius norm. In finite dimension the notion of differentiability does not depend on this choice.

Hypotheses.

  • QQQ, RRR, Σ\SigmaΣ are positive definite (symmetric, with x⊤Mx>0x^\top Mx>0x⊤Mx>0 for x≠0x\ne 0x=0).
  • K∈SK\in\mathcal SK∈S.
  • No rank condition on CCC and no condition on BBB is imposed.

Conclusion. The function f:Rm×r→Rf:\mathbb R^{m\times r}\to\mathbb Rf:Rm×r→R is Fréchet differentiable at KKK, and its derivative is the linear map

E  ⟼  tr⁡(∇f(K)⊤E)=∑i,j(∇f(K))ijEij.E\;\longmapsto\;\operatorname{tr}\big(\nabla f(K)^\top E\big)=\sum_{i,j}\big(\nabla f(K)\big)_{ij}E_{ij}.E⟼tr(∇f(K)⊤E)=i,j∑​(∇f(K))ij​Eij​.

In other words, the explicit matrix ∇f(K)\nabla f(K)∇f(K) represents the derivative of fff at KKK in the trace (Frobenius) inner product. Differentiability here is a statement about fff on a full neighbourhood of KKK in Rm×r\mathbb R^{m\times r}Rm×r, using the values fff actually takes there.

Degenerate cases.

  • If m=0m=0m=0 or r=0r=0r=0, the domain is a single point and the statement is trivial.
  • If n=0n=0n=0, then f≡0f\equiv 0f≡0 and ∇f(K)=0\nabla f(K)=0∇f(K)=0, so the claim is that the zero function has derivative 000.
  • The hypotheses are satisfiable whenever S\mathcal SS is nonempty. If S\mathcal SS is empty, the statement is vacuous.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me