Is there another way of evaluating undetermined coefficients? $$y''+9y=\cos(3x)+\sin(3x)$$
Solving the homogeneous side of the equation gives: $C_1\sin(3x)+C_2\cos(3x)$, and for the non-homogeneous side I got:
$y=A\cos(3x)+B\sin(3x)$
$y'=-3A\sin(3x)+3B\cos(3x)$
$y''=-9A\cos(3x)-9B\sin(3x)$
Plugging in the given equation results in:
$9A\cos(3x)+9B\sin(3x)$
$-9A\cos(3x)-9B\sin(3x)$,
which will cancel. Is there an additional method for solving undetermined coefficients in special cases like this? 
 A: You could use the annihilator method, but the problem is that the forcing function $\cos(3x)+\sin(3x)$ is a solution of the complementary homogeneous equation 
\begin{equation}
y_c^{\prime\prime}+9y_c=0
\end{equation}
so you have not used the correct form of the particular solution $y_p$.
You must multiply by $x$ to get
\begin{equation}
y_p=Ax\cos(3x)+Bx\sin(3x)
\end{equation}
and then find $A$ and $B$ using the method you were using.
You will find that
The general solution to the homogeneous equation is
\begin{equation}
y_c=c_1\cos(3x)+c_2\sin(3x)
\end{equation}
Taking the first and second derivatives of $y_p$ gives a second derivative of 
\begin{equation}
y_p^{\prime\prime}=(6B-9Ax)\cos(3x)+(-6A-9Bx)\sin(3x)
\end{equation}
Therefore,
\begin{eqnarray}
y_p^{\prime\prime}+9y_p&=&6B\cos(3x)-6A\sin(3x)\\
&=&\cos(3x)+\sin(3x)
\end{eqnarray}
Therefore $A=-\frac{1}{6},\,B=\frac{1}{6}$
So
\begin{equation}
y_p=-\frac{1}{6}x\cos(3x)+\frac{1}{6}x\sin(3x)
\end{equation}
and the general solution $y=y_c+y_p$ is
\begin{equation}
y=\left(c_1-\frac{x}{6}\right)\cos(3x)+\left(c_2+\frac{x}{6}\right)\sin(3x)
\end{equation}
A: By using the Laplace transform and setting $g(s) = (\mathcal{L} y)(s)$ we have:
$$ (9+s^2) g(s) - s y(0)-y'(0) = \frac{3+s}{9+s^2}\tag{1} $$
hence:
$$ y(x) = \mathcal{L}^{-1}\left(\frac{3+s}{(9+s^2)^2}\right)(x)+\mathcal{L}^{-1}\left(\frac{A+Bs}{9+s^2}\right)(x)\tag{2} $$
or:
$$ y(x) = \frac{x}{6}\left(\sin(3x)-\cos(3x)\right)+ C\sin(3x)+D\cos(3x).\tag{3}$$
