# Partial differential equation (PDE)

These kinds of DE occur in problems involving temperature distribution, vibrations and potentials. These problems are described by relatively simple linear second order PDEs. The procedures described below are used to reduce the problem into two or more linear DE.

We are going to work with function $u$, which as a function of two variables: either $x(x,y)$ or $u(x,t)$. Then the second order PDE which is discussed can be described as

$$A\frac{\partial^2 u}{\partial x^2} + B\frac{\partial^2 u}{\partial x \partial y} + C\frac{\partial^2 u}{\partial y^2} + D\frac{\partial u}{\partial x} + E\frac{\partial u}{\partial y} + F(u) = G,$$

where the coefficients $A,\ B,\ C,\ \dots ,\ G$ are functions of $x$ and $y$.

## Separation of variables

We have no ambitions to find the general solution of such DE. That would be too difficult and it is not so useful. We are looking for particular solutions in a form

$$u(x,y) = X(x)\cdot Y(y)$$

Then it is sometimes possible to reduce given linear PDE (in two variables) into two ODEs. Assuming that the solution is $u(x,y) = X(x)Y(y)$ we have to be able to differentiate $u(x,y)$ with respect to $x$, $y$ and so on:

$$\frac{\partial u}{x} = X'Y, \hskip2em \frac{\partial u}{y} = XY', \hskip2em \frac{\partial^2 u}{x^2} = X''Y, \hskip2em \frac{\partial^2 u}{y^2} = XY''.$$

The above statements come from product rule (one function is multiplied by another): let us have for example $u(x,y) = XY = (x^2) (y^3)$. Then $\partial u/\partial x = (2x)(y^3) + (x^2)(0) = 2xy^3 = X'Y$.

If we can separate $X$ to the left hand side of equation and $Y$ to the right side of equation, then: the left side depends on $x$ and what is on the right (in terms of $x$) is a constant. The right side depends on $y$ on what is on the left (in terms of $y$) is constant. So we have two ODE which are solved against a constant (which is often called separation constant $\lambda$). It is easily demonstrated on examples:

#### Example

Use the method separation of variables to find product solution of PDE

$$\frac{\partial u}{\partial x} + 3 \frac{\partial u}{\partial y} = 0$$

We are looking for a solution in the form $y(x,y) = X(x)\cdot Y(y)$. Let us use the solution within given PDE:

\begin{align} X'Y + 3XY' &= 0 \hskip2em / \cdot \frac{1}X \frac 1 Y \nonumber \\ X'\frac 1 X &= -3Y'\frac 1 Y \nonumber \end{align}

The left side is a constant from the point of view of the right side and conversely. We can solve two ODE

$$X'\frac 1 X = \lambda, \hskip2em -3Y'\frac 1 Y = \lambda,$$

where $\lambda$ is an arbitrary constant, $X$ is $X(x)$, $Y$ is $Y(y)$. Let us solve $X'\frac 1 X = \lambda$ first:

\begin{align} X'\frac 1 X &= \lambda \nonumber \\ X' - \lambda X &= 0 \nonumber \\ m - \lambda &= 0 \implies m = \lambda \nonumber \\ X(x) &= c_1e^{\lambda x} \nonumber \end{align}

Now let us solve $Y(y)$:

\begin{align} -3Y' \frac 1 Y &= \lambda \nonumber \\ -3Y' - \lambda Y &= 0 \nonumber \\ 3Y' + \lambda Y &= 0 \nonumber \\ 3m + \lambda &= 0 \implies m = -\frac \lambda 3 \nonumber \\ Y(y) &= c_2 e^{-\lambda/3 y} \nonumber \end{align}

Since we expected solution in the form $u(x,y) = X(x)Y(y)$:

$$u(x,y) = c_1e^{\lambda x} \cdot c_2 e^{-\lambda/3 y}= c_3 e^{\lambda(x-1/3y)}$$

The constant $\lambda$ was laid as an arbitrary constant also. But it would be weird to use $\lambda$, let us rather use $c_4$ instead:

$$\underline{\underline{u(x,y) = c_3 e^{c_4(3x-y)}}}$$

#### Example

Use the method separation of variables to find product solution of PDE $u_x = u_y + u$

