Solving a PDE with non-homogenous boundary conditions To give some background if you don't want to read every step in the solution, essentially I want to find the Fourier coefficients to solve the PDE. However, one of the coefficients don't vanish when I plug in my second boundary condition, something I'm not familiar with from before. If you want, you can go down and read what I mean if you are not interested in seeing my steps along the way. I'll present them anyway.
I'm currently trying to solve this pde (two-dimensional):
$$ \Delta u = y$$
for $(x,y) \in [0,2] \times [0,1]$ with boundary conditions $u(x,0) = u(x,1) = 0$ and $u(0,y) = y-y^3$ and $u(2,y) = 0$.
Since we have an inhomogenous pde, we will try to find a steady state at first. Let's choose this to be only dependent in $y$, $S(y)$. We want it to satisfy the PDE and the boundary conditions, so $S(0) = S(1) = 0$. Therefore
$$S''(y) = y \Rightarrow S(y) = 1/6(y^3-y)$$
for our given boundary conditions. We now seek a solution on the form $u(x,y) = n(x,y) + S(x,y)$ where $n$ solves the PDE:
$$ \Delta n = 0$$
and with the same boundary conditions in $y$, since they don't change from our steady-state solution. However, now we have that:
$$n(0,y) = y-y^3 - S(y) = 1/6(7y-5^3)$$
$$n(2,y) = -S(y) = -1/6(y^3-y)$$
By separating the variables for $n = X(x)Y(y)$ in the PDE we get:
$$X''/X = -Y''/Y = \mu$$
Solving for $Y$ first gives us the ODE: $Y'' + \mu Y = 0$ which for nonzero $\mu$ has a solution on the form $Y(y) := a \cos(\sqrt{\mu}y)  + b \sin(\sqrt{\mu}y)$. With our boundary conditions on $Y(0) = Y(1) = 0$, we have that $Y_n(y) = \sin(\pi n y)$ where $\sqrt{\mu_n} := \pi n$ satisfies the ODE in Y.
Solving the ODE in $X$ gives us:
$$X'' -\pi^2 n^2 X= 0$$
where $X(x) = a_n \cosh(\pi n x) + b_n \sinh(\pi n x)$, therefore the solution for $n$ can be written as a superposition:
$$n(x,y) := \sum_{n\geq 1} (a_n \cosh(\pi n x) + b_n \sinh(\pi n x)) \sin(\pi n y) $$
To find the coefficients $a_n$, use our boundary conditions. Namely:
$$n(0,y) =  \sum_{n\geq 1}a_n \sin(\pi n y) = 1/6(7y-5y^3)$$
so simply
$$ a_n := \frac{\langle 1/6(7y-5y^3), \sin(\pi n y) \rangle}{ || \sin(\pi n y)||^2} = \frac {2(15+\pi^2n^2)(-1)^{n-1}}{3\pi^2n^2}$$
But now I have a problem calculating $b_n$ since if we use the second boundary condition in $x$, namely $n(2,y) =  \sum_{n\geq 1} (a_n \cosh(2\pi n) + b_n \sinh(2\pi n)) \sin(\pi n y) = 1/6(y-y^3)$, the $a_n$ terms don't vanish.
Usually when I do this procedure for solving a PDE, the $a_n$ terms vanish so it becomes easier to calculate $b_n$. Now, this isn't the case, and I'm not familiar on how to move on from here. If you have any ideas, please share them. I tried moving the sum for $a_n$ to the right of the equation to isolate $b_n$ and use the hermitian scalar product as before, however, it just becomes a big mess where I have to calculate an infinite sum that I'm not familiar with.
Thanks in advance!
 A: Everything you did is correct. But I would like to rewrite the problem and point out the boundary conditions.
$$
\begin{align*}
\Delta n & = 0 \\
n(x, \ 0) & = 0 \\
n(x, \ 1) & = 0 \\
n(0, \ y) & = \color{red}{\dfrac{7y\left(1-y^2\right)}{6}} \\
n(2, \ y) & = \dfrac{y(1-y^2)}{6} \\
\end{align*}
$$
Doing separation of variables:
$$\begin{align*}n(x, \ y) & = X(x) \cdot Y(y) \\ X(x) & = \sum_{j=1}^{\infty} a_{j} \cdot \cosh \left(j \pi x\right) + b_{j} \cdot \sinh \left(j \pi x\right)\\ Y(y) & = \sum_{j=1}^{\infty} \sin \left(j\pi y\right) \end{align*}$$
Applying the boundary conditions:

*

*For $x = 0$:

$$n(0, \ y) = \sum_{j=1}^{\infty} \left( a_{j} \cdot \underbrace{\cosh \left(j \pi \cdot 0\right)}_{1} + b_{j} \cdot \underbrace{\sinh \left(j \pi \cdot 0\right)}_{0} \right)  \sin \left(j\pi y\right) = \dfrac{7y(1-y^2)}{6} \label{1}\tag{1}$$

*

*For $x = 2$:

$$n(2, \ y) = \sum_{j=1}^{\infty} \underbrace{\left( a_{j} \cdot \cosh \left(2j \pi\right) + b_{j} \cdot \sinh \left(2j \pi\right) \right)}_{c_j}  \sin \left(j\pi y\right) = \dfrac{y(1-y^2)}{6} \label{2}\tag{2}$$
From \eqref{1} you can find $a_j$:
$$a_j = \left\langle \dfrac{7y(1-y^2)}{6}, \ \sin \left(j\pi y\right)\right\rangle\tag{3}\label{3}$$
From \eqref{2} you can find $c_{j}$:
$$c_j = \left\langle \dfrac{y(1-y^2)}{6}, \ \sin \left(j\pi y\right)\right\rangle\tag{4}\label{4}$$
With \eqref{3} and \eqref{4} you can find $b_j$:
$$b_{j} = \dfrac{c_j - a_{j} \cosh \left(2j\pi\right)}{\sinh \left(2j\pi\right)}$$
With the notation $\langle f, \ g\rangle$ is the inner product of two functions:
$$\langle f(y), \ g(y) \rangle = \int_{-1}^{1} f(y) \cdot g(y) \ dy $$
$$\left\langle \sin \left(i\pi y\right), \sin \left(j\pi y\right) \right\rangle = \delta_{ij} = \begin{cases}1 \ \ \ \text{if} \ i = j \\ 0 \ \ \ \text{else}\end{cases}$$
