# Laplace Equation with non-const Dirichlet Boundary Conditions

I'm struggling to get a Laplace problem with inhomogeneous boundary conditions solved. My memories are very rusty, and it almost works out, but I've got my brain twisted in some way. So I'm kindly requesting to check my reasoning for flaws.

\begin{align} u_{xx} + u_{yy} &= 0 \quad x,y \in \Omega = [0,1] \times [0,1],\\ u &= e^x \sin(y) \quad \text{on} \ \Gamma = \partial \Omega. \end{align}

The following function solves the problem (quite obviously): \begin{align} u(x,y) = e^x \sin(y). \end{align}

But I'd like to know how to derive that with a strategy similar to this question. For exercising not so obvious examples.

1. I'm separating the variables using $u(x,y) = X(x) Y(y)$ and trying to to incorporate the b.c.: \begin{align} X'' - \lambda^2 X &= 0\\ X(x=0) &= \sin(y)\\ X(x=1) &= e \sin(y) \end{align} and \begin{align} Y'' + \lambda^2 Y &= 0\\ Y(y=0) &= 0\\ Y(y=1) &= e^x \sin(1) \end{align}
2. General solution for $Y$ is: \begin{align} Y(y) = c_1 \cos(\lambda y) + c_2 \sin(\lambda y) \end{align} BC1 yields: $c_1 = 0$, and BC2: \begin{align} c_2 \sin(\lambda y) = e^x \sin(1) \end{align} which gives me $c_2 = e^x$ and $\lambda = 1+ n \pi$ with some integer $n$. Thus \begin{align} Y(y) = e^x \sin((1+n\pi) y) \end{align}

3. Next for $X(x)$: General solution is \begin{align} X(x) = c_1 e^{\lambda x} + c_2 e^{-\lambda x} \end{align}
Again, using the b.c., I get two equations \begin{align} c_1 + c_2 &= \sin(y) \quad \text{and}\\ c_1 e^\lambda + c_2 e^{-\lambda} &= e \sin(y) \end{align} substitution of $\sin(y)$:
\begin{align} c_1 e^{\lambda} + c_2 e^{-\lambda} = c_1 e^1 + c_2 e^1 \end{align}

Here's where I'm stuck: I need $\lambda = 1 \rightarrow n=0$ and $X(x) = 1$. Then I write $u(x,y) = X(x) Y(y)$:

4. Result \begin{align} u(x,y) = X(x) Y(y) = e^x \sin(y). \end{align}

I'm separating the variables using $u(x,y)=X(x)Y(y)$ and trying to to incorporate the b.c.: \begin{align} X'' - \lambda^2 X &= 0\\ X(x=0) &= \sin(y)\\ X(x=1) &= e \sin(y) \end{align}

Your solution is off the rails already here. $X$ is a function of $x$ only, that's the idea of separation of variables. Asking for $X(x=0)=\sin y$ makes no sense.

Also, you can't realistically hope to get the solution in the form $u(x,y)=X(x)Y(y)$, even though it happens to be true here. The form is $\sum_n X_n(x) Y_n(y)$.

You should read "Some remarks" at the end of the answer you are referring to. It explains why we need a pair of homogeneous boundary condition on opposite sides. To solve the boundary value problem in your case, one has to consider two sub-problems:

1. $u(0,y)=0$, $u(1,y)=0$, $u(x,0)=0$, $u(x,1)=e^x \sin 1$
2. $u(0,y)=\sin y$, $u(1,y)=e\sin y$, $u(x,0)=0$, $u(x,1)=0$

Find the solution of each, then add.

Also: this particular problem was probably meant to be solved just by recognizing the function $e^x\sin y$ as a solution of the Laplace equation. If you want to practice the method of separation of variables, stick to the problems specifically designed for this purpose. Picking a random problem is likely to result in unbearably boring computations with little insight gained.

• thanks for reviewing the calculation. If you are aware of any online resources for specifically designed examples, I'd thankful if you add them to your answer. – Sebastian Jul 9 '14 at 7:59