# Finding constants of a general solution to an ODE

I have derived the following solution to a given differential equation, regarding simple harmonic motion: $$x(t)=c_1 \cos\left(\sqrt{\frac{k}{m}}t\right)+c_2\sin\left(\sqrt{\frac{k}{m}}t\right).$$ I am trying to find the constants $c_1$ and $c_2$.

I have found $c_1$, by considering: $$x(0)=c_1 \cos\left(\sqrt{\frac{k}{m}}(0)\right)+c_2\sin\left(\sqrt{\frac{k}{m}}(0)\right).$$ which leads to $$x_0=c_1.$$ However, I am unsure as how to find the second one: I have attempted to find it but I am convinced that I am wrong: Considering: $$x'(0)=v(0)=-c_1\sqrt{\frac{k}{m}}\sin \left(\sqrt{\frac{k}{m}}(0)\right)+c_2\cos \left(\sqrt{\frac{k}{m}}(0)\right)\sqrt{\frac{k}{m}}$$ This would return a constant, $c_2$ of: $$v_0\sqrt{\frac{m}{k}}.$$ As I said, I am convinced this is wrong, if anyone could offer me some advice as to how to find the actual value, that'd be great. Thanks.

• I tried this, but then the constant becomes a function of n, hence is not a constant – George Mar 2 '18 at 10:20

$c_1=x_0$ and $c_2= v_0\sqrt{\frac{m}{k}}.$