= Solution
Use the <method of undetermined coefficients>. Substitution of $y_p=(a+bx)\sin x+(c+dx)\cos x$ gives
$$
y_p''-2y_p'+y_p=(-2b+2c-2d+2dx)\sin x+(-2a+2b-2d-2bx)\cos x.
$$
Equating the coefficients of $x\sin x$, $x\cos x$, $\sin x$, and $\cos x$ to the forcing gives $d=1$, $b=0$, $c=1$, $a=-1$. Thus
$$
\boxed{y_p=-\sin x+(1+x)\cos x.}
$$
The <characteristic equation> of the homogeneous equation is $(r-1)^2=0$, with a <repeated root>. Its <complementary function> is $(C_1+C_2x)e^x$. Since $y_p(0)=1$ and $y_p'(0)=0$, the initial conditions give $C_1=-1$ and $C_2=1$. Therefore
$$
\boxed{y=(x-1)e^x-\sin x+(1+x)\cos x.}
$$
Direct differentiation verifies both zero initial data and the original forcing.
Back to article page