y′′(x)+2y′(x)+y(x)=xsinxThe characteristic equation of the homogeneous DE 
k2+2k+1=0Roots 
k1=k2=−1Hence, the general solution of homogeneous DE 
yh(x)=C1e−x+C2xe−xThe partial solution of inhomogeneous DE 
yi(x)=(A+Bx)sinx+(C+Dx)cosxWe get      
yi′(x)=(A+Bx)cosx−(C+Dx)sinx+Bsinx+Dcosx 
yi′′(x)=−(A+Bx)sinx−(C+Dx)cosx+2Bcosx−2Dsinx 
−(A+Bx)sinx−(C+Dx)cosx+2Bcosx−2Dsinx+2((A+Bx)cosx−(C+Dx)sinx+Bsinx+Dcosx)+(A+Bx)sinx+(C+Dx)cosx=xsinxSo, the partial solution of inhomogeneous DE 
yi(x)=21(cosx−xcosx+sinx)Finally, 
y(x)=C1e−x+C2xe−x+21(cosx−xcosx+sinx)  
                             
Comments