Boundary conditions for variational Rayleigh quotients (source code)

= Boundary conditions for variational Rayleigh quotients
{title2=$\delta\Lambda=\frac2{\int wy^2}\left([py'\eta]_a^b+\int_a^b[-(py')'+qy-\Lambda wy]\eta\,dx\right)$}

For real smooth coefficients with $p,w>0$, the <Rayleigh quotient> $\Lambda[y]=\int[p(y')^2+qy^2]dx/\int wy^2dx$ has the displayed <first variation>. Its stationary points solve the <Sturm-Liouville equation> on an admissible class whose boundary variations make $[py'\eta]_a^b=0$. Homogeneous <Dirichlet boundary conditions> do this by setting $\eta=0$ at the ends; homogeneous <Neumann boundary conditions> do it through $y'=0$. More general self-adjoint boundary conditions can require a boundary contribution to the quadratic form.

For an <eigenfunction>, the weaker identity $[pyy']_a^b=0$ suffices to give $\lambda=\Lambda[y]$ by <integration by parts>, but it does not by itself imply the condition on every variation. An explicit counterexample uses $p=q=w=1$ on $[0,1]$ and $y=\cos\pi x+\sin\pi x$. This solves $-y''+y=(1+\pi^2)y$ and has $[yy']_0^1=0$. Define a nearby family
$$
y_\varepsilon=y+\varepsilon(3x^2-2x^3)+\frac{\pi\varepsilon}{\varepsilon-1}(x^3-x^2).
$$
It keeps $y_\varepsilon(0)=1$, $y_\varepsilon'(0)=\pi$, $y_\varepsilon(1)=-1+\varepsilon$, and $y_\varepsilon'(1)=\pi/(-1+\varepsilon)$, so $[y_\varepsilon y_\varepsilon']_0^1=0$ for small $\varepsilon$. Nevertheless, $\eta=\partial_\varepsilon y_\varepsilon|_0$ has $\eta(0)=0$, $\eta(1)=1$, and $\int_0^1y^2dx=1$, giving $\delta\Lambda=2[y'\eta]_0^1=-2\pi\ne0$. Boundary-energy cancellation alone therefore cannot replace a specified variational domain.