# How to impose boundary conditions in heat equation when solving using Fourier transform?

Given the following PDE: $$u_t(x,t)=u_{xx}(x,t)$$, where the subindices are partial differentiation. Using the Fourier transform $$(\mathcal{F})$$ for the spatial frequency domain $$(\omega)$$, in the eq. gives:

$$\mathcal{F}\{u_t(x,t)\} = \mathcal{F}\{u_{xx}(x,t)\}$$ $$\Rightarrow \hat{u_t}(\omega,t)=-\omega^2\hat u(\omega,t)$$ $$\Rightarrow{d\over dt}\hat u=-\omega^2\hat u$$

and then solving the last ODE...

$$\hat u(\omega,t)=e^{-\omega^2t}\ \hat u(\omega,0)$$

Using now the inverse Fourier transform $$(\mathcal F^{-1})$$...

$$\mathcal F^{-1}\{\hat u(\omega,t)\}=\mathcal F^{-1}\{e^{-\omega^2t}\ \hat u(\omega,0)\}$$ $$\Rightarrow u(x,t)=\mathcal{F}^{-1}\{e^{-\omega^2t}\}*u(x,0)$$ $$\Rightarrow u(x,t)={1\over 2\sqrt{\pi t}}e^{-x^2\over 4t}*u(x,0)$$

where the simbol $$*$$ indicates the convolution operation in the space domain. Now my question is how to solve for boundary conditions? If we solve for Neumann conditions with boundaries for a function $$u:[a,b]\times \Bbb R^+\to\Bbb R$$:

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

partial differentiate the convolution...

$${\partial u\over \partial x}={\partial\over \partial x}\left( {1\over 2\sqrt{\pi t}}e^{-x^2\over 4t}*u(x,0)\right)$$

$$\Rightarrow {1\over 2\sqrt{\pi t}}e^{-x^2\over 4t}*u_x(x,0)= {-x\over \sqrt{\pi t}}e^{-x^2\over 4t}*u(x,0)$$

but then I don't know how to proceed. I now that using Fourier series, for the Dirichlet boundary conditions, the solutios is writen as a series of sines because for the domain $$[0,L]$$, $$\sin(0)=\sin(n\pi x/L)=0$$; and for the Neumann boundary conditions, the solution is writen as a series of cosines because $$(\cos(n\pi x/L))'=\sin(n\pi x/L)$$ and then the same as above is true. But How can I relationate the solutions using Fourier series with the solution using the convolution with the gaussian?

• @Gonçalo very interesting. But this [Wikipedia's article][1], seems to only work for symmetrical initial functions. I was thinking of a general initial function [1]: en.wikipedia.org/wiki/Method_of_images Commented Jun 24, 2023 at 22:28

The usual Fourier transform is only defined for functions whose domain is the whole Euclidian space $$\mathbb{R}^n$$, so that method doesn't work when the domain of $$u$$ is $$[a,b]$$.

However, while the proof doesn't use Fourier transforms as far as I know, you can still write the solution as $$\begin{equation*} u(x,t) = {\int}_{\Omega} K(t,x,y)\ u(y,0)\ dy, \end{equation*}$$ for a general domain $$\Omega$$. $$K$$ is called the heat kernel, and when $$\Omega=\mathbb{R}$$, it is indeed as you've written it : $$K(t,x,y) = \frac{1}{2\sqrt{\pi t}} e^{-\frac{(x-y)^2}{4t}}.$$ As per Wikipedia,

On a more general domain Ω in $$\mathbb{R}^d$$, such an explicit formula is not generally possible. The next simplest cases of a disc or square involve, respectively, Bessel functions and Jacobi theta functions. Nevertheless, the heat kernel (for, say, the Dirichlet problem) still exists and is smooth for $$t > 0$$ on arbitrary domains and indeed on any Riemannian manifold with boundary, provided the boundary is sufficiently regular.

Just as for the Laplace transform, boundary conditions can be added as terms in the Fourier transformed equation.

We consider $$u$$ to only live on the half-strip $$[a,b] \times (0,\infty).$$ Now let us extend $$u$$ to be defined for all $$x\in(-\infty,\infty).$$ Then, as a distribution, $$u_{xx} - u_t = u_x(a) \delta_a - u_x(b) \delta_b + u(a) \delta_a' - u(b) \delta_b' .$$

Taking the Fourier transform ($$x \to \xi$$) gives $$-\xi^2 \hat u - \hat u_t = u_x(a) e^{-i\xi a} - u_x(b) e^{-i\xi b} + u(a) (i\xi) e^{-i\xi a} - u(b) (i\xi) e^{-i\xi b} .$$ So you get an inhomogeneous first order ordinary differential equation to solve.

• From where comes the delta function? Commented Jun 24, 2023 at 22:17
• @DanielMuñoz. From the derivatives at the boundary of the strip. Commented Jun 25, 2023 at 5:24