General solution for ordinary differential equation $y'' + 9y = 18x + 36 \sin 3x$ Find a (real) general solution for
$$y'' + 9y = 18x + 36 \sin 3x$$
I need some help in finding the solution, have been struggling for long. My answer does not match with the final answer which is:
$$y_h = A\cos 3x + B\sin 3x $$
$$y_p = 2x - 6x\cos 3x$$

Given:
$$\tag 1 y'' + 9y = 18x + 36 \sin 3x$$
Homogeneous
$$m^2 +9 = 0 \rightarrow m_1 = 3i, m_2 = -3i$$
So,
$$y_h = A \cos 3x + B \sin 3x$$
Particular
Since we have a $\sin 3x$ term in the homogeneous solution, we will choose a particular solution:


*

*$y_p = a x + b x \cos 3x + c x \sin 3x$

*$y'_p = a + b \cos 3x + 3 c \cos 3x + c \sin 3x -3b \sin 3x$

*$y''_p = 6 c \cos 3x - 9b x \cos 3x-6 b \sin 3x - 9c x \sin 3x$


Substituting into $(1)$ yields:
$\tag 2 y''_p + 9y_p = 9~a x - 6 b ~\sin 3x + 6 c ~\cos 3x  = 18 x + 36 \sin 3x$
Equating terms yields:
$$a = 2, b = -6, c = 0$$
Our final solution:
$$y(x)= y_h + y_p = A \cos 3x + B \sin 3x + 2x -6 x \cos 3x$$
