# How to get from imaginary exponents of e to real sine and cosine?

I found this question which helped me with a concept I was struggling with on solving a second order differential equation where the characteristic polynomial resulted in a pair of imaginary roots:

solving second order non homogeneous differential equation

In the answer, the person wrote:

$$m^2 + 4 = 0$$ $$m^2 = -4 = 4i^2$$

$m_1= 2i$ and $m_2=-2i$

Thus $y_h=c_1\cos2x +c_2\sin2x$

The only part of the answer I don't understand is the jump from $m_1= 2i$ and $m_2=-2i$ to $y_h=c_1\cos2x +c_2\sin2x$ .

When I tried to work it out by hand, inserting $m_1$ and $m_2$ into the expected $ce^{mx}$ homogeneous solution, I got:

$$c_1e^{-2ix} + c_2e^{2ix}$$ $$c_1(\cos{(2x)} - i\sin{(2x)}) + c_2(\cos{(2x)} + i\sin{(2x)})$$ $$c_1\cos{(2x)} + c_2\cos{(2x)} + i\sin{(2x)}(c_2-c_1)$$

Though I can't figure out how to get rid of that imaginary part no matter what I do, so I can't get to the $y_h$ that the other person got in their solution.

So my question is:

How do I get from: $y_h = c_1\cos{(2x)} + c_2\cos{(2x)} + i\sin{(2x)}(c_2-c_1)$

to: $y_h=c_1\cos2x +c_2\sin2x$ ?

(Or am I just going about it the whole wrong way from the start?)

## 1 Answer

I can't figure out how to get rid of that imaginary part

You don't get rid of it. At least, not in general. The moment you put in real numbers as initial conditions, however, it will turn out that $c_1 + c_2$ is real and $c_2-c_1$ is purely imaginary, which makes the whole function real.

If you want, you can set $d_1 = c_1 + c_2$ and $d_2 = i(c_2-c_1)$ and your function will read $$d_1\cos(2x) + d_2\sin(2x)$$ However, a priori, $d_1$ and $d_2$ are still complex. You have to insert initial values to see that they are real for your specific case (and any other case with real initial values).