Solution (source code)

= Solution

Use $\langle f,g\rangle_\pi=\sum_x\pi(x)f(x)g(x)$. The <Dirichlet form of a Markov chain> is
$$
\boxed{\mathcal E(f,f)=\langle f,(I-P)f\rangle_\pi=\frac12\sum_{x,y}\pi(x)P(x,y)(f(x)-f(y))^2.}
$$
The equality follows by expanding the square and using row sums one and the <stationary distribution> identity. For the <reversible Markov chain>, <detailed balance> makes $P$ a <self-adjoint operator>, with real <orthonormal eigenbasis> $f_1\equiv1,f_2,\ldots,f_m$ and ordered <eigenvalues> $1=\lambda_1>\lambda_2\geq\cdots\geq\lambda_m$.

Adding a constant changes neither the <variance> nor the <Dirichlet form of a Markov chain>. Expand the centered function as $f-\pi(f)=\sum_{j\geq2}a_jf_j$. Then
$$
\operatorname{Var}_\pi(f)=\sum_{j\geq2}a_j^2,\qquad
\mathcal E(f,f)=\sum_{j\geq2}(1-\lambda_j)a_j^2.
$$
For every nonconstant $f$ the quotient is at least $1-\lambda_2$, and equality is attained at $f=f_2$. This proves
$$
\boxed{\gamma=1-\lambda_2=\min_{\operatorname{Var}_\pi(f)>0}\frac{\mathcal E(f,f)}{\operatorname{Var}_\pi(f)}.}
$$
Equivalently minimize the <Dirichlet form of a Markov chain> over centered unit-norm functions. This is the variational characterization underlying the <Poincare inequality for a reversible Markov chain>, and does not require the <transition matrix> to have nonnegative <eigenvalues>. For a one-state chain there is no nonconstant test function; the displayed minimization concerns $m\geq2$.