We are looking for a solution in the form $y(x,y) = X(x)\cdot Y(y)$ of PDE

$$\frac{\partial u}{\partial x} = \frac{\partial u}{\partial y} + u$$

Let us use the solution $y(x,y) = X(x)\cdot Y(y)$ within given PDE:

\begin{align} X'Y &= Y'X + XY \hskip2em / \cdot \frac 1 X \frac 1 Y \nonumber \\ \frac 1 X X' &= \frac 1 Y Y' + 1 \nonumber \end{align}

As in the previous example, we have to separate variable $x$ from $y$. The consequence is we are solving two ODE $(\ref{ref:PDE_1})$ and $(\ref{ref:PDE_2})$ with arbitrary constant then $\lambda$ instead of PDE:

\begin{align} \frac 1 X X' &= \color{red}{\lambda} = \frac 1 Y Y' + 1 \nonumber \\ \frac 1 X X' &= \lambda \label{ref:PDE_1} \\ \frac 1 Y' + 1 &= \lambda \label{ref:PDE_2} \\ \end{align}

The first DE $\frac 1 X X' = \lambda$ has been solved in the previous example and its solution is $X(x) = c_1e^{\lambda x}$. The second one has solution

\begin{align} \frac 1 Y Y' + 1 &= \lambda \hskip2em / \cdot Y \nonumber \\ 1Y' + Y(1-\lambda) &= 0 \nonumber \\ m +(1-\lambda) &= 0 \implies m = \lambda - 1 \nonumber \\ Y(y) &= c_2e^{(\lambda - 1)y} \nonumber \end{align}

Then we collect the solution of two ODE into expected form

$$u(x,y) = X(x)Y(y) = c_1e^{\lambda x}\cdot c_2e^{(\lambda - 1)y} = c_3e^{\lambda x + \lambda y - y} = c_3e^{\lambda(x+y)-y}$$

Finally it is good idea to exchange $\lambda$ to some other symbol:

$$\underline{\underline{u(x,y) = c_3e^{c_4(x+y)-y}}}.$$

We might differentiate $u(x,y)$ to express $\partial u/\partial x$ and $\partial u/\partial y$ in order to substitute back into PDE. That will provide as a confidence that no mistake was made through calculations.

#### Example

Use the method separation of variables to find product solution of PDE

\begin{align} y\frac{\partial u}{\partial x} + x\frac{\partial u}{\partial y} = 0 \label{ref:PDE_3} \end{align}

We are looking for a solution $u(x,y) = X(x)Y(y)$. So we have to insert expected solution into DE:

\begin{align} yX'Y + xXY' &= 0 \hskip2em / \cdot \frac 1 {X'} \frac{1}{Y'} \nonumber \\ y \frac 1 {Y'}Y + xX\frac{1}{X'} &= 0 \nonumber \\ y \frac 1 {Y'}Y &= -xX\frac{1}{X'} \nonumber \\ \end{align}

The variables are separated. On the left is function of $x$ and whatever is now being left on the right side can be considered as constant. And conversely. So we can have two DE which are solved against arbitrary constant $\lambda$:

$$y\frac 1 {Y'}Y = \lambda$$

The above DE is ordinary differential equation and is solved here with changed notation (for convenience) from $Y(y)$ to $y(x)$.

\begin{align} x\frac{1}{y'}y &= \lambda \nonumber \\ xy &= \lambda y' \nonumber \\ y' \color{red}{- \frac 1 {\lambda}x}y &= 0 \nonumber \end{align}

The DE turned to be solvable as a linear DE with $P(x) = -1/\lambda\ x$. Such DE is solved by means of integrating factor $\mu(x) = e^{\int P(x)\ dx}$

$$\mu(x) = e^{-1/\lambda \int x\ dx} = e^{-\frac 1 {\lambda}\cdot \frac{x^2}{2}}$$

Whole DE is multiplied by the integrating factor and then we anticipate $d/dx\ \mu(x)y$ on the left hand side and such term is trivial to integrate:

\begin{align} \frac{d}{dx}\mu(x) y &= 0\nonumber \\ y'\cdot e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}} - \frac 1 {\lambda}xy \cdot e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}} &= 0\nonumber\\ \frac{d}{dx}e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}} \cdot y &= 0 \nonumber \\ e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}} \cdot y &= c_1 \nonumber \\ y(x) &= c_1e^{\frac{1}{\lambda}\cdot \frac{x^2}{2}} \nonumber \end{align}

Note: could be solved easily also by separating variables.

So we have $Y(y) = c_1e^{\frac{1}{\lambda}\cdot \frac{y^2}{2}}$. That implies that the second solution is $X(x) = c_2e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}}$. Then the solution $u(x,y)$ is

