# Solve Heat Equation using Fourier Transform (non homogeneous)

I know how to solve heat equation where it's like $u_t=k\cdot u_{xx}$ (using Fourier Transform or using Separation of Variables) but this exercise is really difficult for me.

I have this:

$$u_t(x,t)=k \cdot u_{xx}(x,t)-a\cdot k \cdot u(x,t)$$ $$u_x(0,t)=0$$ $$u(x,0) = f(x)$$

with $x>0, t>0$ and $a, k$ are positive constants.

I have to find $u(x,t)$ and propose a possible $f(x)$

Any help? Thanks

I was told I cannot use Fourier Transform, I have to use Fourier Cosine Transform, and I don't know why

• You can bring the equation to the form you know how to solve with a simple change of variables. Define $v = u e^{ak t}$ then $v_t = k v_{xx}$ with $v_x(0,t) = 0$ and $v(x,0) = f(x)$. May 18, 2017 at 20:15

Indeed, this problem should be solved with Fourier cosine transform rather than Fourier transform. If you use Fourier transform, you won't be able to take the b.c. at $$x=0$$ into consideration, and the equation will then be solved in $$-\infty with implicit b.c.s at $$\pm\infty$$. (For this part check this post for more information. )

The key point is, when $$f(\infty)=0$$, Fourier cosine transform

$$\mathcal{F}_t^{(c)}[f(t)](\omega)=\sqrt{\frac{2}{\pi }}\int _0^{\infty } f(t) \cos (\omega t) d t$$

has the following property:

$$\mathcal{F}_t^{(c)}\left[f''(t)\right](\omega)=-\omega^2 \mathcal{F}_t^{(c)}[f(t)](\omega)-\sqrt{\frac{2}{\pi }} f'(0)$$

You can easily verify this property using integration by parts.

So, by applying this property on your equation, we have

$$\mathcal{F}_x^{(c)}\left[u^{(1,0)}(t,x)\right](\omega )=k \left(-\omega ^2 \mathcal{F}_x^{(c)}[u(t,x)](\omega )-\sqrt{\frac{2}{\pi }} u^{(0,1)}(t,0)\right)-a k \mathcal{F}_x^{(c)}[u(t,x)](\omega )$$

Substitute the b.c. into the equation, we obtain a simple initial value problem (IVP) of linear ODE:

$$U'(t)=-a k U(t)-k \omega ^2 U(t)$$ $$U(0)=F$$

where $$U(t)=\mathcal{F}_x^{(c)}[u(t,x)](\omega )$$, $$F=\mathcal{F}_x^{(c)}[f(x)](\omega)$$.

If you have difficulty in solving the IVP, check the wikipedia page). Anyway, we can easily find its solution:

$$U(t)=F e^{-k t \left(a + \omega ^2\right)}$$

The last step is to transform back with inverse Fourier Cosine transform

$${\mathcal{F}_\omega^{(c)}}^{-1}[F(\omega)](t)=\sqrt{\frac{2}{\pi }} \int_0^{\infty } F(\omega ) \cos (t \omega) \, d\omega$$

and the solution is

$$u(t,x)=\sqrt{\frac{2}{\pi }} \int_0^{\infty } e^{-k t \left(a + \omega ^2\right)} \mathcal{F}_x^{(c)}[f(x)](\omega ) \cos (\omega t) \, d\omega$$

Notice this solution is probably the same as the one given by doraemonpaul. I guess he has just chosen a different convention for Fourier parameters.

• Can you explain what do the notations $u^{(1,0)}\,(t,x)$ and $u^{(0,1)}\,(t,0)$ mean? I am really confused with them. May 4, 2019 at 10:13
• @sam $u^{(0,1)}(t,0)$ is equivalent to $\frac{\partial u(t,x)}{\partial x}\big|_{x=0}$. May 4, 2019 at 10:33
• I see, thank you. But I still don't know why we can't use Fourier Transform and why we have to use Fourier Cosine Transform. Can you explain the reason? Thanks. May 4, 2019 at 10:46
• @sam As already mentioned above, if we use Fourier transform, we won't be able to take the b.c. at $x=0$ into consideration, and the equation will then be solved in $-\infty<x<\infty$ with implicit b.c.s at $\pm\infty$. (Usually it's $f(\pm ∞)=0$. ) May 4, 2019 at 10:57
• @sam BTW here is another example solving PDE with Fourier cosine transform: mathematica.stackexchange.com/a/158079/1871 May 4, 2019 at 11:13

