the boundary value problem: $u''(x)+\lambda u(x)=0,x\in (0,1),$ $u(0)=u(1); u'(0)=u'(1).$ Find all possible $(\lambda,u)$ where $\lambda \in \mathbb R$ and $u\ne0$, to the boundary value problem:


$u''(x)+\lambda u(x)=0,x\in (0,1),$


$u(0)=u(1); u'(0)=u'(1).$
My Effort: for $\lambda>0,u(x)=A_n\cos\sqrt\lambda_nx+B_n\sin\sqrt\lambda_nx$, where$\lambda_n=4n\pi^2$(After Calculation), $n=\pm1,\pm2,....$
is it correct? Please verify.What will be the case if $\lambda<0$. I am confused. Please help.
 A: The boundary conditions for this type of problem can often be formulated as a matrix equation yielding a fairly general and automatic way to find the eigenvalues.  Here's how to do so for this problem.
First, as you notice, the general solution of the differential equation is
$$u(x)=a\cos(\sqrt\lambda x)+b\sin(\sqrt\lambda x)$$
so that
$$u'(x)=-a\sqrt{\lambda}\sin(\sqrt\lambda x)+b\sqrt{\lambda}\cos(\sqrt\lambda x).$$
From here, it's easy to write down the boundary conditions, namely
$$u(0)=u(1) \: \text{ iff } \: a=a\cos(\sqrt{\lambda})+b\sin(\sqrt{\lambda})$$
and
$$u'(0)=u'(1) \: \text{ iff } \: b\sqrt{\lambda}=-a\sqrt{\lambda}\sin(\sqrt{\lambda})+b\sqrt{\lambda}\cos(\sqrt{\lambda}).$$
It's easy to see that $\lambda=0$ yields the constant eigenfunction so, accounting for that, we divide off the $\sqrt{\lambda}$ from the second equation to obtain the pair
$$
\begin{align}
 a&=a\cos(\sqrt{\lambda})+b\sin(\sqrt{\lambda}) \\
 b&=-a\sin(\sqrt{\lambda})+b\cos(\sqrt{\lambda}).
\end{align}
$$
This can be written as the matrix equation
$$
\left(
  \begin{array}{cc}
    \cos(\sqrt{\lambda}) & \sin(\sqrt{\lambda}) \\
    -\sin(\sqrt{\lambda}) & \cos(\sqrt{\lambda})
  \end{array}
\right)
\left(
  \begin{array}{c}
    a \\ b
  \end{array}
\right)
=
\left(
  \begin{array}{c}
    a \\ b
  \end{array}
\right)
$$
or
$$
\left(
  \begin{array}{cc}
    \cos(\sqrt{\lambda})-1 & \sin(\sqrt{\lambda}) \\
    -\sin(\sqrt{\lambda}) & \cos(\sqrt{\lambda})-1
  \end{array}
\right)
\left(
  \begin{array}{c}
    a \\ b
  \end{array}
\right)
=
\left(
  \begin{array}{c}
    0 \\ 0
  \end{array}
\right).
$$
Now, the question is, for which values of $\lambda$ does the preceding matrix equation have a non-trivial solution?  The answer, of course, is when the determinant of the matrix is zero.  This yields a simple equation whose roots are exactly the eigenvalues you're looking for.  Computing the determinant and then simplifying, we get
$$\sin^2\left(\sqrt{\lambda }\right)+\cos^2\left(\sqrt{\lambda
   }\right)-2 \cos \left(\sqrt{\lambda }\right)+1 = 2-2 \cos \left(\sqrt{\lambda }\right).$$
This last expression equals zero precisely when $\sqrt{\lambda}=2n\pi$ for some $n\in\mathbb Z$.  The possible values of $\lambda$ are then $4n^2\pi^2$.
