In this article, we learn how to solve the heat equation using the Fourier series. The heat equation belongs to the class of partial differential equations widely used in physics. It describes the diffusion of heat over a region of space. Of course, there are many approaches to studying this equation. Here we mainly use the simplest approach.

## The heat equation model

The Fourier series was introduced by the french mathematician and politician Fourier to solve the heat equation. The latter is modeled as follows: let us consider a metal bar. Knowing, at the initial instant, the temperature at each point of the bar and, at all times; the temperature at both ends; can we determine; at any time and at any point; the temperature of the bar?

This problem has been modeled and the temperature $u$ which is a function of time $t$ and the point $x$ is the solution of a partial differential equation called heat equation.

We can assume that the bar is the segment $[0, L]$. Denote $Q =(0, L)\times(0, + \infty)$, and $\overline{Q} = [0, L] \times [0, + \infty)$. The problem to solve is as follows: find a function $u$ such that \begin{align*}\tag{H1}u\in \mathcal{C}^0(\overline{Q}),\quad u\in \mathcal{C}^2(Q),\end{align*}\begin{align*}\tag{H2}\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2}\quad\text{on}\quad Q,\end{align*} \begin{align*}\tag{H3} u(0,t)=u(L,t)=0,\qquad t\in [0,+\infty),\end{align*}\begin{align*}\tag{H4} u(x,0)=h(x),\quad x\in [0,L],\end{align*} where $h$ is a $C^1$ function on the closed interval $[0,L]$ satisfying $h(0)=h(L)=0,$ this is needed to give more regularity to the solution $u$.

### The heat equation using the Fourier series approach

We write the solution of (H2) as $$u (x, t) = f (x) g (t).$$ Then equation $(H2)$ is equivalent to $f(x)g'(t)=f”(x)g(t)$. Let us now find a solution $u$ correponding to the case $f(x)\neq 0$ pour any $x\in ]0,L[$, and $g(t)\neq 0$ for all $t>0$. We deduce that\begin{align*}\frac{f”(x)}{f(x)}=\frac{g'(t)}{g(t)},\quad \forall x\in (0,L),\;t>0.\end{align*}This is true only if the two sides of this equality are constants. This means that, there exists a constant $\lambda\in \mathbb{R}$ such that for any $xin (0,L)$ and $t>0,$ \begin{align*} f”(x)=\lambda f(x)\quad\text{and}\quad g'(t)=\lambda g(t).\end{align*}

In the case of $\lambda>,$ the solution of the first equation is given by \begin{align*} f(x)=a e^{\sqrt{ \lambda }x}+b e^{-\sqrt{ \lambda }x}.\end{align*} The condition $(H3)$ implies that $a+b=0$ and $a e^{\sqrt{ \lambda }L}+b e^{-\sqrt{ \lambda }L} =0$ . Hence $a=b=0,$ and then $u(x,t)=0,$ this is a contradiction with the condition $(H4)$. On the other hand, if $\lambda=0,$ we have $f”(x)=0$. Then $f(x)=ax+b$. But, due to $(H3)$, we get $u=0,$ and this is a contacdition. The only case that remains is $\lambda <0$. We can wrire $\lambda=-\xi^2<0$. In this case, \begin{align*}f(x)=a\cos \xi x+b\sin \xi x,\quad g(t)=ce^{-\xi^2 t}.\end{align*}

Now using the condition $(H3)$, we deduce that $a=0$ and $\xi=\frac{n\pi}{L}$ for $n\in\mathbb{Z}$. We then have a family of solutions of the form\begin{align*} u_n(x,t)=b_n \sin\left( \frac{n\pi}{L}x\right) e^{- \frac{n^2\pi^2}{L^2}t }. \end{align*}

As the equation $(H2)$ is linear then any sum of $u_n$ is also a solution. We then introduce \begin{align*} u(x,t)=\sum_{n=1}^{+\infty} b_n \sin\left( \frac{n\pi}{L}x\right) e^{- \frac{n^2\pi^2}{L^2}t } .\end{align*}

Remark: Let us mention the isometry of the Fourier transform on the Hilbert space $L^2$ can help in solving the PDE. In fact, using Fourier transform can help transform the heat equation as PDE into an ordinary differential equation. Then we can use elementary materials to solve the equation. On the other hand, one can use semigroup theory to solve the heat equation.