Of course use separation of variables:

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

Then $X(x)T'(t)=kX''(x)T(t)-akX(x)T(t)$

$X(x)(T'(t)+akT(t))=kX''(x)T(t)$

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

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

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

$\therefore u(x,t)=\int_0^\infty C_1(s)e^{-kt(s^2+a)}\sin xs~ds+\int_0^\infty C_2(s)e^{-kt(s^2+a)}\cos xs~ds$

$u_x(x,t)=\int_0^\infty sC_1(s)e^{-kt(s^2+a)}\cos xs~ds-\int_0^\infty sC_2(s)e^{-kt(s^2+a)}\sin xs~ds$

$u_x(0,t)=0$ :

$\int_0^\infty sC_1(s)e^{-kt(s^2+a)}~ds=0$

$C_1(s)=0$

$\therefore u(x,t)=\int_0^\infty C_2(s)e^{-kt(s^2+a)}\cos xs~ds$

$u(x,0)=f(x)$ :

$\int_0^\infty C_2(s)\cos xs~ds=f(x)$

$\mathcal{F}_{c,s\to x}\{C_2(s)\}=f(x)$

$C_2(s)=\mathcal{F}^{-1}_{c,x\to s}\{f(x)\}$

$\therefore u(x,t)=\int_0^\infty\mathcal{F}^{-1}_{c,x\to s}\{f(x)\}e^{-kt(s^2+a)}\cos xs~ds$

• Though the method is not Fourier transform, the answer is correct, I think. I suggest you to mention the convention of Fourier parameters in your answer. (It's different from the one chosen in my answer, right?) Oct 20, 2017 at 12:38

Let us apply the Fourier Transform with respect to the spatial coordinate $x$ :$$\partial_{t}\hat{u}\left(\xi,t\right)=-k\xi^{2}\hat{u}\left(\xi,t\right)-iak\xi\hat{u}\left(\xi,t\right)$$ i.e. $$\partial_{t}\hat{u}\left(\xi,t\right)=-k\left(\xi^{2}-ia\xi\right)\hat{u}\left(\xi,t\right)$$ hence$$\hat{u}\left(\xi,t\right)=Ce^{-k\left(\xi^{2}-ia\xi\right)t}$$ where $C$ is a constant to be determinated later. Here the convention used for the Fourier transform is$$\hat{u}\left(\xi,t\right)=\mathrm{TF}\left[u\right]\left(\xi,t\right)=\intop_{x\in\mathbb{R}}u\left(x,t\right)e^{-ix\xi}dx.$$ Now I let you come back to the initial space with the inversion formula$$u\left(x,t\right)=\mathrm{TF}^{-1}\left[\hat{u}\right]\left(x,t\right)=\frac{1}{2\pi}\intop_{x\in\mathbb{R}}Ce^{-k\left(\xi^{2}-ia\xi\right)t}e^{ix\xi}d\xi$$ (take care to the sign in the exponential). You must find a gaussian function.

• How do I know if it's better to use Fourier Transform or Fourier Cosine Transform or Fourier Sine Transform? Feb 16, 2015 at 15:59
• For some parity reasons I guess : if you integrate an odd function on $\mathbb{R}$, then you integral (taken over all $\mathbb{R}$) is zero. Feb 16, 2015 at 16:08
• that's true, but I don't know why my professor used fourier cosine transform Feb 16, 2015 at 16:25
• I was told I cannot use Fourier Transform, I have to use Fourier Cosine Transform, and I don't know why Feb 17, 2015 at 14:39
• can you help me? Feb 18, 2015 at 4:57