Solution (source code)

= Solution

Expand the forcing and the solution in the normalized <eigenfunctions>: $1=\sum_n b_ny_n$ and $y=\sum_n c_ny_n$. Their coefficients are
$$
b_n=\int_1^e y_n(x)\frac{dx}{x}=\sqrt2\int_0^1\sin(n\pi t)dt=\frac{\sqrt2[1-(-1)^n]}{n\pi}.
$$
Since all $\lambda_n=n^2\pi^2-1$ are nonzero, the equation gives $c_n=b_n/\lambda_n$. Hence the required <Sturm-Liouville eigenfunction expansion> is
$$
\boxed{y(x)=\sum_{\substack{n\geq1\\n\text{ odd}}}\frac{4\sin(n\pi\ln x)}{n\pi(n^2\pi^2-1)}.}
$$
This is <constant forcing in a logarithmic Dirichlet Sturm-Liouville problem>. The coefficients are $O(n^{-3})$, so the solution series converges uniformly and has zero endpoint values. Applying $L$ is justified in the weighted square-integrable sense; the forcing sine series equals one at interior points, while its endpoint sums are zero. The equation is imposed in the interior, so this does not contradict the boundary conditions.

As an independent check, solving $-Y''-Y=1$ directly gives
$$
y(x)=\frac{\cos(\ln x-1/2)}{\cos(1/2)}-1.
$$
It has both zero endpoint values and satisfies $Ly=1$. The invertibility of the Dirichlet operator makes it the same solution as the expansion.