How to find the particular solution of this ODE? For the ODE:
$$x''(t)+x(t)+2\sin t=0,\ x(0)=0,\ x'(t)=1,$$
I try to guess $$x_p(t)=A\sin t +B\cos t,$$ but the book gives me the solution $$x_p(t)=t\cos t$$ from the guess $$x_p(t)=t(A\sin t+B\cos t).$$
Why am I wrong?

Going by the method of undetermined coefficients, start off by finding a general solution to the problem : 
$$x''(t) + x(t) = 0$$
Assume a solution will be proportional to $e^{λt}$ and by substituting in, calculate $\lambda$ :
$$λ^2e^{λt} + e^{λt}=0 \Rightarrow e^{λt}(λ^2+1)=0 \Rightarrow λ = \pm \space i$$
The roots of $\lambda$ give the following as solutions : 
$$x_1(t) =c_1e^{it}, \space x_2(t) = c_2e^{-it}$$
$$x_p(t) = x_1(t) + x_2(t)$$
By applying Euler's identity and redefining the constants to a more compact form, you get : 
$$x_c(t) = c_1\cos t + c_2\sin t$$
Now, the particular solution to the initial IVP is of the form :
$$x_p(t) = t(a_1\cos t + a_2\sin t)$$
Now, from the expression :
$$x''_p(t) + x_p(t) = -2\sin t$$
you can compute the values of $a_1,a_2$, by equating the coefficient of the sine and cosine terms.
Finally, you should yield that : 
$$x_p(t) = t\cos t$$
So, the solution to the IVP, is : 
$$\begin{cases} x(t) = c_1\cos t + c_2 \sin t + t\cos t \\ x(0)=0 \\ x'(0) = 1 \end{cases}$$
Solving this system, should yield you the final special solution of : $x(t) = t\cos t$.
