Potential equation in rectangle with boundary values 
I'm running into problem with the boundary conditions for u(x). I get u(x) = sin((npix)/a) based on u(0,y)=0, but that doesn't agree with du/dx(a,y)=0 unless the whole function u(x)=0. Is that the case? If so then wouldn't u(x,y)=0 since u(x)*u(y). 
Thanks for your help
 A: Use Fourier's separation of variables technique. Start with
$$
   \left(\frac{\partial^{2}}{\partial x^{2}}+\frac{\partial^{2}}{\partial y^{2}}\right)X(x)Y(y) = 0.
$$
The separated equations are
$$
                   X''(x)Y(y)+X(x)Y''(y) = 0,\\
               \frac{X''(x)}{X(x)} + \frac{Y''(y)}{Y(y)} = 0. \\
               -\frac{X''(x)}{X(x)} = K = \frac{Y''(y)}{Y(y)}
$$
The required conditions are
$$           X(0)=0,\;\;\; X'(a) = 0,\;\;\; Y(0)=0.
$$
There are solutions of the required type for $X$ if $K > 0$ because
$$
       X(x)=\sin(\sqrt{K}x)
$$
does satisfy $X(0)=0$, and can satisfy $X'(a)=0$ if $\cos(\sqrt{K}a)=0$, which forces $\sqrt{K}a=\frac{\pi}{2},\frac{3\pi}{2},\frac{5\pi}{2},\cdots$, or
$$
    K_{n}=  \left(\frac{(2n+1)\pi}{2a}\right)^{2} \mbox{ for } n=0,1,2,3,\cdots.
$$
There are no negative values of $K$ for which a valid $X$ exists because the derivative of a $\sinh$ function, which is $\cosh$, cannot vanish $x=a$. So the above are all of the acceptable separation parameters. Therefore, $Y_{n}(y)=\sinh(\sqrt{K_{n}}y)$. The final proposed solution is
$$
        U(x,y) = \sum_{n=1}^{\infty}A_{n}X_{n}(x)Y_{n}(y), \\
         X_{n}(x)=\sin(\sqrt{K_{n}}\,x),\;\;\;
         Y_{n}(y)=\sinh(\sqrt{K_{n}}\,y).
$$
The constants $A_{n}$ are determined by the requirement that
$$
       x = U(x,b) = \sum_{n=1}^{\infty}A_{n}Y_{n}(b)X_{n}(x).
$$
The endpoint conditions imposed on $X_{n}(x)$, which are $X_{n}(0)=X_{n}'(a)=0$, guarantee that
$$
           \int_{0}^{a}X_{n}(x)X_{m}(x)\,dx = 0,\;\;\; n \ne m.
$$
So the constants $A_{n}$ are determined from $x=\sum_{n=1}A_{n}Y_{n}(b)X_{n}(x)$ by multiplying both sides by $X_{n}$ and integrating over $[0,a]$ to obtain:
$$
         \int_{0}^{a}x X_{n}\,dx = A_{n}Y_{n}(b)\int_{0}^{a}X_{n}^{2}(x)\,dx,\\
              A_{n}=\frac{1}{Y_{n}(b)}\frac{\int_{0}^{a}x X_{n}(x)\,dx}{\int_{0}^{a}X_{n}^{2}(x)\,dx}
$$
All that remains is to find the values of these integrals. You can do the integration directly because the functions are elementary, but I'll show you how to use the equations and endpoint conditions for the $X_{n}$ instead:
$$
\begin{align}
    \int_{0}^{a}x X_{n}\,dx & = -\frac{1}{K_{n}}\int_{0}^{x}x X_{n}''\,dx \\
       & = -\frac{1}{K_{n}}\left[x X_{n}'(x)|_{x=0}^{a}-\int_{0}^{x}X_{n}'\,dx\right]\\
       & = \frac{1}{K_{n}}\int_{0}^{a}X_{n}'\,dx = \frac{X_{n}(a)}{K_{n}}.
\end{align} 
$$
And,
$$
\begin{align}
   \int_{0}^{a}(X_{n})^{2}\,dx & = -\frac{1}{K_{n}}\int_{0}^{a}X_{n}X_{n}''\,dx \\
    & = -\frac{1}{K_{n}}\left[X_{n}X_{n}'|_{0}^{a}-\int_{0}^{a}X_{n}'X_{n}'\,dx\right] \\
    & = \frac{1}{K_{n}}\int_{0}^{a}(X_{n}')^{2}\,dx
\end{align}
$$
Because $\sin^{2}(\theta)+\cos^{2}(\theta)=1$, and $X_{n}=\sin(\sqrt{K_{n}}\,x)$, then
$$
       X_{n}^{2}+\frac{1}{K_{n}}(X_{n}')^{2}=1.
$$
Combining these last two equations gives
$$
   \int_{0}^{a}X_{n}^{2}\,dx=\frac{1}{K_{n}}\int_{0}^{a}(X_{n}')^{2}\,dx = \frac{1}{2}\int_{0}^{a}1\,dx = \frac{a}{2}.
$$
Therefore,
$$
  U(x,y) = \sum_{n=1}^{\infty}\left[\frac{1}{Y_{n}(b)}\frac{X_{n}(a)}{K_{n}}\frac{2}{a}\right]X_{n}(x)Y_{n}(y)
$$
