# Solving a homogenous differential equation with two complex eigenvalues

A physical scenario in which a spring is hanging with a weight of mass $m$ on it yelds the following differential equation for the position $z(t)$: $$mz'' = mg - f(z - z_0)$$ In order to solve for $z$ we first need to solve the homogenous equation: $$mz'' + fz = 0$$

Assume $z(t) = e^{\lambda t}$: $$\lambda^2 m e^{\lambda t} + fe^{\lambda t} = 0$$ $$\lambda_{1,2} = \pm i\sqrt{\frac{f}{m}}$$ Having two eigenvalues, the general solution of the homogenous differential equation is a linear combination of the two: $$z_{hom}(t) = c_1e^{i\sqrt{\frac{f}{m}}t} + c_2e^{-i\sqrt{\frac{f}{m}}t}$$ We're in the context of physics and this is an oscillation, so we want to transform this result using trigonometric functions to make it more explicit. According to the solution supplied to me this is how it goes: $$z_{hom}(t) = c_1e^{i\sqrt{\frac{f}{m}}t} + c_2e^{-i\sqrt{\frac{f}{m}}t}$$ $$= c_1(\cos(\sqrt{\frac{f}{m}}t) + i\sin(\sqrt{\frac{f}{m}}t)) + c_2(\cos(\sqrt{\frac{f}{m}}t) - i\sin(\sqrt{\frac{f}{m}}t))$$ $$= (c_1+c_2)\cos(\sqrt{\frac{f}{m}}t) + (c_1-c_2)i\sin(\sqrt{\frac{f}{m}}t)$$ And here it gets funny: let $c_1+c_2 = A\cos(\phi)$ and $(c_1-c_2)i = A\sin(\phi)$: $$z_{hom}(t) = A\cos(\phi)\cos(\sqrt{\frac{f}{m}}t) + A\sin(\phi)\sin(\sqrt{\frac{f}{m}}t) = A\cos(\sqrt{\frac{f}{m}}t - \phi)$$ So, my question: why can we say that $c_1+c_2 = A\cos(\phi)$ and $(c_1-c_2)i = A\sin(\phi)$, with the same $A$ and $\phi$? It is awfully convenient, but how come $c_1$ and $c_2$ are related just this way? I'm guessing it has to do with the fact that the two eigenvalues $\lambda_{1,2}$ are complex conjugates, but exactly how escapes me. Any help would be appreciated!

• A note on formatting math functions: use \cos rather than cos when typing your formulas. – zipirovich Mar 22 '17 at 15:29

Generally speaking, $c_1$ and $c_2$ don't have to be conjugates. But if we want only real-valued solutions, then they have to be conjugates of each other. Look at the first term, for example: $c_1+c_2$ has to be a real number, because otherwise we'll end up with a not-purely-real multiple of cosine. For the same reason, in the second term $(c_1-c_2)i$ has to be real.
Now, let's say that $c_1=k_1+ik_2$ and $c_2=k_1-ik_2$ with real $k_1,k_2$; then $c_1+c_2=2k_1$ and $(c_1-c_2)i=2k_2$. So the solution is $z(t)=2k_1\cos(\#)+2k_2\sin(\#)$. Then there's a standard trick in trigonometry to convert such expressions into a single sine or cosine function, and that's what they did here. Here's how it goes.
Let's say we have an expression of the form $$B\cos\alpha+C\sin\alpha.$$ Let $A=\sqrt{B^2+C^2}$. Then $$B\cos\alpha+C\sin\alpha=A\left(\frac{B}{A}\cos\alpha+\frac{C}{A}\sin\alpha\right)=A\left(\frac{B}{\sqrt{B^2+C^2}}\cos\alpha+\frac{C}{\sqrt{B^2+C^2}}\sin\alpha\right).$$ Note that $$\left(\frac{B}{\sqrt{B^2+C^2}}\right)^2+\left(\frac{C}{\sqrt{B^2+C^2}}\right)^2=\frac{B^2}{B^2+C^2}+\frac{C^2}{B^2+C^2}=1,$$ satisfying the Pythagorean trigonometric identity, and so we can find an angle $\varphi$ such that $$\frac{B}{\sqrt{B^2+C^2}}=\cos\varphi \quad \text{and} \quad \frac{C}{\sqrt{B^2+C^2}}=\sin\varphi.$$ Then $$B\cos\alpha+C\sin\alpha=A\left(\frac{B}{\sqrt{B^2+C^2}}\cos\alpha+\frac{C}{\sqrt{B^2+C^2}}\sin\alpha\right)=A(\cos\varphi\cos\alpha+\sin\varphi\sin\alpha)=A\cos(\alpha-\varphi).$$