In solving the differential equation $y''+9y=\sin 3x$, first of all find the general integral of the corresponding homogeneous equation. One easily finds the general solution $$ y=c_1\cos 3x+c_2\sin 3x. $$
Now, look for a particular solution $\psi$ of the equation. If I try with the form $$ \psi=a\cos 3x+b\sin 3x $$
with $a, b$ constants, this doesn't work beacuse the coefficient 9 in the equation screws it up. I understand that a better choice would be
$$ \psi=(A+Bx)\cos 3x+(C+Dx)\sin 3x $$
which allows to find that a particular solution is $\psi=-1/6x\cos3x$. My question is, why? How can I guess from the form of the equation that this should be the correct form of the particular solution?
Also, I should add that I am following Coddington's book on ODEs, but he does not exaplain the method of undetermined coefficients but only the more general variation of the constants method. Do you have some nice reference about the undetermined coefficients method?