Solution (source code)

= Solution

Let $R[y]=F[y]/G[y]$, where $G[y]>0$ for a nonzero admissible real function. Writing $\lambda=R[y]$, its first variation is
$$
\delta R=\frac2G\left\{[py'\delta y]_\alpha^\beta+\int_\alpha^\beta[-(py')'+qy-\lambda wy]\delta y\,dx\right\}.
$$
Choose <boundary conditions> making the boundary term vanish, for example homogeneous <Dirichlet boundary conditions>, homogeneous <Neumann boundary conditions>, or a corresponding mixed pair. Arbitrary interior variations then give the <Sturm-Liouville problem>
$$
\boxed{-(py')'+qy=\lambda wy.}
$$
Multiplying this equation by $y$ and integrating by parts, with $[pyy']_\alpha^\beta=0$, yields
$$
\boxed{\lambda=\frac{\int_\alpha^\beta[p(y')^2+qy^2]dx}{\int_\alpha^\beta wy^2dx}=R[y].}
$$
Thus <eigenfunctions> are stationary directions of the quotient. The lowest <eigenvalue> is its global minimum; higher <eigenfunctions> need not be unrestricted maxima or minima. General Robin <boundary conditions> require including their boundary energy in the quotient unless the displayed endpoint products also vanish.

The <Rayleigh-Ritz method> chooses admissible trial functions depending on finitely many coefficients and minimizes this quotient over them. Expansion in a complete orthonormal basis with weight $w$ shows $R[y]\geq\lambda_0$, so the trial minimum is an upper bound on the true lowest <eigenvalue>. In a finite basis, the minimization becomes a <generalized eigenvalue problem> for the stiffness and weighted mass <matrices>. Enlarging the trial space can only lower or preserve this upper bound.