Positivity of a quadratic polynomial across a spectral gap (source code)

= Positivity of a quadratic polynomial across a spectral gap
{title2=$(B-aI)(B-bI)>0\quad\text{if }\operatorname{spec}B\cap[a,b]=\varnothing$}

Let $B$ be a finite-dimensional <Hermitian matrix> and $a<b$ real. The <spectral theorem> gives $v=\sum_jc_jx_j$ in an <orthonormal eigenbasis>, so
$$
v^\dagger(B-aI)(B-bI)v=\sum_j|c_j|^2(\lambda_j-a)(\lambda_j-b).
$$
If the <spectrum> avoids the closed interval, every factor product is positive. Consequently the <quadratic form> is positive for $v\ne0$ and zero for $v=0$. More precisely it is bounded below by $\min_j[(\lambda_j-a)(\lambda_j-b)]\|v\|^2$. This is a finite-dimensional instance of testing a <spectral gap> with a polynomial in the operator.