# Simple Harmonic Oscillator Solution

In Physics, the Simple Harmonic Oscillator is represented by the equation $d^2x/dt^2=-\omega^2x$ .

By using the characteristic polynomial, you get solutions of the form $x(t)=Ae^{i\omega t} + Be^{-i\omega t}$. I get that you use Euler's formula $e^{i\theta}=cos\theta + isin\theta$, but I can't seem to find my way all the way to the 'traditional form' of $Dcos\omega t + Csin\omega t$.

I'm stuck here: $A(cos\omega t + isin\omega t) + B(cos\omega t - isin\omega t)$. What am I missing in taking it all the way? It doesn't seem valid to me (not sure why or why not) to make $C = iA - iB$.

-

When your write $x(t) = A e^{i \omega t} + B e^{-i \omega t}$, $A$ and $B$ in this expression are complex numbers.

However, if you assume the function $x(t)$ is real, then they are related as $\bar{A} = B$.

This can be seen since $\bar{x(t)} = x(t)$ which gives us $\bar{A} = B$ (since $e^{i \omega t}$ and $e^{- i \omega t}$ are orthonormal)

Rewriting the complex exponentials as sine and cosine we get

$x(t) = A (\cos(\omega t) + i \sin(\omega t)) + B (\cos(\omega t) - i \sin(\omega t)) = (A+B)\cos(\omega t) + i (A-B) \sin(\omega t)$

Now as proved before $\bar{A} = B$ and hence $(A+B)$ is real and $(A-B)$ is imaginary and hence we can write $(A+B) = C$ and $i (A-B) = D$ where $C,D$ are real numbers.

And the solution becomes $$x(t) = C \cos(\omega t) + D \sin(\omega t)$$ where $C,D \in \mathbb{R}$

-
Great explanation! I really appreciate the thorough answer you gave. I definitely wasn't seeing that $i(A-B)=D$ was in fact a real number under the assumption that $x(t)$ is real. –  tau-neutrino Jan 19 '11 at 17:47

Remember that $x(t) = A e^{i\omega t} + B e^{-i\omega t}$ is a solution for any values of $A$ and $B$ which means that choosing $A = B = 1/2$ results in the solution $$x_1(t) = e^{i\omega t} + e^{-i \omega t}.$$ Euler's fomula, along with the properties $\cos(-\omega t) = \cos(\omega t)$ and $\sin(-\omega t) = - \sin(\omega t)$, simplifies this solution to $$x_1 = \cos(\omega t).$$ Similarly, choosing $A = 1/(2i)$ and $B = -1/(2i)$ gives the solution $x_2(t) = \sin(\omega t)$.

Finally, by linearity you can conclude that the linear combination $C x_1 + D x_2$ is also a solution.

-
the answers given are absolutely fine as they show the way from $e^{\pm \mathrm{i} \omega t}$ to $\sin$ and $\cos$.
It might be even shorter if you use that $$\sin(x) \equiv \frac{1}{2\mathrm{i}}\left( e^{\mathrm{i}x} - e^{-\mathrm{i}x} \right)$$ and $$\cos(x) \equiv \frac{1}{2}\left( e^{\mathrm{i}x} + e^{-\mathrm{i}x} \right)\, .$$