Diffusion Equation – Diffusion Equation with Inhomogeneous Boundary Conditions (The Subtraction Method)

partial differential equations

Recently I am reading a textbook on P.D.E. Most of the time textbooks mainly deal with homogenous equations and boundary conditions.

I am curious how would one solve say, the heat equation with inhomogenous boundary conditions?

$u_t=u_{xx}$

$u(0,t)=b(t)$ (Dirichlet BC)

or $u_x(0,t)=b(t)$ (Neumann BC)

I read somewhere about a "subtraction method",
where one lets $v(x,t)=u(x,t) – …$ , but don't really understand it.

Sincere thanks for any help.

Best Answer

In fact the "subtraction method" you so called is a little trick that pointedly changing some of the conditions from inhomogeneous to become homogeneous by applying the variable transformation on the dependent variable only.

This little trick is briefly introduced in http://maths.swan.ac.uk/staff/vl/pdes-course.pdf#page=32 and http://maths.swan.ac.uk/staff/vl/pdes-course.pdf#page=38.

For example the PDEs with dependent variable $u$ and independent variables $x$ and $t$ , the little trick is as follows:

for pointedly changing $u(0,t)=f(t)$ and $u(a,t)=g(t)$ $(a\neq0)$ : Let $v(x,t)=u(x,t)-f(t)-\dfrac{x}{a}(g(t)-f(t))$

for pointedly changing $u(0,t)=f(t)$ and $u_x(a,t)=g(t)$ : Let $v(x,t)=u(x,t)-f(t)-xg(t)$

for pointedly changing $u_x(0,t)=f(t)$ and $u(a,t)=g(t)$ : Let $v(x,t)=u(x,t)-(x-a)f(t)-g(t)$

for pointedly changing $u_x(0,t)=f(t)$ and $u_x(a,t)=g(t)$ $(a\neq0)$ : Let $v(x,t)=u(x,t)-h(t)-xf(t)-\dfrac{x^2}{2a}(g(t)-f(t))$

The other types of pointedly changing examples leaves yourself to think.

Sometimes this little trick is a must to apply, for example in Boundaries in heat equation and Heat equation with an unknown diffusion coefficient, otherwise you will get the wrong conclusion that has no solution.

For this problem, you might let $v(x,t)=u(x,t)-b(t)-xb(t)$ , but since there are no other conditions exist, so you have not necessarily to apply this trick, just seckilling this problem by one of the these two approaches:

Approach $1$: separation of variables

Case $1$: $\text{Re}(t)\geq0$

Let $u(x,t)=X(x)T(t)$ ,

Then $X(x)T'(t)=X''(x)T(t)$

$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{X(x)}=-s^2$

