# Partial differential equations/Laplace Equation

## Laplace Equation

The Laplace equation is a basic PDE that arises in the heat and diffusion equations. The Laplace equation is defined as:

${\displaystyle \nabla ^{2}u=0\Rightarrow {\frac {\partial ^{2}u}{\partial x^{2}}}+{\frac {\partial ^{2}u}{\partial y^{2}}}+{\frac {\partial ^{2}u}{\partial z^{2}}}=0~.}$

### Solution to Case with 1 Non-homogeneous Boundary Condition

In a condensed notation in ${\displaystyle (x,y,z)}$ rectangular coordinates, the Laplace equation in two dimensions reduces to:

${\displaystyle u_{xx}+u_{yy}=0,u(x,y)~.}$

The solution to the case with 1 non-homogeneous boundary condition is the most basic solution type. For the purposes of this example, we consider that the following boundary conditions hold true for this equation:

1. ${\displaystyle x=0:u(0,y)=f(y)}$
2. ${\displaystyle x=L:u(L,y)=0}$
3. ${\displaystyle y=0:u(x,0)=0}$
4. ${\displaystyle y=M:u(x,M)=0}$

#### Step 1: Separate Variables

To solve this equation, we assume that the function ${\displaystyle u(x,y)}$ is comprised of two functions ${\displaystyle \textstyle X(x)}$ and ${\displaystyle \textstyle Y(y)}$ such that ${\displaystyle \textstyle u(x,y)=X(x)Y(y)}$. Hence, ${\displaystyle u_{xx}=X''(x)Y(y)}$ and ${\displaystyle u_{yy}=X(x)Y''(y)~.}$ Making the substitutions into the Laplace equation, we get:

${\displaystyle X''Y+XY''=0}$

${\displaystyle \Rightarrow {\frac {X''}{X}}+{\frac {Y''}{Y}}=0}$

${\displaystyle \Rightarrow {\frac {X''}{X}}=-{\frac {Y''}{Y}}=\mu }$

The ${\displaystyle \mu }$ is called a separation constant because the solution to the equation must yield a constant. Because of the separation constant, it yields two linear ODEs:

1. ${\displaystyle X''-\mu X=0}$
2. ${\displaystyle Y''+\mu Y=0}$

#### Step 2: Translate Boundary Conditions

Translating the boundary conditions allows us to divide the boundary conditions among the variables. This division yields:

• ${\displaystyle u(0,y)=X(0)Y(y)=f(y)\quad \forall y\in \lbrack 0,M\rbrack }$
• ${\displaystyle u(L,y)=X(L)Y(y)=0\quad \forall y\in \lbrack 0,M\rbrack \Rightarrow X(L)=0}$
• ${\displaystyle u(x,0)=X(x)Y(0)=0\quad \forall x\in \lbrack 0,L\rbrack \Rightarrow Y(0)=0}$
• ${\displaystyle u(x,M)=X(x)Y(M)=0\quad \forall x\in \lbrack 0,L\rbrack \Rightarrow Y(M)=0}$

#### Step 3: Solve the Sturm-Liouville Problem

The last two boundary conditions are homogeneous boundary conditions for the function ${\displaystyle Y(y)}$. Using the solution to the Sturm-Liouville problems (SLP), we can easily get a function for ${\displaystyle Y(y)}$. The following is a fairly simple SLP:

${\displaystyle {\begin{cases}Y''+\mu Y=0\\Y(0)=0\\Y(M)=0\end{cases}}}$

The solution to the SLP yields the following information:

• ${\displaystyle \mu ={\frac {(n+1)^{2}\pi ^{2}}{M^{2}}},n=0,1,2,\cdots }$
• ${\displaystyle Y_{n}(y)=\sin {\frac {(n+1)\pi y}{M}},n=0,1,2,\cdots }$

The solution we obtained is a family of solutions dependent on the value for n.

#### Step 4: Solve Remaining ODE

The remaining ODE that we have doesn't have a SLP solution to it because we only know one boundary condition for it. We have to use what we obtained from the SLP solution to help us solve this ODE. We obtained the following information from steps 1 and 2:

${\displaystyle {\begin{cases}X''-\mu X=0\\X(L)=0\end{cases}}}$

From analyzing the second order ODE, we obtain the characteristic equation ${\displaystyle \textstyle m^{2}-\mu =0\Rightarrow m^{2}=\mu \Rightarrow m=\pm {\frac {(n+1)\pi }{M}},n=0,1,2,\cdots ~.}$ Out of the solution set that results from the exponentials, the only viable solution that arises is:

${\displaystyle X_{n}(x)=C_{1}\cosh {\frac {(n+1)\pi (x-L)}{M}}+C_{2}\sinh {\frac {(n+1)\pi (x-L)}{M}}~.}$

The substitution of (x-L) instead of x in the equation results only in a shift in the eigenspace, so it is valid and it helps us apply the boundary condition. Since ${\displaystyle X(L)=0,C_{1}=0}$. For convenience, we choose ${\displaystyle C_{2}=1~.}$ The resulting equation is:

${\displaystyle X_{n}(x)=\sinh {\frac {(n+1)\pi (x-L)}{M}},n=0,1,2,\cdots ~.}$

#### Step 5: Combine Solutions

We obtained equations for our separate variable functions and now we can substitute into our assumption in step 1. The substitution yields:

${\displaystyle u_{n}(x,y)=\sinh {\frac {(n+1)\pi (x-L)}{M}}\sin {\frac {(n+1)\pi y}{M}}}$

This function only satisfies the 3 homogeneous boundary conditions, however. To solve for the solution to the non-homogeneous boundary condition, we must consider that the complete solution consists of the following infinite series of terms:

