I am told to find a general solution for the following PDE (partial differential equation):
$\dfrac{\partial^2{u}}{\partial{x}^2} + \dfrac{\partial^2{u}}{\partial{y}^2} = 0, u(x, 0) = 0, u(x,2) = 0, u(0, y) = 0$, and $u(3, y) = \begin{cases} y, & 0 \le y \le 1 \\ 2 - y, & 1 \le y \le 2 \end{cases}$
I understand that this type of PDE is Laplace's equation, and I know how to go about solving Laplace's equation.
For the sake of clarity and completeness, I will type out my full solution to the problem. However, if you are only interested in the specific problem that I have encountered, please scroll to the bottom of my solution, where I have indicated in bold text the beginning of my problem.
My Solution
$\\$
Using the separation of variables method for solving PDEs, the solution will be of the form $u(x,t) = X(x)Y(y)$.
$\therefore X''Y + Y''X = 0$
$\therefore \dfrac{X''}{X} = \lambda = -\dfrac{-Y''}{Y}$
$\therefore X'' - \lambda X = 0$ and $Y'' + \lambda Y = 0$ are the two homogeneous differential equations that we are looking for (as part of the separation of variables procedure).
$\\$
We now first use the boundary condition for $Y$:
$u(x, 0) = 0, u(x, 2) = 0$
$u(x, 0) = X(x)Y(y)$
$= 0$
$\therefore Y(0) = 0$
$u(x, 2) = X(x)Y(2)$
$= 0$
$\therefore Y(2) = 0$
$\\$
We can now begin solving $Y'' + \lambda Y = 0$
$r^2 + \lambda = 0$ This is the auxiliary equation
$\implies r = \pm \sqrt{-\lambda}$
The three possibilities are $\lambda = 0, \lambda > 0,$ and $\lambda < 0$.
Skipping to $\lambda > 0$, we let $\lambda = \beta^2$ Since $\beta^2$ is always positive.
$r = \pm i \beta$ From the auxiliary equation
$\therefore Y(y) = A\cos(\beta y) + B \sin(\beta y)$
$Y(0) = A$
$= 0$
$Y(2) = B\sin(2\beta)$
$= 0$
$\therefore \beta = n \dfrac{\pi}{2} \forall n \in \mathbb{N}^+$.
$\therefore \beta^2 = n^2 \dfrac{\pi^2}{4} = \lambda_n$ is the corresponding eigenvalue of the eigenfunction $Y(y) = B \sin \left( n \dfrac{\pi}{2} y \right)$.
$\\$
We now find the solution for $X'' - \lambda X = 0$.
$X'' - \lambda X = 0$
$r^2 - \lambda = 0$ Auxiliary equation
$\implies r = \pm \sqrt{\lambda}$
We had that $\beta^2 = n^2 \dfrac{\pi^2}{4} = \lambda_n \forall n \in \mathbb{N}^+$.
$\therefore r = \pm \sqrt{n^2 \dfrac{\pi^2}{4}}$
$= \pm n \dfrac{\pi}{2}$
$\therefore X(x) = Ae^{n \dfrac{\pi}{2} x} + Be^{-n \dfrac{\pi}{2} x}$
$\\$
Therefore, the general solution to the PDE is
$u(x, t) = \sum_{n = 1}^{\infty} B \left( -e^{n \dfrac{\pi}{2} x} + e^{-n \dfrac{\pi}{2} x} \right) \sin \left( n \dfrac{\pi}{2} y \right)$
$\\$
!!!Here is where I'm having problems!!!
We can now fit the other boundary condition.
$u(3, y) = \begin{cases} y, & 0 \le y \le 1 \\ 2 - y, & 1 \le y \le 2 \end{cases}$
We found the general solution to the PDE to be
$u(x, t) = \sum_{n = 1}^{\infty} B \left( -e^{n \dfrac{\pi}{2} x} + e^{-n \dfrac{\pi}{2} x} \right) \sin \left( n \dfrac{\pi}{2} y \right)$
$\therefore u(3, y) = \sum_{n = 1}^{\infty} B \left( -e^{n \dfrac{3\pi}{2}} + e^{-n \dfrac{3\pi}{2}} \right) \sin \left( n \dfrac{\pi}{2} y \right)$
Note that this is a Fourier sine series, where the Fourier coefficient $b_n = B \left( -e^{n \dfrac{3\pi}{2}} + e^{-n \dfrac{3\pi}{2}} \right)$.
Our goal here is to find $b_n$. We can do this using the formula for the coefficient of a Fourier sine series:
$b_n = \dfrac{2}{P} \int_{x_0}^{x_0 + P} f(x) \sin \left( \dfrac{2 \pi n x}{P} \right) \ dx$,
where $P$ is the periodicity of the series.
Since our general solution for the PDE has the term $\sin \left( n \dfrac{\pi}{2} y \right)$, we must have $P = 4$, right?
However, the instructor has written
$B \left( -e^{n \dfrac{3\pi}{2}} + e^{-n \dfrac{3\pi}{2}} \right) = \int^1_0 y \sin \left( \dfrac{n\pi y}{2} \right) \ dy + \int_1^2 (2-y) \sin \left( \dfrac{n\pi y}{2} \right) \ dy$
The instructor's solution seems to maintain a period of $P = 4$ since it has $\sin \left( \dfrac{n\pi y}{2} \right)$.
Based on my understanding of Fourier series and how it applies to this situation, I am confused as to what is going on here. Recall the formula for the Fourier coefficient $b_n$ (as shown above). According to it, we should have
$B \left( -e^{n \dfrac{3\pi}{2}} + e^{-n \dfrac{3\pi}{2}} \right) = \int^{x_0 + 4}_{x_0} y \sin \left( \dfrac{n\pi y}{2} \right) \ dy + \int^{x_0 + 4}_{x_0} (2-y) \sin \left( \dfrac{n\pi y}{2} \right) \ dy$
But instead, the instructor has used the limits of the boundary condition as the limits of integration, whilst simultaneously using a period of $P = 4$ in $\sin \left( \dfrac{n\pi y}{2} \right)$ ? In other words, the instructor's solution has $P = 1$ in $x_0 + P$ for the limits of integration and $P = 4$ in $\sin \left( \dfrac{2 \pi n x}{P} \right)$.
I'm awfully confused as to the correct way to proceed here. There seems to be a contradiction between the formula for the Fourier coefficient $b_n$ and the instructor's solution.
I apologise for the long post. I would greatly appreciate it if people could please take the time to clarify my confusion and explain the correct way to proceed.
Before the "having problem zone" $u(x,y)$ is $$u(x,y) = \sum_{n=1}^{\infty} B_{n} \, \sinh\left(\frac{n \pi \, x}{2}\right) \, \sin\left(\frac{n \pi \, y}{2}\right).$$
Now let $$C_{n} = B_{n} \, \sinh\left(\frac{3 n \pi }{2}\right)$$ to obtain $$u(3,y) = f(y) = \sum_{n=1}^{\infty} C_{n} \sin\left(\frac{n \pi \, y}{2}\right)$$ which leads to the Fourier coefficients found by use of Paul's Online Math Notes, where, for $0 \leq y \leq L$, $$C_{n} = \frac{2}{L} \, \int_{0}^{L} f(y) \, \sin\left(\frac{n \pi y}{L}\right) \, dy,$$ and leads to, for this problem with $L=2$, $0 \leq y \leq 2$, $$C_{n} = \frac{2}{2} \, \int_{0}^{2} f(y) \, \sin\left(\frac{n \pi \, y}{2}\right) \, dy.$$ The evaluation then follows: \begin{align} C_{n} &= \int_{0}^{2} f(y) \, \sin\left(\frac{n \pi \, y}{2}\right) \, dy \\ &= \int_{0}^{1} y \, \sin\left(\frac{n \pi \, y}{2}\right) \, dy + \int_{1}^{2} (2 - y) \, \sin\left(\frac{n \pi \, y}{2}\right) \, dy \\ &= \frac{4}{n^{2} \pi^{2}} \, \left[ \sin\left(\frac{n \pi \, y}{2}\right) - \frac{n \pi}{2} \cos\left(\frac{n \pi \, y}{2}\right) \right]_{0}^{1} + \frac{4}{n^{2} \pi^{2}} \, \left[ - \sin\left(\frac{n \pi \, y}{2}\right) + \frac{ n \pi \, y}{2} \cos\left(\frac{n \pi \, y}{2}\right) - n \pi \cos\left(\frac{n \pi \, y}{2}\right) \right]_{1}^{2} \\ &= \frac{2}{n \pi} + \frac{8}{n^{2} \pi^{2}} \, \sin\left(\frac{n \pi}{2}\right) \end{align}
Put it all together to obtain $$u(x,y) = \frac{2}{\pi^{2}} \, \sum_{n=1}^{\infty} \frac{n \pi + 4 \, \sin\left(\frac{n \pi}{2}\right)}{n^{2} \, \sinh\left(\frac{3 n \pi}{2}\right)} \, \sinh\left(\frac{n \pi \, x}{2}\right) \, \sin\left(\frac{n \pi \, y}{2}\right).$$