$$u(x,y) = X(x)\cdot Y(y) = c_1e^{\frac{1}{\lambda}\cdot \frac{y^2}{2}} \cdot c_2e^{-\frac{1}{\lambda}\cdot \frac{x^2}{2}}= c_3e^{\frac{1}{2\lambda}(y^2-x^2)} \nonumber$$

After exchanging $c_4$ for $-1/2\lambda$

$$\underline{\underline{u(x,y)= c_3e^{c_4(x^2-y^2)}}}$$

We might have a desire to check the solution for a correctness. In that case, let us compute ${\partial u}/{\partial x},\ {\partial u}/{\partial y}$ and check whether equality holds when substituted into given DE $(\ref{ref:PDE_3})$.

\begin{align} \frac{\partial u}{\partial x} &= c_3\cdot 2x\cdot c_4\cdot e^{c_4(x^2-y^2)} \nonumber \\ \frac{\partial u}{\partial y} &= c_3\cdot (-2y)\cdot c_4\cdot e^{c_4(x^2-y^2)} \nonumber \\ 0 &= y \cdot c_3\cdot 2x\cdot c_4\cdot e^{c_4(x^2-y^2)} + x\cdot c_3\cdot (-2y)\cdot c_4\cdot e^{c_4(x^2-y^2)} \nonumber\\ 0&=0 \nonumber \end{align}

The other way to check for correctness is to use numerical check by calculator. Let us choose randomly some numbers for arbitrary constants and for $x,\ y$ as well. Let us evaluate numericaly the slope from the solution. When all substituted into DE, the equality have to (roughly) hold.

\begin{align} &c_3 = 2,\ c_4 = 3,\ x= 1,\ y=2 \nonumber \\ &u(x=1, y=2) = 2.468196 \times 10^{-4} = u \nonumber \\ &u(x=1.001, y=2) = 2.483057 \times 10^{-4} = u_{\Delta x} \nonumber \\ &u(x=1, y=2.001) = 2.438747 \times 10^{-4} = u_{\Delta y} \nonumber \\ &\frac{\partial u}{\partial x} = \frac{\Delta u}{\Delta x} = \frac{u_{\Delta x} - u}{0.001} = 1.4861 \times 10^{-3} \nonumber \\ &\frac{\partial u}{\partial y} = \frac{\Delta u}{\Delta y} = \frac{u_{\Delta y} - u}{0.001} = -2.9449 \times 10^{-3} \nonumber \\ \end{align}

Now substitute prepared values into given DE $(\ref{ref:PDE_3})$:

$$2\cdot 1.4861\times 10^{-3} + 1 \cdot (-2.9449\times 10^{-3}) = 0.0273\times 10 ^{-3}$$

It can be considered that the equality holds. We did not expect that we are going to get exactly to zero.

#### Example

Use separation of variables to find solution of

$$k\frac{\partial^2u}{\partial x^2} - u = \frac{\partial u}{\partial t},\hskip2em k \gt 0.$$

We are interested into solution $u(x,y) = X(x)T(t)$:

\begin{align} k\cdot X''T - XT &= XT' \hskip2em /\cdot \frac 1 X \cdot \frac 1 T \nonumber \\ k\cdot X'' \frac 1 X -1 &= T'\frac 1 T \nonumber \\ kX''\frac{1}{X} &= 1 + T'\frac1 T \label{ref:PDE_4} \end{align}

The variables are separated. Now we can solve two ODE against separation constant $\lambda$.

The left hand side from $(\ref{ref:PDE_4})$ is solved against constant $\lambda$:

\begin{align} kX''\frac 1 X &= \lambda \nonumber \\ kX'' &= \lambda X \nonumber \\ kX''-\lambda X &= 0 \nonumber \end{align}

