solve : $xy''+2y'+xy=1$ given that $y=\frac{\sin x}{x}$ is a solution for $xy''+2y'+xy=0$, solve $xy''+2y'+xy=1$.
My try:
$\begin{aligned}xy''+2y'+xy&=0\\y''+\frac2xy'+y&=0\\\begin{pmatrix}
\frac{\sin x}x& u\\
\frac{x\cos(x)-\sin(x)}{x^2} & u'
\end{pmatrix}&=\frac2x\\\frac{\sin x }{x}u'-\frac{x\cos(x)-\sin(x)}{x^2}u&=\frac2x\\\left(u\frac{x}{\sin x}\right)'&=\frac{2x}{\sin^2x}\\u\frac{x}{\sin x}&=2\left(-x\cot x+\log\left(\sin x\right)\right)+c\\u&=2\left(-\cos x+\frac{\sin x\log\sin x}x\right)+c\frac{\sin x}x\\\end{aligned}$.
So it we found another solution.
Now let's try to find a specific solution for :
$y''+\frac2xy'+y=\frac1x$
The undetermined coefficient method seems to be inefficient here, does anyone have an efficient solution for this.

$$y''-\frac{2}{x}y'+y=0~~~(1)$$, if $y_1=\frac{\sin x}{x}$ is a solution of (1), then the other solution $y_2(x)$ is given by
$$y_2(x)=y_1(x) \int \frac{e^{\int p(x) dx}}{y^2_1(x)}dx,~ p(x)=-2/x$$
$$\implies y_2(x)= \frac{\sin x}{x} \int \frac{1}{x^2}\frac{x^2}{\sin ^2 x} dx$$
One may ignor the multiplicative $-$ sign for $y_2(x)$.
$$\implies y_2(x)=\frac{\sin x}{x} \int \csc^2 x dx=-\frac{\cos x}{x}.$$
For solving the inhomogeneous equation $$Y''-\frac{2}{x}Y'+Y=\frac{1}{x}~~~(2)$$
the method of variation of parameter can be used which requires $y_1(x), y_2(x)$, the solution of (2) is given by $$Y(x)=C_1(x) y_1(x)+ C_2(x) y_2(x)~~~(3)$$
where $$C_1(x)=-\int \frac{y_2(x)/x}{W(x)} dx+D_1= \int \cos x dx+D_1=\sin x +D_1.$$
The Wronskian $W(x)$ of $y_1,y_1$ is $-1/x^2$.
Similarly, we have $$C_2=\int \frac{y_1(x)/x}{W(x)} dx+D_2=-\int \sin x dx+D_2=\cos x +D_2.$$
Inserting , $y_1(x), y_2(x). C_1(x), C_2(x)$ in (3), we get
$$Y(x)=\frac{1}{x}[D_1 \sin x+ D_2 \cos x]+\frac{1}{x}[\sin^2 x+ \cos^2 x].$$
$$\implies Y(x)=\frac{1}{x}[D_1 \sin x+ D_2 \cos x]+\frac{1}{x},$$
which is the solution of the reqyured ODE (2).
For the method of Variation of Parameters see:
https://en.wikipedia.org/wiki/Variation_of_parameters
