特征方程为r²+r=0,得r=0,-1
齐次方程的解y1=C1+C2e^(-x)
设特解为y*=(ax+b)cos2x+(cx+d)sin2x
则y*'=acos2x-2(ax+b)sin2x+csin2x+2(cx+d)cos2x
y*"=-4asin2x-4(ax+b)cos2x+4ccos2x-4(cx+d)sin2x
代入原方程:(a+2d-4b+4c)cos2x+(-2b+c-4a-4d)sin2x+(-2a-4c)xsin2x+(2c-4a)xcos2x=xcos2x
比较系数得:2c-4a=1,-2a-4c=0,a+2d-4b+4c=0,-2b+c-4a-4d=0
得:a=-1/3,b=-1/12,c=-1/6,d=1/3
所以通解为y=y1+y*=C1+C2e^(-x)+(-x/3-1/12)cos2x+(-x/6+1/3)sin2x