Now it depends on the configuration of the problem (on the value of $\lambda$) what the solution would be.

 $\boldsymbol{\lambda = 0:}$ \begin{align} kX'' - 0 &= 0 \nonumber \\ X'' &= 0 \nonumber \\ X(x) &= c_1x + c_2 \nonumber \end{align} $\boldsymbol{\lambda \gt 0\ (\lambda = \alpha^2k):}$ \begin{align} kX''-\alpha^2k = &0 \nonumber \\ X'' - \alpha^2 = &0 \implies \nonumber \\ \implies m = &\{\alpha, -\alpha\} \nonumber \\ X(x) = &c_3\sinh \alpha x + \nonumber \\ & + c_4 \cosh \alpha x \nonumber \\ \end{align} $\boldsymbol{\lambda \lt 0\ (\lambda = -\alpha^2k):}$ \begin{align} kX''+\alpha^2k =& 0 \nonumber \\ X''+\alpha^2 =& 0 \nonumber \implies \nonumber \\ \implies m &= \{i \alpha, -i\alpha\} \nonumber \\ X(x) =& c_5\sin \alpha x + \nonumber \\ & + c_6\cos \alpha x \nonumber \end{align}

Note: the above solution with $\sinh \alpha x,\ \cosh \alpha x$ is equivalent to $C_3e^{-\alpha x} + C_4e^{\alpha x}$, because $\sinh x = (e^x-e^{-x}) / 2$ and $\cosh x = (e^x+e^{-x}) / 2$.

The right hand side from $(\ref{ref:PDE_4})$ is solved against constant $\lambda$:

\begin{align} 1+ T'\frac 1 T &= \lambda \nonumber \\ T'- (\lambda - 1)T &= 0 \nonumber \\ T'+(1-\lambda)T &= 0 \nonumber \\ m + (1-\lambda) &= 0 \implies m= \lambda -1 \nonumber \\ T(t) &= c_7e^{(\lambda -1 )t} \nonumber \end{align}

Finally, let us combine $X$ and $T$ into $u(x,y)$:

