Given
$u''(x) + \lambda u(x) = 0, u'(0) = u'(\frac{\pi}{2}) = 0$,
I wish to compute the eigenvalues and corresponding eigenfunctions.
If $\lambda = 0$,
$u''(x) = 0 \implies u'(x) = A \implies u(x) = Ax + B$.
If $\lambda < 0$,
using the characteristic equation $r^2 + \lambda = 0$,
$r^2 + \lambda = 0 \implies r = \pm\sqrt{-\lambda}$.
Then
$u(x) = Ae^{\sqrt{-\lambda}x} + Be^{-\sqrt{-\lambda}x}$
$u'(x) = \sqrt{-\lambda}Ae^{\sqrt{-\lambda}x} + (-\sqrt{-\lambda})Be^{-\sqrt{-\lambda}x}$
$u'(0) = \sqrt{-\lambda}A + (-\sqrt{-\lambda})B = 0 \implies A - B = 0$
$u'(\frac{\pi}{2}) = \sqrt{-\lambda}Ae^{\sqrt{-\lambda}\frac{\pi}{2}} + (-\sqrt{-\lambda})Be^{-\sqrt{-\lambda}\frac{\pi}{2}} = 0 \implies A = B = 0$.
Therefore $u(x) = 0$ and thus there are no negative eigenvalues.
If $\lambda > 0$,
$r^2 + \lambda = 0 \implies r = \pm\sqrt{-\lambda} \implies \pm\sqrt{\lambda}i$.
Then
$u(x) = A\cos(\sqrt{\lambda}x) + B\sin(\sqrt{\lambda}x)$
$u'(x) = -A\sqrt{\lambda}\sin(\sqrt{\lambda}x) + B\sqrt{\lambda}\cos(\sqrt{\lambda}x)$
$u'(0) = B\sqrt{\lambda} = 0 \implies B = 0$
$u'(\frac{\pi}{2}) = -A\sqrt{\lambda}\sin(\sqrt{\lambda}\frac{\pi}{2}) + B\sqrt{\lambda}\cos(\sqrt{\lambda}\frac{\pi}{2}) = 0 \implies -A\sqrt{\lambda}\sin(\sqrt{\lambda}\frac{\pi}{2}) = 0$.
Then
$\frac{\sqrt{\lambda}\pi}{2} = n\pi \implies \sqrt{\lambda} = 2n \implies \lambda = 4n^2$
where $n = 1,2,3,\cdots$.
Therefore $u_n(x) = A_n\cos(2nx)$.
I think I am missing something with the $\lambda = 0$ case. The solution I was provided
states that $u_0(x) = 1$ is the corresponding eigenfunction for $\lambda = 0$ and the
first 2 smallest eigenvalues are $0$ and $4$. When $n = 1$, we have $\lambda = 4$
so I can see where $4$ comes from but am I allowed to let $n = 0$?
I thought $u_n(x) = A_n\cos(2nx)$ applied strictly for $\lambda > 0$.
Thank you very much for reading.
Any help would be greatly appreciated.