The solution of the following differential equation $$ -kx(t) = m \frac{d^{2}x}{dt^{2}}, $$ with $\omega = \sqrt{k/m}$, is $$ x(t) = C_{1}e^{-i\omega t} + C_{2}e^{i\omega t}.$$ The real part of this, $$ x(t) = x_0 e^{i(-\omega t + \phi)},$$ is the solution of my differential where $x_0$ is the amplitude of a harmonic oscillator and $\phi$ being a phase difference.

I have found another form of the general solution of this differential equation is $$ x(t) = C_1 \cos(\omega t) + C_2 \sin(\omega t).$$ With the following parameters $x_0 = \sqrt{C_{1}^{2} + C_{2}^{2}}$ , $\cos\phi = C_1/x_0$ and $\sin\phi=-C_2/x_0$ you can write $$x(t) = x_0\cos(\omega t + \phi),$$ which is equivalent of the $\Re\{x_0e^{i(-\omega t + \phi)}\}$. But I don't understand how the general solution of the differential equation can be written in these two ways.

  • $\begingroup$ If your doubt concerns the equivalence between the two formulations, I would suggest to start from the latter $x_0 \cos{(\omega t + \phi)}$ and expand using the trigonometric identities (cosine of the sum). If your problem concerns the solution of the differential equation, I can write a more elaborate answer below. Let me know! $\endgroup$
    – Matteo
    Feb 9, 2023 at 0:55
  • $\begingroup$ I am more curious about the different solutions of the differential equations but I guess I can see why they're equivalent but still unsure. Thank you an answer on this would be appreciated! $\endgroup$ Feb 9, 2023 at 1:15

1 Answer 1


You should not be using the same symbols $C_1$ and $C_2$ in the two solutions…

Write $$ x(t)=D_1 e^{-i \omega t}+D_2 e^{i\omega t} \tag{1} $$ and expand using Euler’s formula: $e^{i\omega t}=\cos(\omega t)+i\sin(\omega t)$. Eq.(1) then takes the form $$ x(t)=(D_1+D_2)\cos(\omega t) + i (D_1-D_2)\sin(\omega t) \tag{2} $$ so you can now declare $C_1=D_1+D_2$ and $C_2=i (D_1-D_2)$.

Note that here we must switch the physics on: obviously the position is real so $D_1+D_2$ must be real whereas $D_1-D_2$ must be pure imaginary.

This constrains the choices of $D_1$ to $D_2$. This is fine because the solution of Eq.(1) should depend on 2 real parameters, whereas it would depend on 4 real parameters if $D_1$ and $D_2$ were arbitrary complex numbers. In other words, $D_1$ and $D_2$ must be such hat $D_1=D_2^*$ so that then $C_1$ is related to the real part of $D_1$ and $C_2$ to the complex part of $D_1$.

You now start with Eq.(2) as $$ x(t)=C_1\cos(\omega t)+C_2\sin(\omega t) $$ and then continue with $C=\sqrt{C_1^2+C_2^2}$, $C_1=C\cos\varphi$ and $C_2=C\sin\varphi$, which immediately gives $$ x(t)=C \cos(\omega t+\varphi) $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.