Solve the following second-order differential equation: $\ddot{x} + \dot{x} = 5t\cos(t) + 4\sin(t)$ I am trying to solve the following second-order differential equation: 
$$\ddot{x} + \dot{x} = 5t\cos(t) + 4\sin(t).  (*)$$
I know that if the equation had instead been:
$$\ddot{x} + \dot{x} = 5t[\cos(t) + 4\sin(t)],$$
then I could have tried a solution of the form:
$$x(t) = P_1(t)\cos(t) + P_2(t)\sin(t),$$
where $P_1(t), P_2(t)$ were linear polynomials.
In fact, I initially tried such a solution for $(*)$, but did not obtain a correct answer.
How could I go about solving $(*)$, please?
 A: is it not easier to solve the first order equation $$\dot y + y = 5t\cos t + 4\sin t, y = \dot x.\tag 1$$
try a particular solution of the from $$y = a\cos t + b \sin t + ct\sin t,\\
\dot y = -a \sin t + b \cos t+c\sin t +ct\cos t\tag 2$$
subbing $(2)$ in (1), you get $$ct\cos t +(a+b)\cos t +(-a+b)\sin t = 5t\cos t+4\sin t $$ equating the coefficients give,
$$c = 5, b=2, a= -2. $$ therefore $$y =\dot x =-2\cos t+ 2 \sin t+5t\sin t$$ integrating once gives you $$x = -2\sin t - 2 \cos t+ 5\int_0^tt\sin t\, dt= -2\sin t - 2 \cos t -5t\cos t +5\int_0^t \cos t\, dt\\
=-2\sin t - 2 \cos t -5t\cos t + 5\sin t = 3\sin t - 2\cos t-5t\cos t 
$$
so a particular solution is $$x = 3\sin t - 2\cos t-5t\cos t. $$
A: Let's substitute $x'=y$ and solve
$$y'+y=5t\cos{t}+4\sin{t}$$
The homogeneous equation has got a general solution of the form $y(t)=Ce^{-t}$.
Let's look for a solution of the equation above of the form $y(t)=C(t)e^{-t}$. substituting we get
$$C'(t)e^{-t}=5t\cos{t}+4\sin{t}$$
So
$$\begin{align} C(t)&=\int e^{t}\left(5t\cos{t}+4\sin{t}\right)dt\\
&=\frac{e^t}{2}\left((5t-1)\sin{t}+(5t-4)\cos{t}\right)+K
\end{align}$$
Whence
$$y(t)=\frac{1}{2}\left((5t-1)\sin{t}+(5t-4)\cos{t}\right)+Ke^{-t}$$
And
$$x(t)=(5t+1)\sin{t}-(5t-6)\cos{t}+Me^{-t}+L$$
Where $M$ and $L$ are constants
A: We can solve this using undetermined coefficients. The complementary solution is found by solving
\begin{equation*}
x''+x'=0.
\end{equation*}
Substituting $x=e^{\lambda t}$ and factoring out $e^{\lambda t}$ gives
\begin{equation*}
(\lambda^2+\lambda)e^{\lambda t}=0.
\end{equation*}
The zeros must come form the polynomial giving $\lambda =-1$ or $0$. The general solution is given by
\begin{equation*}
x=x_1+x_2=\frac{c_1}{e^t}+c_2.
\end{equation*}
The particular solution is of the form 
\begin{equation*}
x_p=a_1\cos(t)+a_2t\cos(t)+a_3\sin(t)+a_4t\sin(t).
\end{equation*}
Compute $x'_p$ and $x''_p$ and substitute into the differential equations. To determine $a_1,a_2,a_3,a_4$, equate the coefficients. 
