In some physics problem I got next differential equation: x''=kx I know that simple harmonic oscillator problem are solved using complex numbers, but i don't know why solution is like: $x=A\cos\left(bt+d\right)$
I tried to solve this way.
$x''-kx=0$
$x=ae^{rt}$
$ar^2e^{rt}-kae^{rt}=0$
$r^2-k=0$
$$x=ae^{\pm\sqrt{k}t}$$
What did I do wrong?