Dirichlet problem in a rectangle with nonhomogeneous boundary conditions I need to solve the following problem:
\begin{cases}
\Delta u=0\;\; \textrm{for}\; x\in D,\\
u(x,0)=0, \\
u(x,l)=f(x), \\
u(0,y)=u(l,y)=0,
\end{cases}
where $D=[0,l]\times[0,l]$ and $f(x)$ is the odd extension of $x(l-x)$ in $[0,l]$.
First, I find de Fourier Sines Series of $f$, 
$$f(x)=\frac{8l^{2}}{\pi^{3}}\sum_{n=1}^{\infty}\frac{\sin[(2n-1)x]}{(2n-1)^{3}}$$
Using separation of variables, we got 
\begin{cases}
X''(x)+\lambda^{2}X(x)=0, \\
Y''(y)-\lambda^{2}Y(y)=0.
\end{cases}
The solutions for this ODE are
$$X(x)=c_{1}\cos(\lambda x)+c_{2}\sin(\lambda x);\;\;Y(y)=c_{3}e^{\lambda y}+c_{4}e^{-\lambda y}. $$
Since $u(0,y)=u(l,y)=0,$ the solution for the first equation is, for each $n\in\mathbb{N}$,
$$X_{n}(x)=\alpha_{n}\sin\left(\frac{n\pi x}{l}\right). $$
Since $u(x,0)=0$, $c_{3}=-c_{4}$, and, for each $n\in\mathbb{N}$,
$$Y_{n}(y)=\beta_{n}\left(e^{\frac{n\pi y}{l}}-e^{\frac{-n\pi y}{l}}\right) $$
Summing up in $n$, we have the solution for the Dirichlet problem:
$$u(x,y)=\sum_{n=1}^{\infty}a_{n}\sin\left(\frac{n\pi x}{l}\right)\left(e^{\frac{n\pi y}{l}}-e^{\frac{-n\pi y}{l}}\right), $$
where $a_{n}=\alpha_{n}\beta_{n}$
How can I apply the condition $u(x,l)=f(x)$? Because it implies that, for each $n\in\mathbb{N}$, 
$$a_{n}\sin\left(\frac{n\pi x}{l}\right)\left(e^{\frac{n\pi y}{l}}-e^{\frac{-n\pi y}{l}}\right)=\frac{-4l^{2}}{\pi^{3}}\frac{\sin[(2n-1)x]}{(2n-1)^{3}} $$
How could I solve this for $a_{n}$?
 A: One can write the Fourier series of $f(x)$ as 
$$f(x)=\frac{8l^{2}}{\pi^{3}}\sum_{\textrm{odd}\,n }\frac{\sin(nx)}{x^{3}}. $$
So, for each odd $n$, 
$$u_{n}(x,y)=\frac{8l^{2}}{n^{3}\pi^{3}}\sin\left(\frac{n\pi x}{l}\right)\Rightarrow a_{n}\sinh(n\pi)=\frac{8l^{2}}{n^{3}\pi^{3}}\sin\left(\frac{n\pi x}{l}\right)$$
$$\Rightarrow a_{n}=\frac{8l^{2}}{n^{3}\pi^{3}\sinh(n\pi)}\sin\left(\frac{n\pi x}{l}\right). $$
The solution is 
$$u(x,y)=\frac{8l^{2}}{\pi^{3}}\sum_{\textrm{odd}\,n}\frac{\sin\left(\frac{n\pi x}{l}\right)}{n^{3}\sinh(n\pi)}\sinh\left(\frac{n\pi y}{l}\right) $$
Note that the solution for $Y''(y)-\frac{n\pi}{l}Y(y)=0 $ is been written as $$Y(y)=c_{3}\sinh\left(\frac{n\pi y}{l}\right)+c_{4}\cosh\left(\frac{n\pi y}{l}\right). $$
That way, $u(x,0)=0\Rightarrow c_{4}=0$
A: You should get 
$$ u_{n}(x,y) = B_{n} \sinh(\frac{n\pi y}{L}) \sin(\frac{n\pi x}{L}) \tag{1}$$
$$ u_{n}(x,y) = \sum_{n=1}^{\infty} B_{n} \sinh(\frac{n\pi y}{L}) \sin(\frac{n\pi x}{L}) \tag{2}$$
then we have
$$ u(x,L)  = f(x) =\frac{8l^{2}}{\pi^{3}}\sum_{n=1}^{\infty}\frac{\sin[(2n-1)x]}{(2n-1)^{3}} = \sum_{n=1}^{\infty} B_{n} \sinh(\frac{n\pi L}{L}) \sin(\frac{n\pi x}{L}) \tag{3}$$
$$ u(x,L)  = f(x) = \frac{8l^{2}}{\pi^{3}}\sum_{n=1}^{\infty}\frac{\sin[(2n-1)x]}{(2n-1)^{3}} = \sum_{n=1}^{\infty} B_{n} \sinh(\frac{n\pi L}{L}) \sin(\frac{n\pi x}{L}) \tag{4}$$
$$ B_{n} = \frac{2}{L \sinh(n \pi)} \int_{0}^{L} \frac{8L^{2}}{\pi^{3}} \sum_{n=1}^{\infty}\frac{\sin[(2n-1)x]}{(2n-1)^{3}}  \sin(\frac{n\pi x}{L}) dx \tag{5}$$
A: So you have found the general solution that satisfies the homogeneous endpoint conditions to be
$$
    u(x,y)=\sum_{n=1}^{\infty}A_n\sin(n\pi x/l)\sinh(n\pi y/l)
$$
The remaining boundary condition at $y=l$ is
$$
          u(x,l)=f(x)
$$
which leads to
$$
      \sum_{n=1}^{\infty}A_n\sin(n\pi x/l)\sinh(n\pi)=f(x)
$$
The $A_n$ terms are determined by the Fourier $\sin$ expansion of $f$ as
$$ 
     f(x)=\sum_{n=1}^{\infty}B_n\sin(n\pi x/l)
$$
Can you take it from there?
