Your answer is right but i'm not sure what you are doing with the imaginary parts.

First hint, if you have an eqn of the form then observe that , so try a soln. y = sin(ax), then so in this casae you have or solve for to get .

Reverse signs and changing sin(ax) to cos(ax) will also give the soln. so you have a gen soln of type

.

Now we could do this your method as well, but ur method is cumbersome, and usually should be used for eqn of the form f(y'',y',y) = 0.

To see why we do that weird thing to get rid of the imaginary parts. If we solve the auxillary eqn to get and .

Since sin(-x) = -sin(x). Note that so since these two are linearly independent solutions, adding them together,

Now as i said above, if cos(a) solves a linear equation, then -sin(a) also solves it, (or vice versa). To show that and are linearly iandependent, i can take the wronskian determinant of them. (If you haven't heard of this, go to Wronskian - Wikipedia, the free encyclopedia) taking the determinant of this matrix, we get which does not equal 0 for any a. So these two are linearly independent and thus,

our general solution is of the form y = acos(a) - bsin(a).