Update
TO answer comment below, Here is the hand solution. The question was just misunderstanding on my part reading result of DSolve
, since $\lamda=0$ can not be an eigenvalue, but it also showed there in the solution to DSolve
, so I was asking why.
But DSolve
is allowed to return trivial solution $y(x)=0$ which is not allowed when finding the eigenvalues. Lesson of the day: Use DEigenvalues
to find eigenvalues instead of DSolve
.
NDEigenvalues[{-y''[x]+NeumannValue[-y[x],x==1]+NeumannValue[y[x],x==0]},y[x],{x,0,1},6]
L0=1;
tab1=Table[ n^2 Pi^2/L0,{n,{1,2,3,4,5}}]//N;
Join[{-1},tab1]
Hand solution
Assume the solution is $y=Ae^{rx}$, then the characteristic equation is
\begin{align*}
r^{2}+\lambda & =0\\
r & =\pm\sqrt{-\lambda}
\end{align*}
Assuming $\lambda<0$
In this case $-\lambda$ is positive and hence $\sqrt{-\lambda}$ is also
positive. Let $\sqrt{-\lambda}=\mu$ where $\mu>0$. Hence the roots are $\pm
\mu$. This gives the solution
$$
y=c_{1}\cosh\left( \mu x\right) +c_{2}\sinh\left( \mu x\right)
$$
Hence
$$
y^{\prime}=\mu c_{1}\sinh\left( \mu x\right) +\mu c_{2}\cosh\left( \mu
x\right)
$$
Left B.C. gives
\begin{equation}
0=c_{1}+\mu c_{2}\tag{1}
\end{equation}
Right B.C. gives
\begin{align*}
0 & =c_{1}\cosh\left( \mu L\right) +c_{2}\sinh\left( \mu L\right) +\mu
c_{1}\sinh\left( \mu L\right) +\mu c_{2}\cosh\left( \mu L\right) \\
& =\cosh\left( \mu L\right) \left( c_{1}+\mu c_{2}\right) +\sinh\left(
\mu L\right) \left( c_{2}+\mu c_{1}\right)
\end{align*}
Using (1) in the above, it simplifies to
$$
0=\sinh\left( \mu L\right) \left( c_{2}+\mu c_{1}\right)
$$
But from (1) again, we see that $c_{1}=-\mu c_{2}$ and the above becomes
\begin{align*}
0 & =\sinh\left( \mu L\right) \left( c_{2}-\mu\left( \mu c_{2}\right)
\right) \\
& =\sinh\left( \mu L\right) \left( c_{2}-\mu^{2}c_{2}\right) \\
& =c_{2}\sinh\left( \mu L\right) \left( 1-\mu^{2}\right)
\end{align*}
But $\sinh\left( \mu^{2}L\right) \neq0$ since $\mu^{2}L\neq0$ and so either
$c_{2}=0$ or $\left( 1-\mu^{2}\right) =0$. $c_{2}=0$ results in trivial
solution, therefore $\left( 1-\mu^{2}\right) =0$ or $\mu^{2}=1$ but $\mu
^{2}=-\lambda$, hence $\lambda=-1$ is the eigenvalue.
Corresponding eigenfunction is
$$
y=c_{1}\cosh\left( x\right) +c_{2}\sinh\left( x\right)
$$
Using (1) the above simplifies to
\begin{align*}
y & =-\mu c_{2}\cosh\left( x\right) +c_{2}\sinh\left( x\right) \\
& =c_{2}\left( -\mu\cosh\left( x\right) +\sinh\left( x\right) \right)
\end{align*}
But $\mu=\sqrt{-\lambda}=1$, hence the eigenfunction is
$$
\fbox{$y\left( x\right) =c_2\left( -\cosh\left( x\right) +\sinh\left(
x\right) \right) $}
$$
Assuming $\lambda=0$
Solution now is
$$
y=c_{1}x+c_{2}
$$
Therefore
$$
y^{\prime}=c_{1}
$$
Left B.C. $0=y\left( 0\right) +y^{\prime}\left( 0\right) $ gives
\begin{equation}
0=c_{2}+c_{1} \tag{2}
\end{equation}
Right B.C. $0=y\left( L\right) +y^{\prime}\left( L\right) $ gives
\begin{align*}
0 & =\left( c_{1}L+c_{2}\right) +c_{1}\\
0 & =c_{1}\left( 1+L\right) +c_{2}
\end{align*}
But from (2) $c_{1}=-c_{2}$ and the above becomes
\begin{align*}
0 & =-c_{2}\left( 1+L\right) +c_{2}\\
0 & =-c_{2}L
\end{align*}
Which means $c_{2}=0$ and therefore the trivial solution. Therefore
$\lambda=0$ is not an eigenvalue.
Assuming $\lambda>0$
Solution is
\begin{equation}
y=c_{1}\cos\left( \sqrt{\lambda}x\right) +c_{2}\sin\left( \sqrt{\lambda
}x\right) \tag{A}
\end{equation}
Hence
$$
y^{\prime}=-\sqrt{\lambda}c_{1}\sin\left( \sqrt{\lambda}x\right)
+\sqrt{\lambda}c_{2}\cos\left( \sqrt{\lambda}x\right)
$$
Left B.C. gives
\begin{equation}
0=c_{1}+\sqrt{\lambda}c_{2} \tag{3}
\end{equation}
Right B.C. gives
\begin{align*}
0 & =c_{1}\cos\left( \sqrt{\lambda}L\right) +c_{2}\sin\left(
\sqrt{\lambda}L\right) -\sqrt{\lambda}c_{1}\sin\left( \sqrt{\lambda
}L\right) +\sqrt{\lambda}c_{2}\cos\left( \sqrt{\lambda}L\right) \\
& =\cos\left( \sqrt{\lambda}L\right) \left( c_{1}+\sqrt{\lambda}
c_{2}\right) +\sin\left( \sqrt{\lambda}L\right) \left( c_{2}-\sqrt
{\lambda}c_{1}\right)
\end{align*}
Using (3) in the above, it simplifies to
$$
0=\sin\left( \sqrt{\lambda}L\right) \left( c_{2}-\sqrt{\lambda}
c_{1}\right)
$$
But from (3), we see that $c_{1}=-\sqrt{\lambda}c_{2}$. Therefore the above
becomes
\begin{align*}
0 & =\sin\left( \sqrt{\lambda}L\right) \left( c_{2}-\sqrt{\lambda}\left(
-\sqrt{\lambda}c_{2}\right) \right) \\
& =\sin\left( \sqrt{\lambda}L\right) \left( c_{2}+\lambda c_{2}\right) \\
& =c_{2}\sin\left( \sqrt{\lambda}L\right) \left( 1+\lambda\right)
\end{align*}
Only choice for non trivial solution is either $\left( 1+\lambda\right) =0$
or $\sin\left( \sqrt{\lambda}L\right) =0$. But $\left( 1+\lambda\right)
=0$ implies $\lambda=-1$ but we said that $\lambda>0$. Hence other choice is
\begin{align*}
\sin\left( \sqrt{\lambda}L\right) & =0\\
\sqrt{\lambda}L & =n\pi\qquad n=1,2,3,\cdots\\
\lambda_{n} & =\left( \frac{n\pi}{L}\right) ^{2}\qquad n=1,2,3,\cdots
\end{align*}
The above are the eigenvalues. The corresponding eigenfunction is from (A)
$$
y=c_{1_{n}}\cos\left( \sqrt{\lambda_{n}}x\right) +c_{2_{n}}\sin\left(
\sqrt{\lambda_{n}}x\right)
$$
But $c_{1_{n}}=-\sqrt{\lambda_{n}}c_{2_{n}}$ and the above becomes
\begin{align*}
y\left( x\right) & =-\sqrt{\lambda_{n}}c_{2_{n}}\cos\left( \sqrt
{\lambda_{n}}x\right) +c_{2}\sin\left( \sqrt{\lambda_{n}}x\right) \\
& =C_{n}\left( -\sqrt{\lambda_{n}}\cos\left( \sqrt{\lambda_{n}}x\right)
+\sin\left( \sqrt{\lambda_{n}}x\right) \right)
\end{align*}
\underline{Summary}
Eigenvalue $\lambda=-1$ with eigenfunction $y\left( x\right) =c_{2}\left(
-\cosh\left( x\right) +\sinh\left( x\right) \right) $ and eigenvalues
$\lambda_{n}=\left( \frac{n\pi}{L}\right) ^{2},n=1,2,3,\cdots$ with
eigenfunctions $C_{n}\left( -\sqrt{\lambda_{n}}\cos\left( \sqrt{\lambda_{n}
}x\right) +\sin\left( \sqrt{\lambda_{n}}x\right) \right) $. Listing the
eigenvalues in order:
$$
\lambda=\left\{ -1,\frac{\pi^{2}}{L^{2}},\frac{4\pi^{2}}{L^{2}},\frac
{9\pi^{2}}{L^{2}},\frac{16\pi^{2}}{L^{2}},\cdots\right\}
$$