Solving second order ODE I want to find the particular solution to
$$y''-2y'-y=\sin(3x)$$
by calculating $\Im(z)$ where 
$$z''-2z'-z=e^{3ix}$$
for $z(x)=e^{3ix}u(x)$ where $u(x)$ is some complex function. But with $z(x)=e^{3ix}u(x)$ we get:
$$z'(x) = e^{3ix}(u'(x)+3iu(x)) \\
z''(x) = e^{3ix}(u''(x)+6iu'(x)-9u(x))$$
And so
$$z''-2z-z=e^{3ix} \\
\Leftrightarrow
e^{3ix}(u''(x)+6iu'(x)-9u(x)) - 2e^{3ix} (u'(x)+3iu(x)) -e^{3ix}u(x)= e^{3ix} \\
\Leftrightarrow u''(x)+6iu'(x)-2u'(x)-10u(x)-6iu(x)=1$$
How can I solve this equation? Have I done something wrong?
 A: Rather than trying $z(x)=e^{3ix}u(x)$, try $z(x)=e^{3ix}U$, with a constant.
Then $z'(x)=3iz(x)$, $z''(x)=-9z(x)$ and $z''-2z-z=(-9+3i+1)z=\dfrac zU$, or 
$$z=\frac{e^{3ix}}{-8+3i}.$$
A: I think what's happened here is that the solution to the homogeneous equation
$$ y''-2y'-y=0 $$
is of the form
$$ e^{-x}(Ae^{\sqrt{2}x}+Be^{-\sqrt{2}x}) $$
(the auxiliary equation is $k^2-2k-1=0$, with solutions $k=1 \pm \sqrt{2}$), so you substitution has not actually simplified things: this component of the equation is still going to have complex coefficients.
On the other hand, solving an inhomogeneous equation with a constant on the right is quite easy: it's just a constant scaled to agree with the coefficient of the constant term on the left.
A: can i try to find a particular solution to $y''-2y' - y = \sin 3x$ in the form $$  y = a \cos 3x + b \sin 3x, y' = -3a\sin 3x + 3b \cos 3x, y''=-9a\cos 3x - 9b \sin 3x.$$  subbing all these in, we get $$-9a\cos 3x - 9b \sin 3x-2(-3a\sin 3x + 3b \cos 3x)-(a\cos 3x + b \sin 3x) = \sin 3x. $$ equating the coefficients we find 
$$-10a-6b=0, -10b+6a = 1 \to a = \frac 3{68}, b = - \frac 5{68}$$
so a particular solution is $$y = \frac 1{68}\left(3\cos 3x -5\sin 3x\right). $$ 
A: As this differential equation is non-homogenous(because it has a forcing function sin(3x) on the R.H.S,the solution to this differential equation is the sum of the complimentary function(for the unforced system) and the particular integral.
write the given ODE in symbolic form. That gives
(D^2 + D + 1)=0 (For complimentary function)
the solution is D= -0.5 +- 0.866j
C.F= e^(0.5x){C1cos(0.866x)+C2 sin(0.866x)......(1)
Now for the particular integral.
the forcing function is sin(3x) which is of the form sin(ax) with a=3
Now P.I= sin(3x)/(D^2 + D + 1)
put D^2= -(a^2)=-9
then, P.I.= sin(3x)/(D-8)
Multiply and divide by D+8(conjugate)
then, P.I= sin(3x)(D+8)/((D^2-64))
again put D^2=-9
P.I= sin(3x)(D+8)/-73
now as D is d/dt
P.I.= - {(3cos(3x)+8sin(3x)}/73........(2)
the total solution is (1) + (2)
