Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Equation (24.8): the LDA log-likelihood ratio ½(x−μ₀)ᵀΣ⁻¹(x−μ₀) − ½(x−μ₁)ᵀΣ⁻¹(x−μ₁) equals ⟨w, x⟩ + b with w = Σ⁻¹(μ₁−μ₀), b = ½(μ₀ᵀΣ⁻¹μ₀ − μ₁ᵀΣ⁻¹μ₁)

Proved
UnderstandingML.lda_log_likelihood_ratio

by naimengye · Sep 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

bayes-optimallinear-classifierlinear-discriminant-analysis

Equation (24.8). In the LDA setting the log-likelihood ratio becomes 12(x−μ0)⊤Σ−1(x−μ0)−12(x−μ1)⊤Σ−1(x−μ1)\frac12(x-\mu_0)^\top\Sigma^{-1}(x-\mu_0) - \frac12(x-\mu_1)^\top\Sigma^{-1}(x-\mu_1)21​(x−μ0​)⊤Σ−1(x−μ0​)−21​(x−μ1​)⊤Σ−1(x−μ1​), which can be rewritten as ⟨w,x⟩+b\langle w, x\rangle + b⟨w,x⟩+b where w=(μ1−μ0)⊤Σ−1w = (\mu_1 - \mu_0)^\top\Sigma^{-1}w=(μ1​−μ0​)⊤Σ−1 and b=12(μ0⊤Σ−1μ0−μ1⊤Σ−1μ1)b = \frac12(\mu_0^\top\Sigma^{-1}\mu_0 - \mu_1^\top\Sigma^{-1}\mu_1)b=21​(μ0⊤​Σ−1μ0​−μ1⊤​Σ−1μ1​). As a result, under the generative assumptions of LDA the Bayes optimal classifier is a linear classifier.

Formally: the identity for any symmetric matrix MMM in the role of Σ−1\Sigma^{-1}Σ−1.

Preamble
import Definitions.Def_UnderstandingML_Generative

open MeasureTheory ProbabilityTheory
open scoped InnerProductSpace
Formal statement
namespace UnderstandingML

/-- **Equation (24.8)** (p. 348). Under the LDA assumptions the log-likelihood ratio
`½(x − μ₀)ᵀΣ⁻¹(x − μ₀) − ½(x − μ₁)ᵀΣ⁻¹(x − μ₁)` equals `⟨w, x⟩ + b` with `w = Σ⁻¹(μ₁ − μ₀)` and
`b = ½(μ₀ᵀΣ⁻¹μ₀ − μ₁ᵀΣ⁻¹μ₁)`, so the Bayes optimal classifier is linear. Stated for any symmetric
matrix `M` in the role of `Σ⁻¹`. -/
theorem lda_log_likelihood_ratio {d : ℕ} (M : Matrix (Fin d) (Fin d) ℝ) (hM : M.IsSymm)
    (μ₀ μ₁ x : Fin d → ℝ) :
    1 / 2 * dotProduct (x - μ₀) (M.mulVec (x - μ₀)) - 1 / 2 * dotProduct (x - μ₁) (M.mulVec (x - μ₁)) =
      dotProduct (M.mulVec (μ₁ - μ₀)) x +
        1 / 2 * (dotProduct μ₀ (M.mulVec μ₀) - dotProduct μ₁ (M.mulVec μ₁)) := by sorry

end UnderstandingML
Source
Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press 2014, doi:10.1017/CBO9781107298019, §24.3 p. 348, Equation (24.8)
Human review
  • Endorsed by Shuze Chen · Sep 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by naimengye · Sep 25, 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