{\displaystyle {\begin{aligned}u(x,y)&:=\sum _{n=0}^{\infty }a_{n}u_{n}(x,y)\\&=\sum _{n=0}^{\infty }a_{n}\sinh {\frac {(n+1)\pi (x-L)}{M}}\sin {\frac {(n+1)\pi y}{M}}\end{aligned}}}

At the non-homogeneous boundary condition:

${\displaystyle f(y)=u(0,y)=\sum _{n=0}^{\infty }\underbrace {a_{n}\sinh {\frac {(n+1)\pi (0-L)}{M}}} _{A_{n}}\sin {\frac {(n+1)\pi y}{M}}}$

This is an orthogonal expansion of ${\displaystyle f}$ relative to the orthogonal basis of the sine function. The term ${\displaystyle A_{n}}$ is a Fourier coefficient which is defined as the inner product:

${\displaystyle A_{n}={\frac {\int \limits _{0}^{M}f(y)\sin({\frac {(n+1)\pi y}{M}})dy}{\int \limits _{0}^{M}\sin ^{2}{\frac {(n+1)\pi y}{M}}}}={\frac {2}{M}}\int \limits _{0}^{M}f(y)\sin({\frac {(n+1)\pi y}{M}})dy,n=0,1,2,\cdots }$

Thus, the coefficient of the infinite series solution ${\displaystyle a_{n}}$ is:

${\displaystyle a_{n}=-{\frac {2}{M\sinh {\frac {(n+1)\pi L}{M}}}}\int \limits _{0}^{M}f(y)\sin \left({\frac {(n+1)\pi y}{M}}\right)dy,n=0,1,2,\cdots ~.}$

So, the entire general solution to the Laplace equation is:

${\displaystyle u(x,y)=\sum _{n=0}^{\infty }\left[-{\frac {2}{M\sinh {\frac {(n+1)\pi L}{M}}}}\int \limits _{0}^{M}f(y)\sin \left({\frac {(n+1)\pi y}{M}}\right)dy\right]\sinh {\frac {(n+1)\pi (x-L)}{M}}\sin {\frac {(n+1)\pi y}{M}}~.}$

This is the general solution for the specific set of boundary conditions we assumed at the beginning. Other boundary conditions will yield a different solution. You can see the solution graphically by entering in a partial sum (e.g. n starts at 0 and ends at 10) into a numerical solver like Mathematica or Maple.

### Solution to Case with 4 Non-homogeneous Boundary Conditions

Because ${\displaystyle \nabla ^{2}}$ is a linear operator, any solutions to the equation ${\displaystyle \nabla ^{2}u=0}$ can be added together and the result will also be a solution to the equation. This is the superposition principle.

Because of superposition, we can solve the case where all four boundary conditions are non-homogeneous. To illustrate how this will work, let's take the boundary conditions:

${\displaystyle {\begin{array}{lcl}u(x,0)&=&f_{1}(x)\\u(x,M)&=&f_{2}(x)\\u(0,y)&=&f_{3}(x)\\u(L,y)&=&f_{4}(x)\end{array}}}$

We divide this problem into 4 sub-problems, each one containing one of the non-homogeneous boundary conditions and each one subject to the Laplace equation condition, ${\displaystyle {\frac {\partial ^{2}}{\partial x^{2}}}(u_{n})+{\frac {\partial ^{2}}{\partial y^{2}}}(u_{n})=0~.}$ We get the following boundary conditions for the 4 sub-problems:

1. ${\displaystyle \left\{{\begin{array}{lcl}u_{1}(x,0)&=&f_{1}(x)\\u_{1}(x,M)&=&0\\u_{1}(0,y)&=&0\\u_{1}(L,y)&=&0\end{array}}\right.}$

2. ${\displaystyle \left\{{\begin{array}{lcl}u_{2}(x,0)&=&0\\u_{2}(x,M)&=&f_{2}(x)\\u_{2}(0,y)&=&0\\u_{2}(L,y)&=&0\end{array}}\right.}$

3. ${\displaystyle \left\{{\begin{array}{lcl}u_{3}(x,0)&=&0\\u_{3}(x,M)&=&0\\u_{3}(0,y)&=&f_{3}(x)\\u_{3}(L,y)&=&0\end{array}}\right.}$

4. ${\displaystyle \left\{{\begin{array}{lcl}u_{4}(x,0)&=&0\\u_{4}(x,M)&=&0\\u_{4}(0,y)&=&0\\u_{4}(L,y)&=&f_{4}(x)\end{array}}\right.}$

In this case, we used all Dirichlet type boundary conditions, meaning that the boundary condition depends on the function value (e.g. ${\displaystyle u(x,y)=f(x)}$ ). If you are using any combination of Dirichlet, Neumann (e.g. ${\displaystyle u_{x}(x,y)=f(x)~.}$ ), Robin (e.g. ${\displaystyle u(x,y)+u_{x}(x,y)=f(x)}$ ) types of boundary conditions, the types of the boundary conditions should be preserved in every sub-problem (e.g. if ${\displaystyle u_{x}(L,y)=f(x)}$, then the boundary condition is ${\displaystyle u_{x}(L,y)=0}$ when the boundary condition is made homogeneous and ${\displaystyle u_{x}(L,y)=f(x)}$ when it is the non-homogeneous boundary condition in a sub-problem).

Using the superposition principle, the complete solution to the 4 non-homogeneous boundary condition case is constructed by adding up all the solutions from the 4 sub-problems. In equation form, ${\displaystyle u(x,y)=u_{1}(x,y)+u_{2}(x,y)+u_{3}(x,y)+u_{4}(x,y)~.}$ Each sub-problem can be solved using the method for the case with 1 non-homogeneous boundary condition as shown above.