y=C1cosx+C2sinx+x+2xsinx
齐次方程 y′′+y=0 的通解为 yh=C1cosx+C2sinx。
对右端的 x,可取特解 yp1=x;对共振项 cosx,取 yp2=Axsinx,代入得 yp2′′+yp2=2Acosx,故 A=21。
由线性叠加,通解为