PDE with non-homogeneous boundary conditions How to solve PDE with non-homogeneous boundary conditions?
$$ 
\left\{\begin{matrix}
u_{xx}+u_{yy}=0 , \quad 0\leqslant x, y \leqslant 1 \\ 
u(x,0)=1+\sin \pi x\\ 
u(x,1)=2\\ 
u(0,y)=u(1,y)=1+y
\end{matrix}\right. 
$$ 
Thank you!
 A: Apply the method in http://maths.swan.ac.uk/staff/vl/pdes-course.pdf#page=38 , i.e. let $u(x,y)=v(x,y)+1+y$ ,
Then $u_x(x,y)=v_x(x,y)$
$u_{xx}(x,y)=v_{xx}(x,y)$
$u_y(x,y)=v_y(x,y)+1$
$u_{yy}(x,y)=v_{yy}(x,y)$
$\therefore v_{xx}(x,y)+v_{yy}(x,y)=0$
with $v(0,y)=v(1,y)=0$
Let $v(x,y)=\sum\limits_{n=1}^\infty C(n,y)\sin n\pi x$ so that it automatically satisfies $v(0,y)=v(1,y)=0$ ,
Then $-\sum\limits_{n=1}^\infty n^2\pi^2C(n,y)\sin n\pi x+\sum\limits_{n=1}^\infty C_{yy}(n,y)\sin n\pi x=0$
$\sum\limits_{n=1}^\infty(C_{yy}(n,y)-n^2\pi^2C(n,y))\sin n\pi x=0$
$\therefore C_{yy}(n,y)-n^2\pi^2C(n,y)=0$
$C(n,y)=C_1(n)\sinh n\pi y+C_2(n)\cosh n\pi y$
$\therefore u(x,y)=1+y+\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sinh n\pi y+\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x\cosh n\pi y$
$u(x,0)=1+\sin\pi x$ :
$1+\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x=1+\sin\pi x$
$\sum\limits_{n=1}^\infty C_2(n)\sin n\pi x=\sin\pi x$
$C_2(n)=\begin{cases}1&\text{when}~n=1\\0&\text{when}~n\neq1\end{cases}$
$\therefore u(x,y)=1+y+\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sinh n\pi y+\sin\pi x\cosh\pi y$
$u(x,1)=2$ :
$1+1+\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sinh n\pi+\sin\pi x\cosh\pi=2$
$\sum\limits_{n=1}^\infty C_1(n)\sin n\pi x\sinh n\pi=-\sin\pi x\cosh\pi$
$C_1(n)\sinh n\pi=\begin{cases}-\cosh\pi&\text{when}~n=1\\0&\text{when}~n\neq1\end{cases}$
$C_1(n)=\begin{cases}-\coth\pi&\text{when}~n=1\\0&\text{when}~n\neq1\end{cases}$
$\therefore u(x,y)=1+y-\coth\pi\sin\pi x\sinh\pi y+\sin\pi x\cosh\pi y$
Note that this solution suitable for $x,y\in\mathbb{C}$ , not only suitable for $0\leq x,y\leq1$ .
A: Note that $u_1(x,y) = 1 + y$ satisfies the PDE with three of the boundary conditions: $u_1(x,1) = 2$, $u_1(0,y) = u_1(1,y) = 1+y$.  However, $u_1(x,0) = 1$, not $1 + \sin(\pi x)$.   So if $u = u_1 + u_2$, we need $u_2$ to satisfy
$$ \eqalign{u_2(x,0) &= \sin(\pi x)\cr
            u_2(x,1) &= u_2(0,y) = u_2(1,y) = 0\cr}$$
Now try $u_2(x,y) = g(y) \sin(\pi x)$ for a suitable function $g$. 
