Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 5:1, eq. (5:3b) — the cg directions are mutually conjugate

Proved
ConjGrad.Termination.cg_directions_conjugate

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

conjugate-gradientnumerical-linear-algebrap2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let AAA be a real symmetric positive definite n×nn \times nn×n matrix, let k,x0∈Rnk, x_0 \in \mathbb{R}^nk,x0​∈Rn, and let p0,p1,…p_0, p_1, \dotsp0​,p1​,… be the direction vectors produced by the conjugate gradient method (3:1) started at x0x_0x0​. Then

(pi,Apj)=0(i≠j).(p_i, Ap_j) = 0 \qquad (i \ne j).(pi​,Apj​)=0(i=j).

This is the relation that makes the cg-method a method of conjugate directions.

Formalization Note The statement is for all indices; after the method reaches the solution the directions are 000.

Preamble
import Mathlib
import Definitions.Def_ConjGrad_Termination_cgIter

open Matrix
Formal statement
namespace ConjGrad.Termination

/-- Theorem 5:1, eq. (5:3b) (Hestenes–Stiefel 1952, p. 414). For a symmetric positive
definite `A`, the directions `p₀, p₁, …` of the cg-method (3:1) are mutually conjugate:
`(pᵢ, Apⱼ) = 0` for `i ≠ j`. -/
theorem cg_directions_conjugate {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
    (k x₀ : Fin n → ℝ) :
    ∀ i j, i ≠ j → (cgIter A k x₀ i).p ⬝ᵥ (A *ᵥ (cgIter A k x₀ j).p) = 0 := by sorry

end ConjGrad.Termination
Source
Hestenes & Stiefel, Methods of Conjugate Gradients for Solving Linear Systems, J. Res. Natl. Bur. Stand. 49(6) (1952), https://doi.org/10.6028/jres.049.044, p. 414, Theorem 5:1, eq. (5:3b)
Read-back

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

Setting. Let n∈Nn \in \mathbb{N}n∈N and let AAA be a real n×nn\times nn×n matrix that is positive definite in this sense:

  • AAA is symmetric, A⊤=AA^\top = AA⊤=A;
  • ⟨v,Av⟩>0\langle v, A v\rangle > 0⟨v,Av⟩>0 for every nonzero v∈Rnv \in \mathbb{R}^nv∈Rn.

Here ⟨u,v⟩=∑lulvl\langle u,v\rangle = \sum_l u_l v_l⟨u,v⟩=∑l​ul​vl​. Let k,x0∈Rnk, x_0 \in \mathbb{R}^nk,x0​∈Rn be arbitrary.

The iteration. Let (xi,ri,pi)i∈N(x_i, r_i, p_i)_{i \in \mathbb{N}}(xi​,ri​,pi​)i∈N​ be the sequence defined recursively as follows. Start with

r0=p0=k−Ax0.r_0 = p_0 = k - A x_0 .r0​=p0​=k−Ax0​.

Then, for every i≥0i \ge 0i≥0,

ai=⟨ri,ri⟩⟨pi,Api⟩,xi+1=xi+aipi,ri+1=ri−aiApi,a_i = \frac{\langle r_i, r_i\rangle}{\langle p_i, A p_i\rangle}, \quad x_{i+1} = x_i + a_i p_i, \quad r_{i+1} = r_i - a_i A p_i,ai​=⟨pi​,Api​⟩⟨ri​,ri​⟩​,xi+1​=xi​+ai​pi​,ri+1​=ri​−ai​Api​, bi=⟨ri+1,ri+1⟩⟨ri,ri⟩,pi+1=ri+1+bipi.b_i = \frac{\langle r_{i+1}, r_{i+1}\rangle}{\langle r_i, r_i\rangle}, \quad p_{i+1} = r_{i+1} + b_i p_i .bi​=⟨ri​,ri​⟩⟨ri+1​,ri+1​⟩​,pi+1​=ri+1​+bi​pi​.

Every quotient with a zero denominator is 000, and the recursion never stops.

Conclusion. For all i,j∈Ni, j \in \mathbb{N}i,j∈N with i≠ji \ne ji=j,

⟨pi,Apj⟩=0.\langle p_i, A p_j\rangle = 0 .⟨pi​,Apj​⟩=0.

The claim covers all pairs of distinct natural numbers, including indices greater than nnn.

Degenerate cases.

  • n=0n = 0n=0. All vectors are empty and the claim holds trivially.
  • k=Ax0k = A x_0k=Ax0​. Then p0=0p_0 = 0p0​=0, and every later pip_ipi​ is 000 under the zero-quotient convention, so the claim holds.
  • Zero quotients. After any residual vanishes, the directions produced by the zero-quotient convention are included in the claim.
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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me