Heat Equation, Diffusion Equation
Definition1 2
The following partial differential equation is referred to as the heat equation or the diffusion equation.
$$ \dfrac{\partial u}{\partial t} = \dfrac{\partial^{2} u}{\partial x^{2}} $$
When the spatial coordinate is $n$-dimensional, $$ \dfrac{\partial u}{\partial t} = \Delta u = \nabla^{2}u $$ here, $\Delta = \nabla^{2} = \sum\limits_{i=1}^{n} \dfrac{\partial^{2} }{\partial x_{i}^{2}}$ refers to the Laplacian.
When there is an external force $f = f(x,t)$, $$ \dfrac{\partial u}{\partial t} = \dfrac{\partial^{2} u}{\partial x^{2}} + f $$
When there is a diffusion coefficient $a = a(x) > 0$, $$ \dfrac{\partial u}{\partial t} = \dfrac{\partial }{\partial x} \left[ a(x) \dfrac{\partial u}{\partial x} \right] $$
Initial and Boundary Conditions
The heat equation typically comes with initial and boundary conditions. The solution cannot be uniquely determined by initial conditions alone. Let’s say that $u$ is a function defined at $\Omega \times [0, T]$,
$$ \text{initial condition : } u(x, 0) = g(x) \quad \text{ on } \Omega \times \left\{ 0 \right\} $$
$$ \text{boundary condition : } u(x, t) = h(x, t) \quad \text{ on } \partial \Omega \times [0, T] $$
$\partial \Omega$ is the boundary of $\Omega$.
Explanation
This is a form where a term regarding time is added to the Laplace equation. Since the Laplace equation is independent of the flow of time, it is an equation for an equilibrium state, whereas the heat equation is affected by the flow of time, hence, it is an equation for a state where some physical quantity is flowing (diffusing). The reason it is named the heat equation stems from its first emergence in thermodynamics.
Derivation
Let’s say $U \subset \mathbb{R}^n$ is an open set and represents a physical space. Let $u:U\times (0,\ \infty) \to \mathbb{R}$ be the density function of some physical quantity. Then, $u(x,\ t)$ represents the density at a point $x\in U$ at time $t>0$. Assume a certain open set $V$ is $V \Subset U$ and satisfies $V\in C^{\infty}$. Also, let $\mathbf{F} : U \times (0, \infty) \to \mathbb{R}^n$ be the flux of $u$. Then, the following equation must hold between $u$ and $\mathbf{F}$.
$$ \dfrac{d}{dt}\int_{V}u(x,t)dx = -\int_{\partial V}\mathbf{F}(x, t) \cdot \nu (x) dS(x) $$
The left side talks about the change in quantity $u$ in some space, and the right side talks about the amount that went in or out at the boundary of that space. Unless it generates or annihilates by itself, the amount stays constant. If there is a change in the internal physical quantity, there must be something coming in or going out, and the values of both are the same.
Take, for instance, a room with people freely entering and leaving. Let there be an observer $A$ inside the room counting changes in the number of people. Let there be another observer $B$ at the door adding $+1$ for every person leaving, and $-1$ for every person entering. If 3 people left the room, the change measured by $A$ inside the room is -3, and the count by $B$ at the door is 3. This is why there is a minus sign on the right side.
Since $u \in C^{2}$, integrating the left side’s derivative inside, and applying Green’s theorem on the right side gives the following.
$$ \int_{V} u_{t}(x,t)dx=-\int_{V} \nabla \cdot \mathbf{F}(x,t)dx\quad \forall t>0 $$
Therefore, we obtain the following.
$$ u_{t}=-\nabla \cdot \mathbf{F}\quad \mathrm{in}\ U\times(0,\infty) $$
Just as when deriving the Laplace equation, if $F$ is a quantity proportional to the gradient of $u$, then we have $\mathbf{F}=-aDu$, and obtain the following.
$$ u_{t}=-\nabla \cdot(-aDu)=a\nabla \cdot Du=a\Delta u $$
If we set $a=1$, we obtain the heat equation.