Why do we assume that the solutions to the differential equation y''=-ky are sines and cosines? Why do we assume that the solutions to the second order differential equation of the form
$$y''=-ky$$
are sines and cosines? Just by inspection it seems pretty obvious that this is the case given that the only difference between $y$ and its second derivative is a negative constant. However, is there a formal way to show that sines and cosines are well-suited solutions to the differential equation?
 A: Normally, when you have an equation with constant coefficients, you assume that $e^{rx}$ is a solution because $e^{rx}$ has the amazing property that its derivative is $re^{rx}$ which then helps you obtain a polynomial, which is called the characteristic polynomial. In other words, suppose that your equation is:
$$a_ny^{(n)}+a_{n-1}y^{(n-1)}+\cdots+a_1y'+a_0y=g(x)$$
You will first try to solve it for the homogeneous case which is easier, i.e. the RHS is $0$. 
Now, suppose that $e^{rx}$ is a solution. You will get:
$$(a_nr^{n}+a_{n-1}r^{n-1}+\cdots+a_1r+a_0)e^{rx}=0$$
Since $e^{rx}$ never vanishes, the polynomial must vanish.
The roots of this polynomial, called the characteristic polynomial, if happen to be distinct, will give you independently linear functions. If a root had a multiplicity more than $n>1$, you take the functions like $e^{rx},xe^{rx},\cdots,x^{n-1}e^{rx}$ to obtain $n$ linearly independent functions.
We do all this because the solutions of a homogeneous ODE with constant coefficients is a vector space, in the sense that if $f(x)$ and $g(x)$ are two solutions, then $\alpha f(x) + \beta g(x)$ is also a solution for any $\alpha,\beta \in \mathbb{R}$. Therefore, as a vector space, if we can find enough linearly independent solutions to the homogeneous ODE, we will be able to describe the space of solutions using the linearly independent solutions. 
Most importantly, $\sin(x)$ and $\cos(x)$ are in fact exponential functions in disguise, linked by Euler's formula $$e^{irt}=\cos(rt)+i\sin(rt)$$ and this is why they appear in the process of solving differential equations very often.
A: Of course this is only true for $k>0$. Given that $k>0$, say $k=a^2$. Say $\alpha=y(0)$ and $\beta=y'(0)/a$, and define $$z(t) = y(t) - (\alpha\cos(at)+\beta\sin(at)).$$
Then it's easy to see that $$z''=-kz,\quad z(0)=z'(0)=0.$$
Here's the trick: The chain rule shows that $$(kz^2+(z')^2)'=2kzz'+2z'z''
=2z'(kz+z'')=0.$$So $z^2+(z')^2$ is constant; since $z(0)=z'(0)=0$ this shows that $$kz(t)^2+z'(t)^2=0$$for all $t$. And now since $kz^2\ge0$ and $(z')^2\ge0$ it follows that $kz^2=0=(z')^2.$ In particular $z(t)=0$, so $$y(t)=\alpha\cos(at)+\beta\sin(at).$$
Fun Exercise 1. Find the derivation of the differential equation describing the motion of weight suspended on a spring in a differential equations book, and contemplate how the proof above is inspired by conservation of energy.
Fun Exercise 2. Note that we've proved this:


If $y''+y=0$ and $y(0)=y'(0)=0$ then $y=0$.


Use this to prove the addition formulas for the sine and cosine.
Hint: Instead of  writing the addition formula for the sine as $\sin(\alpha+\beta)=\dots$, write it in the form $$\sin(\alpha+t)-(\dots)=0.$$
A: The formal way is the theorem of existence and uniqueness of the solution.
NOTE
To solve without sin and cosine you can also plug in $y=e^{st}$
A: As you've observed, you can guess that $\sin$ and $\cos$ work, and then invoke a theorem that says that once you've found two independent solutions the full set of solutions is the set of linear combinations.
If you didn't guess that but knew a little theory you would know that the solutions to a differential equation like this can be built from the complex roots of the quadratic equation $z^2 +1 = 0$, so they are $y = e^{ix}$ and $y=e^{-ix}$. Then use Euler's formula and combine them to find the trigonometric functions.
