Boundary conditions which yield exactly one solution of the differential equation $u'' + u = 0$ Consider the ordinary differential equation: $u'' + u = 0$. Give an example of boundary conditions which yield exactly one solution $u$.

Progress
The equation of solutions is
$$A\cos x + B\sin x = 0$$
I solved it for where there are infinite solutions where the boundaries were $u(0) = 2$, $u(π) = −2$ so $A=2$, this means there are infinite solutions for $x$ but I don't understand how to find a unique solution.
 A: The solution to $$u'' + u = 0$$ is $$u(x) = A\sin(x) + B\cos(x).$$ There are many examples you could choose, for example $u(0) = 1$; $u(\frac{\pi}{2})=2$,  yields $$u(x) = 2\sin(x) + \cos(x).$$
Edit: the differential equation is solved for all $x$, but you may not have only one solution that satisfies the boundary condition. For example, if you were only given the boundary condition $u(0) = 1$, your general solution would be $$u(x) = A\sin(x) + \cos(x). $$ The solution is then not unique to the boundary conditions as a whole family of curves satisfy the boundary condition - e.g. take $A=1$ & $A=2$ 

You can see both curves satisfy the differential equation and at $x=0$, both are equal to $1$. 
For a unique solution, we can add a further boundary condition that gives a specific value of $A$ such as my example and then only one solution curve solves the differential equation subject to boundary conditions. My example is the curve in blue - you can see it also passes through $u=2$ at $x=\frac{\pi}{2}$.
A: Assume that we are considering this ODE on the interval $[0,L]$ with given  $L>0$. Dirichlet boundary conditions would then be
$$u(0)=u_0,\quad u(L)=u_L$$
with prescribed values $u_0$, $u_L$. We now try to solve
$$A\cos 0+B\sin 0=u_0,\qquad A\cos L+B\sin L=u_L$$
for $A$ and $B$. From the first equation we immediately get $A=u_0$, so that it remains to fulfill 
$$B\sin L=u_L-u_0\cos L\tag{1}$$
by a suitable choice of $B$. It is here that the famous dichotomy arises:
(a) If $\sin L\ne0$, i.e., if $L$ is not an integer multiple of $\pi$, then $(1)$ determines a unique value for $B$. It follows that the given boundary problem has a unique solution, irrespective of the prescribed values $u_0$, $u_L$.
(b) If $\sin L=0$, i.e., if $L$ is  an integer multiple of $\pi$, then the lefthand side of $(1)$ is $=0$ whatever the value of $B$. From this we draw the following conclusion: When the prescribed values $u_0$, $u_L$ are such that $$u_0-u_L\cos L=0\tag{2}$$ then the boundary problem has an infinity of solutions, and if $(2)$ is violated then there are no solutions.
Therefore the only way to obtain a boundary value problem with a unique solution is to choose $L$ such that $\sin L\ne0$, and then the boundary values can be prescribed arbitrarily.
