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
 A: 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<x<\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.
A: 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$
A: 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.