$\begin{cases}\dfrac{T'(t)}{T(t)}=-s^2\\X''(x)+s^2X(x)=0\end{cases}$

$\begin{cases}T(t)=c_3(s^2)e^{-ts^2}\\X(x)=\begin{cases}c_1(s^2)\sin xs+c_2(s^2)\cos xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$

$\therefore u(x,t)=C_1x+C_2+\int_0^\infty C_3(s^2)e^{-ts^2}\sin xs~ds+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds$

$u_x(x,t)=C_1+\int_0^\infty sC_3(s^2)e^{-ts^2}\cos xs~ds-\int_0^\infty sC_4(s^2)e^{-ts^2}\sin xs~ds$

$u_x(0,t)=b(t)$ :

$C_1+\int_0^\infty sC_3(s^2)e^{-ts^2}~ds=b(t)$

$\int_0^\infty\dfrac{C_3(s^2)e^{-ts^2}}{2}d(s^2)=b(t)-C_1$

$\int_0^\infty\dfrac{C_3(s)e^{-ts}}{2}ds=b(t)-C_1$

$\mathcal{L}_{s\to t}\biggl\{\dfrac{C_3(s)}{2}\biggr\}=b(t)-C_1$

$C_3(s)=2\mathcal{L}^{-1}_{t\to s}\{b(t)\}-2C_1\delta(s)$

$\therefore u(x,t)=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-2C_1\int_0^\infty\delta(s^2)e^{-ts^2}\sin xs~ds+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1\int_0^\infty\dfrac{\delta(s^2)e^{-ts^2}\sin xs}{s}d(s^2)+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1\int_0^\infty\dfrac{\delta(s)e^{-ts}\sin x\sqrt{s}}{\sqrt{s}}ds+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1\lim\limits_{s\to 0}\dfrac{e^{-ts}\sin x\sqrt{s}}{\sqrt{s}}+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1\lim\limits_{s\to 0}\dfrac{\dfrac{xe^{-ts}\cos x\sqrt{s}}{2\sqrt{s}}-te^{-ts}\sin x\sqrt{s}}{\dfrac{1}{2\sqrt{s}}}+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1\lim\limits_{s\to 0}(xe^{-ts}\cos x\sqrt{s}-2t\sqrt{s}e^{-ts}\sin x\sqrt{s})+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds-C_1x+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds+\int_0^\infty C_4(s^2)e^{-ts^2}\cos xs~ds$

$u(0,t)=b(t)$ :

$C_2+\int_0^\infty C_4(s^2)e^{-ts^2}~ds=b(t)$

$\int_0^\infty\dfrac{C_4(s^2)e^{-ts^2}}{2s}d(s^2)=b(t)-C_2$

$\int_0^\infty\dfrac{C_4(s)e^{-ts}}{2\sqrt{s}}ds=b(t)-C_2$

$\mathcal{L}_{s\to t}\biggl\{\dfrac{C_4(s)}{2\sqrt{s}}\biggr\}=b(t)-C_2$

$C_4(s)=2\sqrt{s}\mathcal{L}^{-1}_{t\to s}\{b(t)\}-C_2\delta(\sqrt{s})$

$\therefore u(x,t)=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\cos xs~ds-C_2\int_0^\infty\delta(s)e^{-ts^2}\cos xs~ds=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\cos xs~ds-C_2=2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\cos xs~ds$

Case $2$: $\text{Re}(t)\leq0$

Let $u(x,t)=X(x)T(t)$ ,

Then $X(x)T'(t)=X''(x)T(t)$

$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{X(x)}=s^2$

$\begin{cases}\dfrac{T'(t)}{T(t)}=s^2\\X''(x)-s^2X(x)=0\end{cases}$

$\begin{cases}T(t)=c_3(s^2)e^{ts^2}\\X(x)=\begin{cases}c_1(s^2)\sinh xs+c_2(s^2)\cosh xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$

$\therefore u(x,t)=C_1x+C_2+\int_0^\infty C_3(s^2)e^{ts^2}\sinh xs~ds+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds$

$u_x(x,t)=C_1+\int_0^\infty sC_3(s^2)e^{ts^2}\cosh xs~ds+\int_0^\infty sC_4(s^2)e^{ts^2}\sinh xs~ds$

$u_x(0,t)=b(t)$ :

$C_1+\int_0^\infty sC_3(s^2)e^{ts^2}~ds=b(t)$

$\int_0^\infty\dfrac{C_3(s^2)e^{ts^2}}{2}d(s^2)=b(t)-C_1$

$\int_0^\infty\dfrac{C_3(s)e^{ts}}{2}ds=b(t)-C_1$

$\int_0^\infty\dfrac{C_3(s)e^{-ts}}{2}ds=b(-t)-C_1$

$\mathcal{L}_{s\to t}\biggl\{\dfrac{C_3(s)}{2}\biggr\}=b(-t)-C_1$

$C_3(s)=2\mathcal{L}^{-1}_{t\to s}\{b(-t)\}-2C_1\delta(s)$

$\therefore u(x,t)=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-2C_1\int_0^\infty\delta(s^2)e^{ts^2}\sinh xs~ds+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1\int_0^\infty\dfrac{\delta(s^2)e^{ts^2}\sinh xs}{s}d(s^2)+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1\int_0^\infty\dfrac{\delta(s)e^{ts}\sinh x\sqrt{s}}{\sqrt{s}}ds+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1\lim\limits_{s\to 0}\dfrac{e^{ts}\sinh x\sqrt{s}}{\sqrt{s}}+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1\lim\limits_{s\to 0}\dfrac{\dfrac{xe^{ts}\cosh x\sqrt{s}}{2\sqrt{s}}+te^{ts}\sinh x\sqrt{s}}{\dfrac{1}{2\sqrt{s}}}+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1\lim\limits_{s\to 0}(xe^{ts}\cosh x\sqrt{s}+2t\sqrt{s}e^{ts}\sinh x\sqrt{s})+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_1x+C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds-C_1x+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds+\int_0^\infty C_4(s^2)e^{ts^2}\cosh xs~ds$

$u(0,t)=b(t)$ :

$C_2+\int_0^\infty C_4(s^2)e^{ts^2}~ds=b(t)$

$\int_0^\infty\dfrac{C_4(s^2)e^{ts^2}}{2s}d(s^2)=b(t)-C_2$

$\int_0^\infty\dfrac{C_4(s)e^{ts}}{2\sqrt{s}}ds=b(t)-C_2$

$\int_0^\infty\dfrac{C_4(s)e^{-ts}}{2\sqrt{s}}ds=b(-t)-C_2$

$\mathcal{L}_{s\to t}\biggl\{\dfrac{C_4(s)}{2\sqrt{s}}\biggr\}=b(-t)-C_2$

$C_4(s)=2\sqrt{s}\mathcal{L}^{-1}_{t\to s}\{b(-t)\}-C_2\delta(\sqrt{s})$

$\therefore u(x,t)=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\cosh xs~ds-C_2\int_0^\infty\delta(s)e^{ts^2}\cosh xs~ds=C_2+2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\cosh xs~ds-C_2=2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\cosh xs~ds$

Hence $u(x,t)=\begin{cases}2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\sin xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(t)\}e^{-ts^2}\cos xs~ds&\text{when Re}(t)\geq0\\2\int_0^\infty\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\sinh xs~ds+2\int_0^\infty s\mathcal{L}^{-1}_{t\to s^2}\{b(-t)\}e^{ts^2}\cosh xs~ds&\text{when Re}(t)\leq0\end{cases}$

Approach $2$: power series method

Similar to PDE - solution with power series:

Let $u(x,t)=\sum\limits_{n=0}^\infty\dfrac{x^n}{n!}\dfrac{\partial^nu(0,t)}{\partial x^n}$ ,

Then $u(x,t)=\sum\limits_{n=0}^\infty\dfrac{x^{2n}}{(2n)!}\dfrac{\partial^{2n}u(0,t)}{\partial x^{2n}}+\sum\limits_{n=0}^\infty\dfrac{x^{2n+1}}{(2n+1)!}\dfrac{\partial^{2n+1}u(0,t)}{\partial x^{2n+1}}=\sum\limits_{n=0}^\infty\dfrac{x^{2n}}{(2n)!}\dfrac{\partial^nu(0,t)}{\partial t^n}+\sum\limits_{n=0}^\infty\dfrac{x^{2n+1}}{(2n+1)!}\dfrac{\partial^nu_x(0,t)}{\partial t^n}=\sum\limits_{n=0}^\infty\dfrac{x^{2n}}{(2n)!}\dfrac{\partial^nb(t)}{\partial t^n}+\sum\limits_{n=0}^\infty\dfrac{x^{2n+1}}{(2n+1)!}\dfrac{\partial^nb(t)}{\partial t^n}$

Related Question