Solution (source code)

= Solution

On a finite state space with at least two states, as in the surrounding questions, for a real function write $\pi(f)=\sum_x\pi(x)f(x)$ and $\operatorname{Var}_\pi(f)=\sum_x\pi(x)(f(x)-\pi(f))^2$. The <Poincare inequality for a reversible Markov chain> with constant $C$ is
$$
\boxed{\operatorname{Var}_\pi(f)\leq C\mathcal E(f,f)\quad\text{for every }f,}
$$
where the <Dirichlet form of a Markov chain> is
$$
\mathcal E(f,f)=\frac12\sum_{x,y}\pi(x)P(x,y)(f(x)-f(y))^2=\langle f,(I-P)f\rangle_\pi.
$$
The associated <spectral gap> is the ordinary gap $\gamma=1-\lambda_2$, with variational formula
$$
\boxed{\gamma=\inf_{\operatorname{Var}_\pi(f)>0}\frac{\mathcal E(f,f)}{\operatorname{Var}_\pi(f)}.}
$$
Equivalently minimize $\mathcal E(f,f)$ subject to $\pi(f)=0$ and $\langle f,f\rangle_\pi=1$. Thus the <Poincare inequality for a reversible Markov chain> holds precisely for $C\geq1/\gamma$, and the optimal constant is $1/\gamma$. It controls the ordinary rather than absolute <spectral gap>, so negative <eigenvalues> do not invalidate it. If the unspecified state space in this part is infinite, the <Poincare inequality for a reversible Markov chain> and the variational infimum still make sense on nonconstant functions in $L^2(\pi)$, using the <self-adjoint operator> on that <Hilbert space>; the resulting <spectral gap> need not be represented by an actual second <eigenvalue>. The finite-state formula above is the intended specialization.