1. When $\lambda=0:$
$\underline{\underline{u(x,y) = (c_1 + c_2x)e^{-t}}}$
2. When $\lambda \gt 0\ (\lambda = \alpha^2k):$
$\underline{\underline{u(x,y)}} = c_7e^{(\lambda - 1)t}\cdot (c_3 \sinh \alpha x + c_4 \cosh \alpha x = \underline{\underline{e^{-t}e^{\alpha^2kt}\cdot c_7(c_3\sinh \alpha x + c_4\cosh \alpha x)}}$
3. When $\lambda \lt 0\ (\lambda = -\alpha^2k):$
$\underline{\underline{u(x,y)}} = c_7e^{(\lambda -1)t}\cdot (c_5\sin \alpha x + c_6\cos \alpha x) = \underline{\underline{e^{-t}e^{-\alpha^2 kt}\cdot c_7(c_5\sin \alpha x + c_6\cos \alpha x)}}$

#### Example

Solve the heat equation with given initial and boundary conditions:

\begin{align} & \frac{\partial u}{\partial t} = k\frac{\partial^2 u}{\partial x^2} \hskip2em & u(x,0) = f(x) \nonumber \\ & & u(0,t) = 0 \nonumber \\ & & u(L,t) = 0 \nonumber \\ \end{align}  We have an equation describing physical problem and we are given initial conditions (distribution of temperature at $t=0$ is described by the function $f(x)$) and boundary conditions (temperature at the start and the end of the rod is set to zero. Well setting (or keeping) the temperature to zero is somehow unrealistic. But simple.

We are finding solution $u(x,t) = X(x)T(t)$. Let us observe boundary condition substituted into the solution:

• $u(0,t) = 0 \implies T(t)X(0) = 0$
• $u(L,t) = 0 \implies T(t)X(L) = 0$

That means either $T(t)$ has to be zero or $X(0)$ and $X(L)$ has to be zero. The first one, i.e. $T(t) = 0$ is not reasonable to expect. Because the time is factor of the problem. If $T(t) = 0$, then the solution $u(x,y) = X(x)\cdot T(t) = 0$ can not be useful nor valid. If $T(t)$ is not zero, then we are looking for $X(L) = X(0) = 0$:

\begin{align} XT' &= kX''T \nonumber \\ T'\frac 1 {Tk} &= X''\frac 1 X \label{ref:PDE_6} \end{align}

We are solving $X''\frac 1 X = \lambda$ from $(\ref{ref:PDE_6})$.

\begin{align} X'' &= \lambda X \nonumber \\ X'' - \lambda X &= 0 \nonumber \end{align}

Let us replace $\alpha^2$ for $\lambda$, then the expressions and statements are clearer.

1. $\lambda = 0:$
$$X''=0 \implies X(x) = c_1x + c_2$$
2. $\lambda \lt 0\ (\lambda = -\alpha^2):$
\begin{align} X''+\alpha^2 = 0 \implies \color{red}{X(x) = c_1\sin\alpha x + c_2\cos \alpha x} \label{ref:PDE_5} \end{align}
3. $\lambda \gt 0\ (\lambda = \alpha^2):$
$$X''-\alpha^2 = 0 \implies X(x) = c_1\sinh\alpha x + c_2\cosh \alpha x$$

All those trivial solutions with $c_1=c_2 = 0$ are really solutions for given initial values but are not useful and do not solve given problem. Our hope is focused on $\sin \alpha x$ in $(\ref{ref:PDE_5})$. Because if we apply $X(0) = 0$ and $X(L)=0$ into solution $(\ref{ref:PDE_5})$ we are able to get nontrivial solution:

\begin{align} \alpha x &= \pi n \nonumber \\ \alpha L &= \pi n \implies \color{red}{\alpha = \frac{\pi n}{L}} \nonumber \\ \color{red}{X(x)} &\color{red}{= c_1 \sin\frac{\pi n}{L}x} \nonumber \end{align}

We are solving the left hand side of $(\ref{ref:PDE_6})$:

\begin{align} T'\frac 1 {Tk} &= \lambda \nonumber \\ T' &= \lambda Tk \nonumber \\ T' - \lambda Tk &= 0 \nonumber \\ m- \lambda k &= 0 \implies m=\lambda k \nonumber \\ T &= c_3 e^{\lambda k t} \label{ref:PDE_7}\\ \end{align}

So we have a sequence of solutions for $n=1,2,3, \dots$ combined from $(\ref{ref:PDE_5})$ and $(\ref{ref:PDE_7})$

$$u_n(x,t) = T(t)X(x) = A_n e^{-\frac{\pi^2n^2}{L^2}kt}\cdot \sin\frac{\pi n}{L}x$$

Now at time $t=0$ inital conditions are given: $u(x, t=0) = f(x)$. So let us investigate the solution there:

$$u_n(x,t=0) = f(x) = A_n\sin\frac{\pi n}{L}x$$

Our solution does not look well. Because if $f(x)$ is some function, how the equality could hold? Is $f(x)$ restricted to be only a sine wave? So we have to admit that $u_n$ is not a solution. But we know from the superposition rule, that if $u_1$ and $u_2$ is a solution, then $c_1u_1 + c_2u_2$ is solution as well. Therefore we can write

$$u(x,t) = \sum_{n=1}^{\infty} A_n e^{-\frac{\pi^2n^2}{L^2}kt}\cdot \sin\frac{\pi n}{L}x$$

Let us set condition at $t=0$ again:

$$f(x) = \sum_{n=1}^{\infty} A_n \sin\frac{\pi n}{L}x$$

That is good enough. That is what we recognize as a Fourier series. Only instead of coefficient $b_n$ we have $A_n$. So the function is now described by Fourier series and we can express its coefficients from known formula $b_n = \frac 1 p \int_{-p}^{p} f(x)\sin nx \frac{\pi}{p}dx$:

$$b_n = \frac 2 L \int_0^L f(x)\sin nx\frac{\pi}L \ dx$$

Then the solution is

$$\underline{\underline{u(x,t) = \sum_{n=1}^{\infty}\left( \frac 2 L \int_0^L f(x)\sin nx\frac{\pi}L \ dx \right)\cdot e^{-\frac{\pi^2n^2}{L^2}kt} \cdot \sin\frac{\pi n}{L}x}}$$

List of chapters