How to solve this second order differential equation? I have an equation:
$$\frac {d^2u}{dx^2}=-u$$
I know in hindsight that the solution is 
$$u(x)=a\cdot cos(x)+b\cdot sin(x)$$
because the second derivative of that equals its negation. 
However, I only know that this must be the solution in hindsight, after someone else told me. 
So my question is: How would one go about deriving this solution, if one has no idea yet that the solution looks like a sum of cosines and sines?
 A: To solve:
$$\frac{\text{d}^2u(x)}{\text{d}x^2}=-u(x)\Longleftrightarrow u''(x)=-u(x)$$
Use Laplace transform:
$$\mathcal{L}_x\left[u''(x)\right]_{(\text{s})}=-\mathcal{L}_x\left[u(x)\right]_{(\text{s})}$$
Use:


*

*$$\mathcal{L}_x\left[u''(x)\right]_{(\text{s})}=\text{s}^2\text{U}(\text{s})-\text{s}u(0)-u'(0)$$

*$$\mathcal{L}_x\left[u(x)\right]_{(\text{s})}=\text{U}(\text{s})$$


So, we get:
$$\text{s}^2\text{U}(\text{s})-\text{s}u(0)-u'(0)=-\text{U}(\text{s})$$
Solving for $\text{U}(\text{s})$:
$$\text{U}(\text{s})=\frac{\text{s}u(0)+u'(0)}{1+\text{s}^2}$$
Now, with inverse Laplace transform we find:
$$u(x)=u(0)\cos(x)+u'(0)\sin(x)$$

HINT, for solving it another way:
$$u''(x)=-u(x)\Longleftrightarrow\int u'(x)u''(x)\space\text{d}x=\int-u'(x)u(x)\space\text{d}x$$
Now, use:


*

*Substitute $s=u'(x)$ and $\text{d}s=u''(x)\space\text{d}x$:
$$\int u'(x)u''(x)\space\text{d}x=\int s\space\text{d}s=\frac{s^2}{2}+\text{C}=\frac{u'(x)^2}{2}+\text{C}$$

*Substitute $p=u(x)$ and $\text{d}p=u'(x)\space\text{d}x$:
$$\int -u'(x)u(x)\space\text{d}x=-\int p\space\text{d}p=\text{C}-\frac{p^2}{2}=\text{C}-\frac{u(x)^2}{2}$$


So, we get:
$$\frac{u'(x)^2}{2}=\text{C}-\frac{u(x)^2}{2}\Longleftrightarrow\int\frac{u'(x)}{\sqrt{\text{C}-u(x)^2}}\space\text{d}=\pm\int1\space\text{d}x$$
A: One way to proceed is to simply guess that $u(x)$ is somewhat of the form $e^x$, since you know the second order derivative gives the negative of the original function, and any derivative of the exponential is itself
Next consider the complex exponential:
If you play around a little, you will see that $u(x)=ae^{ix}$ is a solution too, for any real $a$.
Use Euler's formula and you will get a solution in terms of sine and cosine. 
A: To solve such a second order differential equation, you can somewhat "guess" in advance (make an educated guess).  For instance, in the following differential equation:
$$2u''(x) - u'(x) - u(x) = 0$$
$u(x) = e^{x}$ is clearly one solution.  But you want to find all of the solutions, so you suppose that, in general, a solution is of the form:
$$u(x)=Ae^{rx}$$
You can then differentiate it twice...
$$u'(x) = Are^{rx}$$
$$u''(x) = Ar^2e^{rx}$$
And plug it into your equation...
$$Ar^2e^{rx} + Ae^{rx} = 0$$
$$r^2 + 1 = 0$$
This reduces the problem to solving a quadratic equation, from which you can find the roots $(r_1,r_2)$.  In this case, the roots are imaginary:
$$r_1 = i$$
$$r_2 = -i$$
So your general solution is simply a linear combination of two solutions as follows:
$$u(x) = c_1e^{ix} + c_2e^{-ix}$$
From here on out, use Euler's equation to reduce the above equation to a linear combination of trig functions, like you had speculated.
