General solution to $x''(t)=-kx(t)$ I've read in multiple places that $$C_1\sin(\sqrt{k}t)+C_2\cos(\sqrt{k}t)$$
is the general solution to the differential equation
$$\frac{d^2x}{dt^2}=-kx(t)$$

It's easy to see why all such functions constitute a solution, but how could one prove that any solution to the differential equation can be written as an instance of the general solution?
 A: To simplify notation, let $\omega = \sqrt{k}$.
Let $x$ be a solution of $x'' + \omega^2 x = 0$ and set :
$$y(t) = x(t) - x(0) \cos(\omega  t)  - \frac{x'(0)}{\omega}\sin(\omega t)$$
Then, $y'' + \omega^2 y = 0$ and $y(0) = y'(0) = 0$. We want to show that $y = 0$. Now, let :
$$z(t)= e^{-i\omega t}\left (\frac{y'}{i\omega} + y\right)$$
Then, we have :
\begin{align}
z'(t) &= -i\omega e^{-i\omega t}\left (\frac{y'}{i\omega} +y\right) + e^{-i\omega t}\left(\frac{y''}{i\omega}  +y'\right) \\
&=  e^{-i\omega t}\left (-y' - i\omega y\right) + e^{-i\omega t}(i\omega y + y') \\
&= 0
\end{align}
Therefore, $z$ is constant and $z(t) = z(0) = 0$ for all $t$. This means that for all $t$ :
$$y'(t) + i\omega y(t) = 0$$
Now, if we let $f(t) = e^{i\omega t}y(t)$, we see that :
$$f'(t) = e^{i\omega t} ( y'(t) + i\omega y(t)) = 0$$
so $f$ is constant equal to $0$ and we conclude $y(t) = e^{-i\omega t}f(t) = 0$.
Looking back to the beginning, we see that we have proved :
$$\forall t\in \mathbb R, x(t) = x(0)\cos(\omega t) + \frac{x'(0)}{\omega}\sin(\omega t)$$
A: Use the differential operator $D$, and its property, for any $b\in\mathbb{C}-\{0\}$ and $x\in C^2(\mathbb{R})$
$$D(e^{bt}x)=e^{bt}(D+b)x$$
and
$$(D-b)(D+b)(x)=(D^2-b^2)(x)$$
Now $D^2x=b^2x$ implies $e^{bt}(D-b)(D+b)(x)=D(e^{bt}(D-b))x=0$, hence $e^{bt}(D-b)x=c_1$ and similarly $e^{-bt}(D+b)x=c_2$ for some arbitrary constants $c_1,c_2\in\mathbb{C}$. Hence we have
$$2bx=(D+b)x-(D-b)x=c_2e^{bt}-c_1e^{-bt}$$
Hence the solutions of $(D^2-b^2)(x)$ are linear combinations of the functions $e^{bt}$ and $e^{-bt}$. Substituting $b^2=-k$, and from Euler identity we have $x$ is a linear combination of $\sin (\sqrt{k}t)$ and $\cos (\sqrt{k}t)$ if $k>0$ and $D^2x+kx=0$
