The question is:
Use the integrating factor method to solve the differential equation
$\frac{1}{x}\frac{dy}{dx}+y=x^2$
for the case where $y=1 $ when $x=0$
What I have done so far:
$\frac{dy}{dx}+xy=x^3$
$ S(x)\frac{dy}{dx}+S(x)xy=S(x)x^3 $ --- Multiply ODE with integrating factor $S(x)$
and demand that it satisfies the condition $\frac{dS}{dx}=S(x) {x}$
$\int \frac {1}{S} dS = \int xdx$
$lnS = \frac{x^2}{2}+c$
$S(x)= Ae^{\frac{x^2}{2}}$ and setting A = 1
$S(x)= e^{\frac{x^2}{2}}$
$\frac{d}{dx}(e^{\frac{x^2}{2}}y)=x^3e^{\frac{x^2}{2}}$
$e^{\frac{x^2}{2}}y = \int x^3e^{\frac{x^2}{2}}dx $
I'm having trouble integrating the right hand side. I have tried to do it by parts but cannot cancel out terms. There may be an error in my calculation up to that point as well.
$$I = \int x^3 e^{\frac{x^2}{2}}dx$$
$u=x^2\implies \frac{du}{dx} = 2x$
$$I = \int x\cdot u\cdot \frac{1}{2x}\cdot e^{\frac{u}{2}} dx = \frac{1}{2}\int ue^{\frac{u}{2}}du$$
Then we do this by parts:
Let $v = \int e^{\frac{u}{2}}du\implies v = 2e^{\frac{u}{2}}$
Let $w = u\implies \frac{dw}{du} = 1$
Then $$I = \frac{1}{2}\left(2ue^{\frac{u}{2}}-2\int e^{\frac{u}{2}}du \right) =ue^{\frac{u}{2}}-2e^{\frac{u}{2}} +C$$
$$I = e^{\frac{x^2}{2}}(x^2-2)+C$$