Solution (source code)

= Solution

The original PDF has a typographical omission: its displayed equation has $\lambda w(x)$ rather than $\lambda w(x)y(x)$ on the right. Taken literally, it is an inhomogeneous <boundary value problem>, not the stated <Sturm-Liouville problem>. The quotient and the later <eigenfunction expansion> identify the intended equation, which the following derivation produces explicitly.

Choose homogeneous <Dirichlet boundary conditions> $y(a)=y(b)=0$ and a nonzero real admissible $y$. Then $G[y]>0$ because $w>0$. For an endpoint-zero <variation> $\eta$, <integration by parts> gives
$$
\delta F=2\int_a^b[py'\eta'+qy\eta]dx=2\int_a^b[-(py')'+qy]\eta\,dx,\qquad\delta G=2\int_a^bwy\eta\,dx.
$$
The <first variation> of the <Rayleigh quotient> is thus
$$
\delta\Lambda=\frac2{G[y]}\int_a^b[-(py')'+qy-\Lambda[y]wy]\eta\,dx.
$$
By the <fundamental lemma of the calculus of variations>, stationarity is equivalent to
$$
\boxed{-(py')'+qy=\lambda wy,\qquad\lambda=\Lambda[y],\qquad y(a)=y(b)=0.}
$$
Conversely, multiply this corrected <eigenvalue> equation by $y$ and integrate. The same boundary cancellation gives $F[y]=\lambda G[y]$, so the <first variation> vanishes. This proves the requested equivalence for the intended equation. Homogeneous <Neumann boundary conditions>, or a Dirichlet condition at one end and a Neumann condition at the other, also eliminate the boundary term. General <Robin boundary conditions> would require the corresponding boundary contribution in the numerator.