Find a solution of the differential equation: $\frac{d\left(x^2\frac{dy}{dx}\right)}{dx}=x\frac{dy}{dx}-y+5$ 

Find a solution of the differential equation: $$\frac{d\left(x^2\frac{dy}{dx}\right)}{dx}=x\frac{dy}{dx}-y+5$$



What I have attempted:
Consider:  $$\frac{d\left(x^2\frac{dy}{dx}\right)}{dx}=x\frac{dy}{dx}-y+5$$
$$ \frac{d}{dx} (x^2 \frac{dy}{dx}) =x\frac{dy}{dx}-y+5 $$
$$ x^2 \frac{d^2y}{dx^2}+2x\frac{dy}{dx}=x\frac{dy}{dx}-y+5$$
$$ x^2 \frac{d^2y}{dx^2}+x\frac{dy}{dx} +y = 5 $$
Now I am stuck.. 
 A: Hint:
set $x=e^{t}$ we have 
$$\frac{dy}{dx}=\frac{dy}{dt}\frac{dt}{dx}=\frac{1}{x}\frac{dy}{dt}$$
$$\frac{d^2y}{dx^2}=\frac{d}{dx}\left(\frac{1}{x}\frac{dy}{dt}\right)=-\frac{1}{x^2}\frac{dy}{dt}+\frac{1}{x^2}\frac{d^2y}{dt^2}$$
we have
$$\frac{d^2y}{dt^2}+y=5$$
A: $$\frac{\text{d}}{\text{d}x}\left(x^2\cdot\frac{\text{d}}{\text{d}x}\left(y(x)\right)\right)=x\cdot\frac{\text{d}}{\text{d}x}\left(y(x)\right)-y(x)+5\Longleftrightarrow$$
$$x(xy''(x)+2y'(x))=xy'(x)-y(x)+5\Longleftrightarrow$$

The general solution will be the sum of the complementary solution
and particular solution.
Find the complementary solution by solving:

$$x^2y''(x)+xy'(x)+y(x)=0\Longleftrightarrow$$

Assume a solution, proportional to $x^\mu$ for some constant $\mu$.
Substitute $y(x)=x^\mu$:

$$x^2\cdot\frac{\text{d}^2}{\text{d}x^2}\left(x^\mu\right)+x\cdot\frac{\text{d}}{\text{d}x}\left(x^\mu\right)+x^\mu=0\Longleftrightarrow$$

Substitute $\frac{\text{d}^2}{\text{d}x^2}\left(x^\mu\right)=(\mu-1)\mu x^{\mu-2}$ and $\frac{\text{d}}{\text{d}x}\left(x^\mu\right)=\mu x^{\mu-1}$:

$$\mu^2 x^\mu+x^\mu=0\Longleftrightarrow$$
$$x^\mu\left(\mu^2+1\right)=0\Longleftrightarrow$$

Assuming $x\ne0$, zeros must come from the polynomial:

$$\mu^2+1=0\Longleftrightarrow$$
$$\mu=\pm i$$
Using Euler's identity:
$$y_c(x)=\text{C}_1\cos(\ln(x))+\text{C}_2\sin(\ln(x))$$
Now, find the particular solution:
$$x^2y''(x)+xy'(x)+y(x)=5$$
List the basis solutions in $y_c(x)$ so $y_{c_1}(x)=\cos(\ln(x))$ and $y_{c_2}(x)=\sin(\ln(x))$.
Compute the Wronskian of $y_{c_1}(x)$ and $y_{c_2}(x)$:
$$\mathcal{W}(x)=\left|\begin{matrix}
  \cos(\ln(x)) & \sin(\ln(x)) \\
  \frac{\text{d}}{\text{d}x}\left(\cos(\ln(x))\right) & \frac{\text{d}}{\text{d}x}\left(\sin(\ln(x))\right)
 \end{matrix}\right|=\left|\begin{matrix}
  \cos(\ln(x)) & \sin(\ln(x)) \\
  -\frac{\sin(\ln(x))}{x} & \frac{\cos(\ln(x))}{x}
 \end{matrix}\right|=\frac{1}{x}$$
Divide the differential equation by the leading term's coefficient $x^2$:
$$y''(x)+\frac{y'(x)}{x}+\frac{y(x)}{x^2}=\frac{5}{x^2}$$
Let:


*

*$$q(x)=\frac{5}{x^2}$$

*$$r_1(x)=-\int\frac{q(x)y_{c_2}(x)}{\mathcal{W}(x)}\space\text{d}x=-\int\frac{5\sin(\ln(x))}{x}\space\text{d}x=-5\cos(\ln(x))+\text{K}_1$$

*$$r_2(x)=\int\frac{q(x)y_{c_1}(x)}{\mathcal{W}(x)}\space\text{d}x=\int\frac{5\cos(\ln(x))}{x}\space\text{d}x=5\sin(\ln(x))+\text{K}_2$$


So:
$$y(x)=y_c(x)+r_1(x)y_{c_1}(x)+r_2(x)y_{c_2}(x)=\text{C}_1\cos(\ln(x))+\text{C}_2\sin(\ln(x))+5$$
