matrix_trace_vecMulVec_mul_vecMulVec
For any finite type r and vectors u, v : r → ℝ, the trace of the product of outer products vecMulVec u u and vecMulVec v v equals the square of their dot product (u ⬝ᵥ v)^2.
Statement
theorem matrix_trace_vecMulVec_mul_vecMulVec {r : Type*} [Fintype r] (u v : r → ℝ) : Matrix.trace (Matrix.vecMulVec u u * Matrix.vecMulVec v v) = (u ⬝ᵥ v) ^ 2
- Source
- arXiv:2610.04498 Lemma 2.1 proof -- Rank-sensitive vertex bounds for semidefinite lifts
- Verified
- 26 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- matrix_has_psd_factorization_hadamard_selfFor finite types m and n and any real matrix R : Matrix m n ℝ, the Hadamard square Matrix.hadamard R R has a positive semidefinite…
Read back from the Lean
For any finite type $r$ and any vectors $u, v : r \to \mathbb{R}$, the trace of the matrix product $(\mathrm{vecMulVec}(u, u) \cdot \mathrm{vecMulVec}(v, v))$ equals the square of the dot product of $u$ and $v$, $(u \cdot_v v)^2$.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The trace of the product of two rank-one outer products (u uᵀ)(v vᵀ) is computed by first contracting the product into a single outer product u ((u ⬝ᵥ v) • v)ᵀ. Taking the trace evaluates this to the dot product u ⬝ᵥ ((u ⬝ᵥ v) • v). Factoring out the scalar u ⬝ᵥ v leaves (u ⬝ᵥ v)², which matches the right-hand side by basic ring arithmetic.
The trace of the product of outer products reduces to (u ⬝ᵥ v) • (u ⬝ᵥ v).
Rewriting with Matrix.vecMulVec_mul_vecMulVec contracts the matrix product (u uᵀ)(v vᵀ) into the single outer product of u with (u ⬝ᵥ v) • v. Applying Matrix.trace_vecMulVec then turns the trace of this outer product into the dot product u ⬝ᵥ ((u ⬝ᵥ v) • v). Finally, dotProduct_smul pulls the scalar u ⬝ᵥ v out of the right argument, leaving (u ⬝ᵥ v) • (u ⬝ᵥ v).
uses
Matrix.vecMulVec_mul_vecMulVec,Matrix.trace_vecMulVec,dotProduct_smulrw [Matrix.vecMulVec_mul_vecMulVec, Matrix.trace_vecMulVec, dotProduct_smul](u ⬝ᵥ v) • (u ⬝ᵥ v) = (u ⬝ᵥ v)^2 automation
On the real numbers, scalar multiplication coincides with ordinary multiplication, so the expression is simply x * x = x^2, which is solved by polynomial ring arithmetic.
ring
Matrix.vecMulVec_mul_vecMulVec- The product of two outer products (u vᵀ) and (w xᵀ) is the outer product of u with (v ⬝ᵥ w) • x.
Matrix.trace_vecMulVec- The trace of the outer product a bᵀ equals the dot product a ⬝ᵥ b.
dotProduct_smul- A scalar factor in the second argument of a dot product pulls out: v ⬝ᵥ (x • w) = x • (v ⬝ᵥ w).
- In Lean, the scalar action of ℝ on itself is denoted by `•`, which the `ring` tactic transparently treats as standard multiplication.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- The trace of the product of outer products (u uᵀ) and (v vᵀ) equals the square of the dot product u ⬝ᵥ v. -/theorem matrix_trace_vecMulVec_mul_vecMulVec {r : Type*} [Fintype r] (u v : r → ℝ) : Matrix.trace (Matrix.vecMulVec u u * Matrix.vecMulVec v v) = (u ⬝ᵥ v) ^ 2 := by rw [Matrix.vecMulVec_mul_vecMulVec, Matrix.trace_vecMulVec, dotProduct_smul] ring