I'm trying to solve a PDE problem, and got this S-L problem
$ \nabla^2 u_2(x,y)=0,\,\, x \in (-1, 1),\,\, y\in (0, \pi) \\ u_2(x,0) = \cos(0.5\pi x),\,\, x\in [-1,1] \\ u_2(x,\pi) = 2\sin(\pi x),\,\, x\in [-1,1] \\ u_2(-1, y)=u(1,y)=0,\,\, y\in [0, \pi] $
Now, in order to solve the first problem I used separation of variables, meaningly:
$ \\ u_2(x,y) = f(x)g(y) \\ f''(x)/f(x) = -g''(y)/g(y) = -\lambda ^2 \\ $
Solving for $f(x)$: $ \\ f(x) = A\cos(\lambda x)+B\sin(\lambda x) \\ f(-1) = f(1) = 0 $
How do I continue? I need to find the eigen-functions and eigen-values, but not sure. I think that I can maybe get 2 families of eigen-functions but not sure.
Thanks!
There is a quicker way of dealing with the boundary conditions rather than using them directly, which I will address later, but for now I will tackle the problem directly.
Application of the boundary conditions give us the conditions
$$ 0=f(-1)=A\cos(\lambda)-B\sin(\lambda) $$ $$ 0=f(1)=A\cos(\lambda)+B\sin(\lambda) $$
Adding these equations together and dividing by $2$ gives
$$ A\cos(\lambda)=0\implies A=0\text{ or }\lambda=\frac{\pi}{2}+n\pi $$
Similarly, if we had subtracted we would have
$$ B=0\text{ or }\lambda=n\pi $$
To ensure that we have satisfied both boundary conditions, we need to take one of the four combinations of possible consequences. There are two pairs that are nonsensical; if $A=B=0$ then we have the zero solution, and if $\lambda$ is constrained in two ways then this cannot be done. Thus, we have two possible conditions, either
$$ A=0\text{ and }\lambda=n\pi,n=1,2,3,... $$
or
$$ B=0\text{ and }\lambda=\frac{\pi}{2}+n\pi,n=0,1,2,3,... $$
The choices of $\lambda$ are totally of the form $n\pi$ for $n$ larger than zero or $\pi/2+n\pi$ for $n$ at least zero. Thus, reindexing,
$$ \lambda=\frac{n\pi}{2},n=1,2,3,... $$
which covers all cases. We can then index the solutions for $n$ as
$$ f_n(x)=\left\{\begin{array}{ccc} \cos\left(\frac{2n-1}{2}\pi x\right) & : & n\text{ odd} \\ \sin\left(\frac{2n}{2}\pi x\right) & : & n\text{ even} \end{array}\right. $$
Let's note a convenient property of these functions. If we add and subtract $(2n-1)\pi/2$ into our cosine term, we have
$$ \cos\left(\frac{2n-1}{2}\pi x-\frac{2n-1}{2}\pi+\frac{2n-1}{2}\pi\right)=(-1)^{n+1}\sin\left(\frac{2n-1}{2}\pi(x-1)\right) $$
Similarly for the sine terms if we add and subtract $2n\pi/2$ we have
$$ \sin\left(\frac{2n}{2}\pi x-\frac{2n}{2}\pi+\frac{2n}{2}\pi\right)=(-1)^n\sin\left(\frac{2n}{2}\pi(x-1)\right) $$
Since the coefficients in front are not yet relevant, we can ignore them and generalize this as
$$ f_n(x)=\sin\left(\frac{n\pi}{2}(x-1)\right) $$
ASIDE: Had we instead considered our domain as $x\in[0,2]$ instead of $[-1,1]$, these functions would have automatically popped up (where the $x-1$ would instead be $x$). This is why we had a better approach from the start; many times it is not helpful to have a domain in a strange region, but instead shift the domain to start at $0$.
The next problem is to consider the inhomogeneous boundary conditions. Our problem is that both boundaries an inhomogeneous, so we need to solve the problem twice and use superposition to stich them together. The general solution for $g_n$ is
$$ g_n(y)=Ae^{n\pi y/2}+Be^{-n\pi y/2} $$
Let's suppose that we start with the condition $u(x,\pi)=2\sin(\pi x)$; to solve this, we assume a boundary condition of $u(x,0)=0$, which imposes $g_n(0)=0$ and so $A=-B$. This gives
$$ g_n(y)=A\sinh\left(\frac{n\pi}{2}y\right) $$
The general solution for this partial solution is then
$$ u(x,y)=\sum_{n=1}^\infty A_n\sin\left(\frac{n\pi}{2}(x-1)\right)\sinh\left(\frac{n\pi}{2}y\right) $$
Using the boundary condition $u(x,\pi)=2\sin(\pi x)$,
$$ 2\sin(\pi x)=\sum_{n=1}^\infty A_n\sin\left(\frac{n\pi}{2}(x-1)\right)\sinh\left(\frac{n\pi^2}{2}\right) $$
We cleverly know that when $n=2$, the term $\sin(\pi(x-1))$ is equal to $-\sin(\pi x)$, so this uniquely matches our desired function. We then know $A_n=0$ for $n\neq 2$, and specifically,
$$ 2\sin(\pi x)=-A_2\sin(\pi x)\sinh\left(\pi^2\right)\implies A_2=-2\text{csch}\left(\pi^2\right) $$
We then have one boundary condition satisfied with
$$ u(x,y)=-2\text{csch}(\pi^2)\sin\left(\pi(x-1)\right)\sinh\left(\pi y\right) $$
We switch to the alternative condition, where $u(x,0)=\cos(\pi x/2)$ and $u(x,\pi)=0$. This enforces on $g_n$
$$ 0=g_n(\pi)=Ae^{n\pi^2/2}+Be^{-n\pi^2/2}\implies B=-Ae^{n\pi^2} $$
Rescaling the coefficients, we have
$$ g_n(y)=A\left[e^{-n\pi^2/2}e^{n\pi y/2}-e^{n\pi^2/2}e^{-n\pi y}\right] $$
and using hyperbolic identities,
$$ g_n(y)=A\sinh\left(\frac{n\pi}{2}(y-\pi)\right) $$
Our general solution is
$$ u(x,y)=\sum_{n=1}^\infty A_n\sin\left(\frac{n\pi}{2}(x-1)\right)\sinh\left(\frac{n\pi}{2}(y-\pi)\right) $$
Letting $y=\pi$ gives the boundary condition of
$$ \cos\left(\frac{\pi}{2}x\right)=\sum_{n=1}^\infty A_n\sin\left(\frac{n\pi}{2}(x-1)\right)\sinh\left(-\frac{n\pi^2}{2}\right) $$
Just as before, we can match the coefficient for $n=1$ and no others, so we have
$$\cos\left(\frac{\pi x}{2}\right)=A_1\sin\left(\frac{\pi}{2}(x-1)\right)\sinh\left(-\frac{\pi^2}{2}\right)\implies A_1=\text{csch}\left(\frac{\pi^2}{2}\right) $$
ALL TOGETHER we have a final answer of
$$ u(x,y)=-2\text{csch}(\pi^2)\sin\left(\pi(x-1)\right)\sinh\left(\pi y\right)+\text{csch}\left(\frac{\pi^2}{2}\right)\sin\left(\frac{\pi}{2}(x-1)\right)\sinh\left(\frac{\pi}{2}(y-\pi)\right) $$
From here you could clean up some of the terms to look a bit nicer, but otherwise we have our answer.