Variation of paramters in ODE I need to fund the general solution using the method of variation of parameters, given the two linearly independent solutions to the corresponding homogeneous equation

$$x^{ 2 }y"+xy'-y=x^{ 2 }e^{ x }\quad \quad \quad y_{ 1 }=x,y_{ 2 }=1/x$$

Solution:
My thinking here is I need to divide by $x^2$ in the equation to get $y"+y'/x-y/x^2=e^x$
And then use $y_1$ and $y_2$ in a $2\times 2$ matrix to determine the wronskian
Not sure how to find the general solution from here 
 A: $$x^2y''(x)+xy'(x)-y(x)=x^2e^x\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=\pm1$$
So we get as complementary solution:
$$y_c(x)=\frac{\text{C}_1}{x}+\text{C}_2x$$
Now, find the particular solution:
$$x^2y''(x)+xy'(x)-y(x)=x^2e^x$$
List the basis solutions in $y_c(x)$ so $y_{c_1}(x)=\frac{1}{x}$ and $y_{c_2}(x)=x$.
Compute the Wronskian of $y_{c_1}(x)$ and $y_{c_2}(x)$:
$$\mathcal{W}(x)=\left|\begin{matrix}
  \frac{1}{x} & x \\
  \frac{\text{d}}{\text{d}x}\left(\frac{1}{x}\right) & \frac{\text{d}}{\text{d}x}\left(x\right)
 \end{matrix}\right|=\left|\begin{matrix}
  \frac{1}{x} & x \\
  -\frac{1}{x^2} & 1
 \end{matrix}\right|=\frac{2}{x}$$
Divide the differential equation by the leading term's coefficient $x^2$:
$$y''(x)+\frac{y'(x)}{x}-\frac{y(x)}{x^2}=e^x$$
Let:


*

*$$q(x)=e^x$$

*$$r_1(x)=-\int\frac{q(x)y_{c_2}(x)}{\mathcal{W}(x)}\space\text{d}x=-\int\frac{x^2e^x}{2}\space\text{d}x=-\frac{e^x(x^2-2x+2)}{2}+\text{K}_1$$

*$$r_2(x)=\int\frac{q(x)y_{c_1}(x)}{\mathcal{W}(x)}\space\text{d}x=\int\frac{e^x}{2}\space\text{d}x=\frac{e^x}{2}+\text{K}_2$$


So:
$$y(x)=y_c(x)+r_1(x)y_{c_1}(x)+r_2(x)y_{c_2}(x)=\frac{\text{C}_1}{x}+\text{C}_2x+\frac{e^x(x-1)}{x}$$
