reduction order method $xy''-(1+x)y'+y=x^2e^{2x}$, $y_1=1+x$ reduction order method $xy''-(1+x)y'+y=x^2e^{2x}$, being $y_1=1+x$ a solution of the homogeneous equation.
I made y=u(1+x) and got $u''(x^2+x)-u'(x^2+1)=x^2e^{2x}$
Then i did $u'=w$ and obtained $w=\frac{e^{2x}x^2+c_1e^xx}{(x+1)^2}$, however $u=\int{w }dx$ will be a strange expression that will not give to the solution $y=c_1e^x+c_2(1+x)+\frac{e^{2x}(x-1)}{2}$.
Can you help me finding my mistake?
Thanks
 A: Your work so far looks correct, so to find $u=\displaystyle\int\frac{x^{2}e^{2x}+Cxe^x}{(x+1)^2}dx=\int\frac{(xe^x)(xe^x+C)}{(x+1)^2}dx$,
use integration by parts with $w=xe^x+C, dw=(x+1)e^x dx$ and $ dv=\frac{xe^x}{(x+1)^2}dx, \;v=\frac{e^x}{x+1}$
to get $\displaystyle u=(xe^{x}+C)\left(\frac {e^x}{x+1}\right)-\int e^{2x}dx=\frac{xe^{2x}+Ce^x}{x+1}-\frac{1}{2}e^{2x}+D$.
Then $y=(x+1)u$ should give the correct solution.
A: i will assume that your equation for $u,$ i.e. 
$(x^2+x)u^{\prime \prime} -(x^2+1)u^\prime= x^2e^{2x}
$ is correct. then $w = u^\prime$ satisfies $$ (x^2+x)w^\prime -(x^2+1)w= x^2e^x$$
verify that $$w = {Ax \over (x+1)^2}$$ solves the homogenous problem for $w.$ now we will use the variation of parameters that is assume $A$ is a function of $x$ to be determined.
$$w^\prime =  {A^\prime x \over (x+1)^2} + {A \over (x+1)^2} - {2Ax \over (x+1)^3}$$
putting this in the equation for $w$ gives 
$$ {A^\prime x^2 \over (x+1)} + {Ax \over (x+1)} - {2Ax^2 \over (x+1)^2} - {Ax(x^2+1) \over (x+1)^2} = x^2 e^{2x}$$  which simplifies to 
$$ e^{-x}(A^\prime - A) = \frac{d(Ae^{-x})}{dx} = (x+1)e^x$$
so $$ Ae^{-x} = xe^x + C, w = {x(xe^{2x} + Ce^x) \over (x+1)^2 }$$
$$u =  \int  {  x(xe^{2x} + Ce^x) \over (x+1)^2 } dx $$ i hope i did not make any silly errors and you can do the integration by parts.
