Solving the Diff. Eq: $y''+9y=36x\cos(3x)$ I'm stuck on this differential equation:
$$y''+9y=36x\cos(3x), \quad  \text{with }y(0)=-3, y'(0)=4$$
I know the homogenous equation is: $y_H(x)=A\cos(3x)+B\sin(3x)$
Now to find the particular solution...
I believe this next step is right.
$$Z_P(x)=A(x)e^{3ix}$$
Then we find the second derivative.
$$Z''_P(x)=A''(x)e^{3ix}+6iA''(x)e^{3ix}-9A(x)e^{3ix}$$
After plugging $Z_P$ and $Z''_P$ into the equation we arrive at $A''+6iA=36x$
Where do we go now?  I'm not sure what to do.
 A: I'm not sure what method you're using there. 
If you want to use variation of parameters, then we use an Ansatz of a linear combination of the two homogeneous solutions $\cos(3x)$ and $\sin(3x)$, $$y_p(x) = a(x)\cos(3x) + b(x)\sin(3x)$$ Then after some algebra and imposing the condition $a'(x)\cos(3x) + b'(x)\sin(3x) = 0$, we have expressions for $a$ and $b$,
$$a'(x) = - \frac{\cos(3x).36x\cos(3x)}{W}, \ \ \ b'(x) = -\frac{\sin(3x).36x\cos(3x)}{W}$$
where $W$ is the Wronksian of the two homogenous solutions $\cos 3x$ and $\sin 3x$, $$W = \cos(3x)(\sin(3x))' - \sin(3x)(\cos(3x))' = 3\cos^2(3x) + 3\sin^2(3x) = 3$$
Hence to find $a$ and $b$, integrate the expresssions for $a'$ and $b'$. Finally, construct the particular solution $y_p$.
A: The corresponding homogeneous equation is
$$y''+9y'=0\ ,$$
and its general real solution is
$$y_h(x)=C_1+C_2e^{-9x}, \qquad C_1, C_2\in{\mathbb R}\ .\tag{1}$$
The right side of the given inhomogeneous equation is obviously  not of the form $(1)$. Therefore the textbook "Ansatz" for a particular solution $x\mapsto y_p(x)$ is given by
$$y_p(x):=(ax+b) \cos(3x)+(cx+d)\sin(3x)\ .$$
Now plug this in into the given ODE and compare coefficients for $\cos x$, $x\cos x$, $\sin x$, $x\sin x$. Solve the resulting  system of linear equations for $a$, $b$, $c$, $d$.
The general solution of the given ODE is then given by
$$y(x):=y_h(x)+y_p(x)=C_1+C_2e^{-9x}+(ax+b) \cos(3x)+(cx+d)\sin(3x)\ ,$$
where $a$, $b$, $c$, $d$ have known numerical values. Finally determine $C_1$, $C_2$ using the initial conditions.
