Theorem (Matrix.PosDef.conjTranspose_krylovMatrix_mulVec_sub_mulVec_cgIterate_eq_zero).The Galerkin condition: for positive definite \mathbf{A} the residual of the CG iterate is orthogonal to \mathcal{K}_q(\mathbf{A}, \mathbf{r}_0), \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0: \mathbf{K}_q(\mathbf{A}, \mathbf{r}_0)^{\mathsf{H}}(\mathbf{b} - \mathbf{A}\,\mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q)) = \mathbf{0}. [Saad2003, §6.7]; there CG is the orthogonal projection method onto \mathcal{K}_q(\mathbf{A}, \mathbf{r}_0), whose defining condition is this one ([Saad2003, (5.3)] with \mathcal{L} = \mathcal{K}), stated for real symmetric \mathbf{A}.
Headline (provisional)
Lean statement and details
Matrix.PosDef.conjTranspose_krylovMatrix_mulVec_sub_mulVec_cgIterate_eq_zero.{u_1, u_2}
{𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜}
(hA : A.PosDef) (b x₀ : n → 𝕜) (q : ℕ) :
(krylovMatrix A (b - A *ᵥ x₀) q)ᴴ *ᵥ (b - A *ᵥ cgIterate A b x₀ q) = 0
Theorem (Matrix.PosDef.eq_cgIterate_of_conjTranspose_krylovMatrix_mulVec_sub_eq_zero).The Galerkin condition characterises CG: for positive definite \mathbf{A}, a vector of \mathbf{x}_0 + \mathcal{K}_q(\mathbf{A}, \mathbf{r}_0) whose residual is orthogonal to the Krylov space is \mathsf{cgIterate}(\mathbf{A}, \mathbf{b}, \mathbf{x}_0, q), where \mathbf{r}_0 = \mathbf{b} - \mathbf{A}\mathbf{x}_0. [Saad2003, §6.7]; there CG is defined by this condition ([Saad2003, (5.3)] with \mathcal{L} = \mathcal{K}), whose solution is unique since the projected matrix is nonsingular for positive definite \mathbf{A} ([Saad2003, Proposition 5.1]).
Lean statement and details
Matrix.PosDef.eq_cgIterate_of_conjTranspose_krylovMatrix_mulVec_sub_eq_zero.{u_1, u_2}
{𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜}
(hA : A.PosDef) {b x₀ y : n → 𝕜} {q : ℕ} (hy : y - x₀ ∈ krylovSpace A (b - A *ᵥ x₀) q)
(h : (krylovMatrix A (b - A *ᵥ x₀) q)ᴴ *ᵥ (b - A *ᵥ y) = 0) : y = cgIterate A b x₀ q