Module contents
Lesson 19 of 20Core 120 min

Introduction to partial differential equations

A conceptual guided tour, without numerical methods, of PDEs in AI and finance: transport and continuity (characteristics), heat (Gaussian fundamental solution and smoothing), waves (d'Alembert) and Laplace (harmonic functions). PDEs are classified, well-posedness discussed, and boundary problems solved by separation of variables with Fourier series. Numerical schemes belong to m29.

After this lesson you can

  • Classify second-order linear PDEs as elliptic, parabolic or hyperbolic and explain Hadamard well-posedness.
  • Solve the transport equation using characteristics and derive the continuity equation from mass conservation.
  • Obtain the fundamental solution of the heat equation and express solutions as convolution with a Gaussian kernel.
  • Solve simple boundary problems by separation of variables with Fourier series.
  • Recognize qualitative properties of each type: smoothing, finite-speed propagation and the maximum principle.

Before you start

Motivation: equations for fields, not numbers

An ordinary differential equation describes how a finite-dimensional state evolves. A partial differential equation (PDE) describes how an entire function evolves or what equilibrium it reaches: a temperature u(x,t)u(x, t), density ρ(x,t)\rho(\vb{x}, t), the height of a string. The unknown lives in an infinite-dimensional space and derivatives are partial: in space and time simultaneously. Almost all physics and much of modern machine learning are written in this language.

  • Diffusion models. Adding Gaussian noise to data, xt=x0+2t z\vb{x}_t = \vb{x}_0 + \sqrt{2t}\,\vb{z}, makes the density of xt\vb{x}_t obey the heat equation. Generation traverses that evolution backward, requiring a model that learns the score ∇log⁡pt\grad\log p_t (m19).
  • Flow matching and normalizing flows. A velocity field vθ(x,t)v_\theta(\vb{x}, t) transports a simple distribution to the data distribution. Density at each time satisfies the continuity equation, which also gives exact likelihood.
  • Blur and scale space. Applying a Gaussian filter to an image solves the heat equation for time t=σ2/2t = \sigma^2/2. Convolutional networks and edge detectors work with this family (m16).
  • Finance. The Black–Scholes equation for option prices becomes the heat equation after a change of variables (m28). Fokker–Planck and Kolmogorov equations describing stochastic-process density are transport and diffusion PDEs (m26).
  • Science with networks. Physics-informed neural networks (PINNs) and neural operators learn PDE solutions (m29).

This lesson is a guided tour with proofs. For each fundamental PDE type (transport and continuity, heat, waves, Laplace) you will see where the equation comes from, how to solve it by hand when possible, and qualitative properties distinguishing them. Two rules accompany it: each equation is seen working in an interactive before any proof; and no numerical schemes are studied here—finite differences, finite elements and the CFL condition are m29’s subject. Interactives use a numerical method underneath, but are observation tools, not the subject of study.

Vocabulary: what a PDE is and when it is well posed

Linearity has a frequently used consequence: if Lu1=0Lu_1 = 0 and Lu2=0Lu_2 = 0, then L(αu1+βu2)=0L(\alpha u_1 + \beta u_2) = 0. Solutions of a linear homogeneous PDE form a vector space, so complicated solutions can be constructed by adding simple ones.

EquationOrderLinear?Appears in
ut+c ux=0u_t + c\,u_x = 0 (transport)1yesadvection, normalizing flows
ut+u ux=0u_t + u\,u_x = 0 (Burgers)1noshock waves, simplest model of discontinuity formation
ut=uxxu_t = u_{xx} (heat)2yesdiffusion, blur, diffusion processes
utt=c2uxxu_{tt} = c^2 u_{xx} (waves)2yesstrings, sound, light
uxx+uyy=0u_{xx} + u_{yy} = 0 (Laplace)2yesequilibria, potentials

A PDE alone almost never determines a solution. Initial conditions are needed (the state at t=0t = 0; for waves, also velocity ut(⋅,0)u_t(\cdot, 0)) and, if the domain has a boundary, boundary conditions: Dirichlet (fix value uu), Neumann (fix normal derivative ∂nu\partial_n u) or periodic. The same equation with different boundaries has different solutions.

The first two conditions are logical; the third matters in practice. Data are measured with noise and computers round: a problem amplifying arbitrarily small perturbations cannot be solved with physical measurements or floating-point arithmetic. You will see a striking example at the end.

Classification of second-order linear PDEs

The second-order equations in the table behave radically differently, due to their highest-order part. Every second-order linear PDE is written

Lu=∑i,j=1naij(x) ∂i∂ju+(teˊrminos de orden≤1),Lu = \sum_{i, j=1}^n a_{ij}(\vb{x})\,\partial_i\partial_j u + (\text{términos de orden} \le 1),

and A(x)=(aij)\mat{A}(\vb{x}) = (a_{ij}) may be taken symmetric because mixed derivatives agree (Schwarz’s theorem). The principal part is then ∑aij ∂i∂ju=tr⁡(A ∇2u)\sum a_{ij}\,\partial_i\partial_j u = \tr\big(\mat{A}\,\grad^2 u\big): the trace of the product of A\mat{A} and the Hessian of uu. The Laplacian is the case A=I\mat{A} = \mat{I}.

To know this is a property of the equation rather than chosen coordinates, we must see it is unchanged by a change of variables.

Proof

By the chain rule, ∂iu=∑k(∂kw) Mki\partial_i u = \sum_k (\partial_k w)\,M_{ki} and, differentiating again, ∂i∂ju=∑k,l(∂k∂lw) MkiMlj+∑k(∂kw) ∂i∂jϕk\partial_i\partial_j u = \sum_{k, l} (\partial_k\partial_l w)\,M_{ki}M_{lj} + \sum_k (\partial_k w)\,\partial_i\partial_j\phi_k. The second summand contains only first derivatives of ww. Thus ∑i,jaij∂i∂ju=∑k,lakl′ ∂k∂lw+(orden≤1)\sum_{i,j} a_{ij}\partial_i\partial_j u = \sum_{k,l} a'_{kl}\,\partial_k\partial_l w + (\text{orden} \le 1) with akl′=∑i,jMkiaijMlja'_{kl} = \sum_{i,j} M_{ki}a_{ij}M_{lj}, i.e. A′=MAM⊤\mat{A}' = \mat{M}\mat{A}\mat{M}\T. Matrices A\mat{A} and MAM⊤\mat{M}\mat{A}\mat{M}\T are congruent and, by Sylvester’s law of inertia, have the same signature (numbers of positive, negative and zero eigenvalues).

∎

The three canonical examples, with variables (x,t)(x, t) when time is present:

EquationA\mat{A} (principal part)EigenvaluesTypeSolution behavior
Laplace uxx+uyy=0u_{xx} + u_{yy} = 0I\mat{I}1, 11,\ 1ellipticequilibrium, very smooth, maximum principle
Heat ut−uxx=0u_t - u_{xx} = 0diag⁡(−1,0)\diag(-1, 0)−1, 0-1,\ 0parabolicdiffusion: smooths, infinite propagation speed
Wave utt−uxx=0u_{tt} - u_{xx} = 0diag⁡(−1,1)\diag(-1, 1)−1, 1-1,\ 1hyperbolicfinite-speed propagation, no smoothing
Black–Scholes Vt+12σ2S2VSS+⋯=0V_t + \tfrac12\sigma^2S^2V_{SS} + \dots = 0diag⁡(12σ2S2,0)\diag(\tfrac12\sigma^2S^2, 0)12σ2S2, 0\tfrac12\sigma^2S^2,\ 0parabolicdiffusion (time runs backward from expiry)

For a two-variable PDE a uxx+2b uxy+c uyya\,u_{xx} + 2b\,u_{xy} + c\,u_{yy}, the criterion is determinant sign: ac−b2>0ac - b^2 > 0 elliptic, <0< 0 hyperbolic, =0= 0 parabolic. For instance uxx+4uxy+uyy=0u_{xx} + 4u_{xy} + u_{yy} = 0 has a=c=1a = c = 1, b=2b = 2, ac−b2=−3<0ac - b^2 = -3 < 0: hyperbolic despite appearances. Names come from conics, but what matters is what they predict: elliptic problems are equilibrium problems solved using data on the whole boundary; parabolic and hyperbolic ones are evolution problems. Each following section shows a prototype.

Transport: values travel along characteristics

Start with the simplest first-order linear PDE. A quantity u(x,t)u(x, t) is carried by a current of velocity c(x)c(x) without changing value: an ink spot in a river flowing along a narrowing and widening channel. The transport equation is

ut+c(x) ux=0,u(x,0)=u0(x).u_t + c(x)\,u_x = 0, \qquad u(x, 0) = u_0(x).

The solution idea is to view the world from a particle moving with the current. Let x(t)x(t) be a curve satisfying x′(t)=c(x(t))x'(t) = c(x(t)). The chain rule gives

 ⁣d ⁣dt u(x(t),t)=ut+ux x′(t)=ut+c(x) ux=0.\frac{\dd}{\dd t}\,u\big(x(t), t\big) = u_t + u_x\,x'(t) = u_t + c(x)\,u_x = 0.

Along each of these curves, called characteristics, uu is constant. A partial differential problem has become a family of ordinary equations you already know how to solve (initial-value problems).

InteractiveCharacteristics and shocks
  • characteristics x0↦x(t)x_0 \mapsto x(t) (darker where ∣u0∣|u_0| is greater; purple if u0<0u_0 < 0)
  • u0u_0 (initial profile)
  • u(⋅,t)u(\cdot, t)
  • multivalued classical solution
  • shock
Equation
1.20
1.00
−0.35
0.80
Time tt1.20
First crossing t∗=−1/min⁡u0′t_* = -1/\min u_0'does not exist
Values of uu: maximum / minimum1.00 / 0.00
Area ∫u  ⁣dx\int u\,\dd x2.198
With constant cc the profile travels rigidly: u(x,t)=u0(x−c t)u(x, t) = u_0(x - c\,t). All characteristics are parallel lines.
Above, the (x,t)(x, t) plane with characteristics: darker ones start where ∣u0∣\abs{u_0} is large. Below, the profile at the time marked by the dashed line; lower and upper points are the same, each carrying value u0(x0)u_0(x_0) on its characteristic. Drag colored points to shape u0u_0. With constant cc lines are parallel. With c(x)=c0+axc(x) = c_0 + ax they stretch or bunch, but never touch: why? With Burgers, c=uc = u, the high part of the pulse runs faster and catches the low part: increase tt and find time t∗t_* when the shock appears. Observe area ∫u  ⁣dx\int u\,\dd x changes with c(x)c(x) but not Burgers.
Proof

Uniqueness. If uu is a C1C^1 solution, the previous calculation shows u(Φs(y),s)u(\Phi_s(y), s) does not depend on ss, hence u(Φs(y),s)=u0(y)u(\Phi_s(y), s) = u_0(y). Since Φs\Phi_s is bijective, taking y=Φ−s(x)y = \Phi_{-s}(x) gives u(x,s)=u0(Φ−s(x))u(x, s) = u_0(\Phi_{-s}(x)). Existence. Flow Φ\Phi is C1C^1 in (s,y)(s, y) by differentiable dependence on initial conditions (ODE lesson). Define uu by the formula; it is C1C^1 by composition and satisfies u(Φs(y),s)=u0(y)u(\Phi_s(y), s) = u_0(y) for every ss and yy. Differentiate that identity with respect to ss: ux c+ut=0u_x\,c + u_t = 0 at point (Φs(y),s)(\Phi_s(y), s); and every point (x,s)(x, s) has that form, with y=Φ−s(x)y = \Phi_{-s}(x).

∎

Cases solvable by hand. If cc is constant, Φs(y)=y+cs\Phi_s(y) = y + cs and u=u0(x−ct)u = u_0(x - ct): the profile travels rigidly at speed cc. If c(x)=c0+axc(x) = c_0 + ax with a≠0a \ne 0, linear ODE x′=c0+axx' = c_0 + ax has solution x(t)=(x0+c0/a)eat−c0/ax(t) = (x_0 + c_0/a)e^{at} - c_0/a and thus u(x,t)=u0((x+c0/a)e−at−c0/a)u(x, t) = u_0\big((x + c_0/a)e^{-at} - c_0/a\big). With c(x)=xc(x) = x (c0=0c_0 = 0, a=1a = 1) this is u0(xe−t)u_0(x e^{-t}): the profile expands exponentially. You will use this formula in the coding exercise.

Three observations about this type of equation:

  • No smoothing. The solution is as regular as the data: a corner of u0u_0 travels unchanged. Opposite to what you will see for heat.
  • Characteristics do not cross. Since cc is C1C^1 and therefore locally Lipschitz, distinct solutions of x′=c(x)x' = c(x) never meet (Picard–Lindelöf uniqueness), so the formula defines uu for every tt.
  • Area is not generally conserved. With c(x)=c0+axc(x) = c_0 + ax, ∫u  ⁣dx=eat∫u0  ⁣dx\int u\,\dd x = e^{at}\int u_0\,\dd x: if the current spreads (a>0a > 0), the pulse widens without its maximum decreasing and area grows. Equation ut+c ux=0u_t + c\,u_x = 0 says uu is a traveling label, not a conserved quantity. The next section gives the equation that does conserve.

When characteristics cross: Burgers

What if current velocity depends on what it carries? Burgers’ equation ut+u ux=0u_t + u\,u_x = 0 is the simplest nonlinear version. Each value uu travels at speed uu: high runs faster than low. Along a characteristic uu is constant, so speed is too, and the characteristic is a line: x=x0+u0(x0) tx = x_0 + u_0(x_0)\,t. The solution is implicitly defined by u(x,t)=u0(x0)u(x, t) = u_0(x_0) with x=x0+t u0(x0)x = x_0 + t\,u_0(x_0). Differentiating with respect to xx,

ux=u0′(x0) ∂x0∂x=u0′(x0)1+t u0′(x0).u_x = u_0'(x_0)\,\frac{\partial x_0}{\partial x} = \frac{u_0'(x_0)}{1 + t\,u_0'(x_0)}.

The denominator is ∂x/∂x0\partial x/\partial x_0. If u0′(x0)<0u_0'(x_0) < 0 somewhere (the high part is behind the low part), the denominator vanishes at t=−1/u0′(x0)t = -1/u_0'(x_0) and the slope of uu becomes infinite.

Proof

If uu is a C1C^1 solution, each characteristic satisfies x′=u(x,t)x' = u(x, t) with uu constant along it, hence is line x=x0+t u0(x0)x = x_0 + t\,u_0(x_0). Map ψt:x0↦x0+t u0(x0)\psi_t : x_0 \mapsto x_0 + t\,u_0(x_0) has derivative 1+t u0′(x0)1 + t\,u_0'(x_0). If t<t∗t < t_*, that derivative is bounded below by 1+tmin⁡u0′>01 + t\min u_0' > 0 and, because u0u_0 is bounded, ψt(x0)→±∞\psi_t(x_0) \to \pm\infty as x0→±∞x_0 \to \pm\infty: ψt\psi_t is a diffeomorphism of R\R, and u=u0∘ψt−1u = u_0 \circ \psi_t^{-1} is C1C^1 and satisfies the equation (by the formula for uxu_x and its analog for utu_t). Let x0∗x_0^* be the point where u0′u_0' is minimum. As t→t∗−t \to t_*^-, the denominator of uxu_x at ψt(x0∗)\psi_t(x_0^*) tends to 00 with numerator u0′(x0∗)<0u_0'(x_0^*) < 0, so ux→−∞u_x \to -\infty and there is no C1C^1 solution at [0,t∗][0, t_*]. For t>t∗t > t_*, ψt′<0\psi_t' < 0 near x0∗x_0^*, so ψt\psi_t is not injective: there are x0≠x1x_0 \ne x_1 with ψt(x0)=ψt(x1)\psi_t(x_0) = \psi_t(x_1), forcing u0(x0)≠u0(x1)u_0(x_0) \ne u_0(x_1), and a C1C^1 solution would have two values at the same point.

∎

After t∗t_* the method of characteristics ceases to work and the problem changes nature: the physical solution has a shock, a discontinuity moving at speed s=(uL+uR)/2s = (u_L + u_R)/2 (Rankine–Hugoniot condition), and the equation must be understood weakly, multiplying by test functions and integrating by parts. This is weak-solution and conservation-law theory, left for m29. The figure’s blue curve is that shock solution, calculated with the Hopf–Lax formula; dashed red is the physically absurd multivalued classical solution.

Continuity equation: mass conservation

The transport above does not conserve area because uu was a label. When the quantity is a density (mass, charge, probability), total quantity must be conserved and the equation changes.

Let ρ(x,t)≥0\rho(\vb{x}, t) \ge 0 be density and v(x,t)\vb{v}(\vb{x}, t) the velocity of matter at each point. Fix region Ω\Omega with smooth boundary. Its mass M(t)=∫Ωρ  ⁣dxM(t) = \int_\Omega \rho\,\dd\vb{x} can change only as matter enters or leaves the boundary, and outward flux is ∮∂Ωρ v⋅n  ⁣dS\oint_{\partial\Omega} \rho\,\vb{v}\cdot\vb{n}\,\dd S. By the divergence theorem,

 ⁣dM ⁣dt=−∮∂Ωρ v⋅n  ⁣dS=−∫Ωdiv⁡(ρ v)  ⁣dx.\frac{\dd M}{\dd t} = -\oint_{\partial\Omega} \rho\,\vb{v}\cdot\vb{n}\,\dd S = -\int_\Omega \operatorname{div}(\rho\,\vb{v})\,\dd\vb{x}.

Differentiating under the integral (ρ∈C1\rho \in C^1, Leibniz’s rule), ∫Ω(ρt+div⁡(ρ v))  ⁣dx=0\int_\Omega \big(\rho_t + \operatorname{div}(\rho\,\vb{v})\big)\,\dd\vb{x} = 0 for every region Ω\Omega. If the continuous integrand were positive at a point, it would be positive in a small ball around it, and the integral over that ball would not vanish. Thus the integrand is zero.

Compare with the transport equation. The left side of the expanded form is the same, ρt+v⋅∇ρ\rho_t + \vb{v}\cdot\grad\rho, the derivative of ρ\rho along characteristics. But the right side is no longer zero: −ρdiv⁡v-\rho\operatorname{div}\vb{v}. Where the field spreads (div⁡v>0\operatorname{div}\vb{v} > 0), density of what passes decreases; where it closes (div⁡v<0\operatorname{div}\vb{v} < 0), it concentrates. Divergence measures precisely that, the relative expansion rate of a volume following the flow.

InteractiveDensity transported by a field
  • trajectories evenly spaced in mass
  • ρ0\rho_0
  • ρ(⋅,t)\rho(\cdot, t) from the continuity equation
  • histogram of 1800 particles
  • red: div⁡v>0\operatorname{div} v > 0 (expands)
  • blue: div⁡v<0\operatorname{div} v < 0 (compresses)
1.00
Initial density
1.20
Mass ∫ρ  ⁣dx\int \rho\,\dd x (conserved)1.0000
Probe: ρ(x0,t)\rho(x_0, t)0.4568
Probe: velocity vv0.783
Probe: div⁡v\operatorname{div} v−0.622 (negative)
∂tρ\partial_t \rho−0.2370
∂x(ρv)\partial_x(\rho v)0.2370
∂tρ+∂x(ρv)\partial_t \rho + \partial_x(\rho v)1.5e-6
At the probe div⁡v=−0.62<0\operatorname{div} v = −0.62 < 0: the field contracts and density of the particle passing there increases at rate −ρdiv⁡v=0.284-\rho\operatorname{div} v = 0.284.
Nearly two thousand particles follow x′=v(x,t)x' = v(x, t). The histogram (pink) and blue curve, the continuity-equation solution calculated by characteristics, agree. In the bottom band red marks div⁡v>0\operatorname{div} v > 0 and blue div⁡v<0\operatorname{div} v < 0; arrows are vv. Move the yellow probe: readouts ∂tρ\partial_t \rho and ∂x(ρv)\partial_x(\rho v) are the equation's two terms, and sum to zero up to finite-difference error. With the pendulum, v=−asin⁡xv = -a\sin x, particles pile up at x=0x = 0 (where div⁡v<0\operatorname{div} v < 0) and empty out at x=±πx = \pm \pi. Try the final field, heat probability flow: which equation does density follow?

The figure illustrates the next result, giving the solution in terms of ODE x′=v(x,t)x' = \vb{v}(x, t).

Proof

Along a characteristic the chain rule gives  ⁣d ⁣dtρ(Xt,t)=ρt+∇ρ⋅v=−ρdiv⁡v\frac{\dd}{\dd t}\rho(\vb{X}_t, t) = \rho_t + \grad\rho\cdot\vb{v} = -\rho\operatorname{div}\vb{v}. This is a linear ODE in tt, y′=−a(t) yy' = -a(t)\,y with a(t)=div⁡v(Xt,t)a(t) = \operatorname{div}\vb{v}(\vb{X}_t, t), solved with integrating factor e∫ae^{\int a}. For total mass, determinant Jt=det⁡DXt(x0)J_t = \det D\vb{X}_t(\vb{x}_0) satisfies  ⁣d ⁣dtJt=div⁡v(Xt,t) Jt\frac{\dd}{\dd t}J_t = \operatorname{div}\vb{v}(\vb{X}_t, t)\,J_t with J0=1J_0 = 1 (Liouville’s formula), so the exponential factor is exactly 1/Jt1/J_t, and change of variables x=Xt(x0)\vb{x} = \vb{X}_t(\vb{x}_0) gives ∫ρ(x,t)  ⁣dx=∫ρ0(x0) Jt−1 Jt  ⁣dx0=∫ρ0\int\rho(\vb{x}, t)\,\dd\vb{x} = \int\rho_0(\vb{x}_0)\,J_t^{-1}\,J_t\,\dd\vb{x}_0 = \int\rho_0.

∎

In other words, ρ(⋅,t)\rho(\cdot, t) is the density obtained by pushing ρ0\rho_0 through diffeomorphism Xt\vb{X}_t: ρ(Xt(x0),t)=ρ0(x0)/∣det⁡DXt(x0)∣\rho(\vb{X}_t(\vb{x}_0), t) = \rho_0(\vb{x}_0)/\abs{\det D\vb{X}_t(\vb{x}_0)}, the density change-of-variables formula. The exponential and determinant versions coincide by Liouville’s formula.

This underlies flow-based generative models. Start with x0∼p0\vb{x}_0 \sim p_0 (a Gaussian) and integrate x˙=vθ(x,t)\dot{\vb{x}} = \vb{v}_\theta(\vb{x}, t) to t=1t = 1. Density of xt\vb{x}_t solves the continuity equation with field vθ\vb{v}_\theta, and the preceding formula in logarithms, log⁡p1(x1)=log⁡p0(x0)−∫01div⁡vθ  ⁣dt\log p_1(\vb{x}_1) = \log p_0(\vb{x}_0) - \int_0^1 \operatorname{div}\vb{v}_\theta\,\dd t, gives exact likelihood (instantaneous change of variables, seen in lesson 20). Flow matching (Lipman et al., 2023) trains vθ\vb{v}_\theta by regression so the density path is prescribed. If space has dimension dd, div⁡vθ\operatorname{div}\vb{v}_\theta is the trace of a d×dd\times d Jacobian and is usually estimated by Hutchinson’s estimator rather than calculated exactly.

Heat equation: diffusion

Heat flows from hot to cold, faster for larger differences: the empirical Fourier law says flux is proportional to gradient, q=−D ∇u\vb{q} = -D\,\grad u, with D>0D > 0 diffusivity. If energy is conserved, uu satisfies a continuity equation with flux q\vb{q}:

ut+div⁡q=0⟹ut=D div⁡(∇u)=D Δu,u_t + \operatorname{div}\vb{q} = 0 \quad\Longrightarrow\quad u_t = D\,\operatorname{div}(\grad u) = D\,\Delta u,

where Δu=∑i∂i2u=tr⁡(∇2u)\Delta u = \sum_i \partial_i^2 u = \tr(\grad^2 u) is the Laplacian. Rescaling time, s=Dts = Dt, allows D=1D = 1; in one dimension it is ut=uxxu_t = u_{xx}. The same equation governs concentration of a diffusing solute (Fick’s law) and density of a cloud of independent random-walking particles, as seen shortly.

Before solving it, experiment with it.

InteractiveHeat diffusion
  • u0u_0 (initial profile)
  • u(⋅,t)u(\cdot, t) by Fourier
  • Gt∗u0G_t * u_0 (convolution)
  • kernel at probe (arbitrary scale)
  • Brownian particles
  • bars: initial ∣u^(k)∣|\hat u(k)| (light) and current; curve: e−k2te^{-k^2 t}
0.200
Kernel width 2t\sqrt{2t}0.632
Total heat ∫u  ⁣dx\int u\,\dd x (conserved)3.3600
Maximum of uu0.839
Energy ∫u2  ⁣dx\int u^2\,\dd x (decreases)1.7677
Probe: u(x0,t)u(x_0, t) by Fourier0.8342
Probe: weighted average of u0u_00.8342
max⁡∣\max\lvert Fourier −- convolution∣\rvert1.0e-15
Paint an initial temperature and watch it diffuse. The blue curve is the Fourier-mode solution; dashed orange is the convolution of u0u_0 with a Gaussian of variance 2t2t: they agree up to rounding. Below, bars are frequency amplitudes: high frequencies die first, with factor e−k2te^{-k^2 t} shown on the curve. Try ‘comb’ and ‘almost a delta’. Drag the yellow probe: uu at x0x_0 is an average of u0u_0 weighted by a bell of width 2t\sqrt{2t}. Enable Brownian particles: clouds of points taking Gaussian steps of variance 2t2t reproduce the same curve. This is the forward process of a diffusion model.

Three clear facts from the figure: total heat is conserved, maximum height falls, and fine details disappear before coarse ones. To explain them, solve the equation.

The fundamental solution

On the line R\R, apply the Fourier transform in xx with convention u^(k,t)=∫u(x,t) e−ikx  ⁣dx\hat u(k, t) = \int u(x, t)\,e^{-ikx}\,\dd x. Differentiating with respect to xx multiplies by ikik, so uxxu_{xx} becomes −k2u^-k^2\hat u and the PDE becomes, for each kk, a separable ODE in tt:

u^t(k,t)=−k2 u^(k,t)⟹u^(k,t)=u^0(k) e−k2t.\hat u_t(k, t) = -k^2\,\hat u(k, t) \quad\Longrightarrow\quad \hat u(k, t) = \hat u_0(k)\,e^{-k^2 t}.

The partial derivative disappeared: the Fourier transform diagonalizes heat, each frequency evolves independently and is damped at its own rate k2k^2. This explains the figure’s bars. We must return to position space. A frequency product is a position convolution (convolution theorem), so find the function whose transform is e−k2te^{-k^2 t}:

Gt(x)=12π∫−∞∞e−k2t eikx  ⁣dkG_t(x) = \frac{1}{2\pi}\int_{-\infty}^{\infty} e^{-k^2 t}\,e^{ikx}\,\dd k
It is the inverse transform of e−k2te^{-k^2 t}.
1/4

Thus u^=u^0 G^t\hat u = \hat u_0\,\hat G_t and by the convolution theorem u=Gt∗u0u = G_t * u_0. This formula has transparent meaning: temperature at xx at time tt is the average of u0u_0 weighted by a Gaussian bell centered at xx with width 2t\sqrt{2t}. The figure’s yellow probe shows this. We must verify it solves the problem and under which hypotheses.

Proof

(1) Kernel GtG_t solves the heat equation for t>0t > 0 (direct verification, done in an exercise), and each derivative ∂tj∂xkGt(x−y)\partial_t^j\partial_x^k G_t(x - y), as a function of yy, is dominated by a common integrable function while tt ranges over an interval [ε,T][\varepsilon, T] with ε>0\varepsilon > 0 and xx a compact set. With u0u_0 bounded, Leibniz’s rule (dominated convergence) permits arbitrarily many derivatives under the integral, and ut−uxx=∫(∂t−∂x2)Gt(x−y) u0(y)  ⁣dy=0u_t - u_{xx} = \int(\partial_t - \partial_x^2)G_t(x - y)\,u_0(y)\,\dd y = 0.

(2) Since ∫Gt=1\int G_t = 1 (Gaussian integral, lesson 11), u(x,t)−u0(x)=∫Gt(z) [u0(x−z)−u0(x)]  ⁣dzu(x, t) - u_0(x) = \int G_t(z)\,[u_0(x - z) - u_0(x)]\,\dd z. Given ε>0\varepsilon > 0, uniform continuity on the compact gives δ\delta such that ∣u0(x−z)−u0(x)∣<ε\abs{u_0(x - z) - u_0(x)} < \varepsilon if ∣z∣<δ\abs{z} < \delta. Then ∣u(x,t)−u0(x)∣≤ε+2∥u0∥∞∫∣z∣>δGt(z)  ⁣dz=ε+2∥u0∥∞erfc⁡(δ/(2t))\abs{u(x, t) - u_0(x)} \le \varepsilon + 2\norm{u_0}_\infty\int_{\abs{z} > \delta} G_t(z)\,\dd z = \varepsilon + 2\norm{u_0}_\infty\operatorname{erfc}\big(\delta/(2\sqrt t)\big), and the tail tends to 00 with tt.

(3) uu is a weighted average of u0u_0 with positive weights summing to 11, giving the bounds; and ∫u  ⁣dx=∫ ⁣ ⁣∫Gt(x−y) u0(y)  ⁣dy  ⁣dx=∫u0\int u\,\dd x = \int\!\!\int G_t(x - y)\,u_0(y)\,\dd y\,\dd x = \int u_0 by Fubini. Uniqueness among bounded functions is a classical result from the maximum principle (below, for bounded domains) applied on increasing intervals, comparing with an auxiliary function growing at infinity; we do not develop it here.

∎

What the formula says

Representation u=Gt∗u0u = G_t * u_0 contains almost all qualitative diffusion behavior.

  • Instant smoothing. By (1), even if u0u_0 is discontinuous, u(⋅,t)u(\cdot, t) is C∞C^\infty for any t>0t > 0. For step u0=1[x>0]u_0 = \ind[x > 0] the solution is u=12[1+erf⁡(x/(2t))]u = \tfrac12\big[1 + \operatorname{erf}\big(x/(2\sqrt t)\big)\big], analytic, growing from 00 to 11 over width of order t\sqrt t. High frequencies are damped by e−k2te^{-k^2 t}, decaying faster than any power of kk.
  • Infinite propagation speed. If u0≥0u_0 \ge 0 is not identically zero, u(x,t)>0u(x, t) > 0 for every xx and t>0t > 0, however small tt and however far away xx. The amount arriving far away is tiny (like e−d2/4te^{-d^2/4t}) but not zero. This is a model property; in real heat conduction it is a harmless idealization because the distant amount is negligible.
  • Semigroup. Diffusing for ss then tt means diffusing for s+ts + t, because G^sG^t=e−k2se−k2t=G^s+t\hat G_s\hat G_t = e^{-k^2 s}e^{-k^2 t} = \hat G_{s+t}, i.e. Gs∗Gt=Gs+tG_s * G_t = G_{s+t} (variances add: 2s+2t2s + 2t). Consequently, if u0u_0 is the density of a N(0,σ02)\Normal(0, \sigma_0^2), u(⋅,t)u(\cdot, t) is that of a N(0,σ02+2t)\Normal(0, \sigma_0^2 + 2t). There is no G−tG_{-t}: heat cannot be undone; see the end.
  • Magnitude damping. By Plancherel, ∥u(⋅,t)∥22=12π∫∣u^0∣2e−2k2t  ⁣dk\norm{u(\cdot, t)}_2^2 = \tfrac{1}{2\pi}\int \abs{\hat u_0}^2 e^{-2k^2 t}\,\dd k decreases. Energy ∫u2  ⁣dx\int u^2\,\dd x in the figure falls, while ∫u  ⁣dx\int u\,\dd x is conserved.

The heat equation is also a disguised continuity equation. If u>0u > 0, ∇u=u ∇log⁡u\grad u = u\,\grad\log u, so

ut=Δu=div⁡(u ∇log⁡u)⟺ut+div⁡(u v)=0,v=−∇log⁡u.u_t = \Delta u = \operatorname{div}(u\,\grad\log u) \quad\Longleftrightarrow\quad u_t + \operatorname{div}\big(u\,\vb{v}\big) = 0, \qquad \vb{v} = -\grad\log u.

The diffusing density is exactly what deterministic velocity field v=−∇log⁡u\vb{v} = -\grad\log u would carry, moving particles from high-mass regions toward lower ones. These are two faces of a diffusion model: stochastic process xt=x0+2t z\vb{x}_t = \vb{x}_0 + \sqrt{2t}\,\vb{z} and the probability flow ODE x˙=−∇log⁡pt(x)\dot{\vb{x}} = -\grad\log p_t(\vb{x}) have the same marginal densities pt=Gt∗p0p_t = G_t * p_0 (Song et al., 2021). Diffusion models learn field ∇log⁡pt\grad\log p_t with a network and use it to traverse evolution backward. In the density-transport figure the last field is precisely this: particles follow an ODE without noise, and density matches the heat solution.

Maximum principle

For bounded domains no convolution formula is as simple, but a replacement property requires no solution.

Proof

First, if vt−vxx<0v_t - v_{xx} < 0 on (0,π)×(0,T](0, \pi) \times (0, T], vv does not attain its maximum on QQ at a point (x0,t0)(x_0, t_0) with 0<x0<π0 < x_0 < \pi, 0<t0≤T0 < t_0 \le T. At such a maximum, vxx≤0v_{xx} \le 0 (maximum in xx) and vt≥0v_t \ge 0 (maximum in tt, with one-sided derivative if t0=Tt_0 = T), hence vt−vxx≥0v_t - v_{xx} \ge 0, a contradiction. Now, for uu and ε>0\varepsilon > 0, v=u−εtv = u - \varepsilon t satisfies vt−vxx=−ε<0v_t - v_{xx} = -\varepsilon < 0. Then max⁡Qv=max⁡Γv≤max⁡Γu\max_Q v = \max_\Gamma v \le \max_\Gamma u and

max⁡Qu≤max⁡Qv+εT≤max⁡Γu+εT.\max_Q u \le \max_Q v + \varepsilon T \le \max_\Gamma u + \varepsilon T.

Letting ε→0\varepsilon \to 0, max⁡Qu≤max⁡Γu\max_Q u \le \max_\Gamma u.

∎

Applied to −u-u this gives the minimum principle. It yields uniqueness (the difference of solutions with identical data on Γ\Gamma has zero maximum and minimum) and continuous dependence: max⁡∣u−u~∣≤max⁡Γ∣u−u~∣\max\abs{u - \tilde u} \le \max_\Gamma\abs{u - \tilde u}. Forward heat is thus well posed. Energy gives another uniqueness proof, the final exercise.

Wave equation

A taut string has linear density μ\mu and tension τ\tau, with small vertical displacement u(x,t)u(x, t). For small angles the vertical force on a segment is τ uxx  ⁣dx\tau\,u_{xx}\,\dd x and mass μ  ⁣dx\mu\,\dd x, so μ utt=τ uxx\mu\,u_{tt} = \tau\,u_{xx}.

Being second order in tt it needs two initial data: position and velocity. To solve it, a change of variables reduces it to something trivial. With ξ=x−ct\xi = x - ct and η=x+ct\eta = x + ct (characteristic coordinates), ∂x=∂ξ+∂η\partial_x = \partial_\xi + \partial_\eta and ∂t=−c ∂ξ+c ∂η\partial_t = -c\,\partial_\xi + c\,\partial_\eta. Then

utt−c2uxx=c2(∂η−∂ξ)2u−c2(∂ξ+∂η)2u=−4c2 uξη.u_{tt} - c^2u_{xx} = c^2(\partial_\eta - \partial_\xi)^2u - c^2(\partial_\xi + \partial_\eta)^2u = -4c^2\,u_{\xi\eta}.

The equation is uξη=0u_{\xi\eta} = 0. Since ∂η(uξ)=0\partial_\eta(u_\xi) = 0, uξu_\xi depends only on ξ\xi, and integration gives u=F(ξ)+G(η)u = F(\xi) + G(\eta). Every solution is a sum of a right-traveling wave F(x−ct)F(x - ct) and left-traveling wave G(x+ct)G(x + ct), both at speed cc and unchanged in shape. Thus the wave equation is the product of two transport operators (∂t−c ∂x)(∂t+c ∂x)u=0(\partial_t - c\,\partial_x)(\partial_t + c\,\partial_x)u = 0: two families of characteristics x∓ct=ctex \mp ct = \text{cte}.

Proof

We know u=F(x−ct)+G(x+ct)u = F(x - ct) + G(x + ct). At t=0t = 0, F+G=fF + G = f and −cF′+cG′=g-cF' + cG' = g. From the first, F′+G′=f′F' + G' = f', and the second, G′−F′=g/cG' - F' = g/c; hence F′=12(f′−g/c)F' = \tfrac12(f' - g/c) and G′=12(f′+g/c)G' = \tfrac12(f' + g/c). Integrating from 00, F(s)=12f(s)−12c∫0sg+C1F(s) = \tfrac12 f(s) - \tfrac{1}{2c}\int_0^s g + C_1 and G(s)=12f(s)+12c∫0sg+C2G(s) = \tfrac12 f(s) + \tfrac{1}{2c}\int_0^s g + C_2, with C1+C2=0C_1 + C_2 = 0 because F+G=fF + G = f. Adding F(x−ct)+G(x+ct)F(x - ct) + G(x + ct) gives the formula. Conversely the formula has form F+GF + G with F,GF, G of class C2C^2 and satisfies the initial data, so it is a solution.

∎

Four consequences:

  • Domain of dependence. u(x,t)u(x, t) depends only on ff at [x−ct,x+ct][x - ct, x + ct] and gg on that interval. A perturbation localized at x0x_0 at t=0t = 0 is felt only in cone ∣x−x0∣≤ct\abs{x - x_0} \le ct: finite propagation speed, unlike heat.
  • No smoothing. If ff has a corner, traveling waves 12f(x∓ct)\tfrac12f(x \mp ct) preserve it. Singularities travel along characteristics, opposite to diffusion.
  • Energy conservation. E(t)=12∫(ut2+c2ux2)  ⁣dxE(t) = \tfrac12\int\big(u_t^2 + c^2u_x^2\big)\,\dd x does not change: E′=∫ut(utt−c2uxx)  ⁣dx+c2[uxut]E' = \int u_t(u_{tt} - c^2u_{xx})\,\dd x + c^2[u_xu_t] and both summands are zero (the equation; and ut=0u_t = 0 at fixed ends, or decay at infinity). Heat dissipates instead: the wave equation is time-reversible (if u(x,t)u(x, t) is a solution, so is u(x,−t)u(x, -t)), heat is not.
  • Fixed ends. On [0,L][0, L] with u(0,t)=u(L,t)=0u(0, t) = u(L, t) = 0, extend ff and gg oddly and 2L2L-periodically and apply d’Alembert: traveling waves bounce off ends reversing sign.
InteractiveWaves versus heat
12345678910mode m = 1, ..., 10
  • u(x,0)u(x, 0)
  • wave utt=uxxu_{tt} = u_{xx}
  • right-traveling: 12fodd(x−t)\tfrac12 f_{\text{odd}}(x - t)
  • left-traveling: 12fodd(x+t)\tfrac12 f_{\text{odd}}(x + t)
  • heat ut=κuxxu_t = \kappa u_{xx}
  • bars: initial bmb_m (gray), bmcos⁡mtb_m\cos mt (blue), bme−κm2tb_m e^{-\kappa m^2 t} (magenta)
1.10
0.70
0.25
Wave probe: u(x0,t)u(x_0, t)0 (exact)
Heat probe: u(x0,t)u(x_0, t)1.13e-2
Wave energy 12∫(ut2+ux2)  ⁣dx\tfrac12\int(u_t^2 + u_x^2)\,\dd x3.3247
Heat: ∫u2  ⁣dx\int u^2\,\dd x (decreases)0.0599
Maximum heat height0.240
The same initial pulse evolving under wave equation utt=uxxu_{tt} = u_{xx} (top) and heat equation ut=κ uxxu_t = \kappa\,u_{xx} with adjustable diffusivity κ\kappa (middle), with ends x=0x = 0 and x=πx = \pi fixed at zero. In the wave, the pulse splits into two half-height pieces traveling at speed 1 unchanged (orange and turquoise), bouncing off ends with reversed sign. In heat it widens and flattens. Drag the yellow probe to a region not yet reached: the wave reads exactly 0 while heat already has a small positive value, at every point however distant (infinite speed). The last graph, explained in separation of variables, shows each mode coefficient sin⁡mx\sin mx: oscillating for waves and decaying for heat. Try the plucked string and pure mode.

Laplace equation: equilibrium

If heat diffuses a long time with boundary temperature fixed, uu stops changing: ut=0u_t = 0. What remains is the equation of equilibria.

Plane examples: affine functions; x2−y2x^2 - y^2 and xyxy; excos⁡ye^x\cos y; log⁡x2+y2\log\sqrt{x^2 + y^2} outside the origin. All are, at least locally, the real or imaginary part of a holomorphic function f=u+ivf = u + iv (zz, z2z^2, eze^z, log⁡z\log z): Cauchy–Riemann equations ux=vyu_x = v_y, uy=−vxu_y = -v_x imply Δu=vyx−vxy=0\Delta u = v_{yx} - v_{xy} = 0. Functions Re⁡zn\operatorname{Re} z^n and Im⁡zn\operatorname{Im} z^n together with constants build all solutions on a disk (seen shortly); the interactive below uses those of n≤4n \le 4. In one dimension, u′′=0u'' = 0 means affine.

What the Laplacian measures

The Laplacian is the Hessian trace, the sum of curvatures along coordinate axes. Better, it is the difference between the value at a point and its neighbors’ mean:

Proof

By multivariable Taylor’s theorem, u(x0+h)=u(x0)+∇u⋅h+12h⊤∇2u h+o(r2)u(\vb{x}_0 + \vb{h}) = u(\vb{x}_0) + \grad u\cdot\vb{h} + \tfrac12\vb{h}\T\grad^2u\,\vb{h} + o(r^2) for ∣h∣=r\abs{\vb{h}} = r. Average over the sphere. By symmetry (h↦−h\vb{h} \mapsto -\vb{h}), mean h\vb{h} is 0\vb{0}. Mean hh⊤\vb{h}\vb{h}\T is r2nI\tfrac{r^2}{n}\mat{I}: cross terms vanish by symmetry hi↦−hih_i \mapsto -h_i, diagonal terms are equal by axis symmetry and sum to ∣h∣2=r2\abs{\vb{h}}^2 = r^2. Thus mean 12h⊤∇2u h\tfrac12\vb{h}\T\grad^2u\,\vb{h} is r22ntr⁡(∇2u)\tfrac{r^2}{2n}\tr(\grad^2u).

∎

Thus Δu>0\Delta u > 0 means uu at a point is below its neighborhood mean (a valley), and Δu<0\Delta u < 0 above it (a hill). A harmonic function has no hills or valleys: at every point it equals its neighborhood mean. This is exactly the next result, now exact and for every radius.

Proof

Let φ(s)=1∣Sn−1∣∫Sn−1u(x0+sω)  ⁣dσ(ω)\varphi(s) = \frac{1}{\abs{S^{n-1}}}\int_{S^{n-1}} u(\vb{x}_0 + s\vb{\omega})\,\dd\sigma(\vb{\omega}) be the mean over a sphere of radius s≤rs \le r. Differentiate under the integral and undo the change to the sphere of radius ss:

φ′(s)=1∣Sn−1∣∫Sn−1∇u(x0+sω)⋅ω  ⁣dσ=1∣Sn−1∣ sn−1∮∂Bs∂nu  ⁣dS=1∣Sn−1∣ sn−1∫BsΔu  ⁣dx=0,\varphi'(s) = \frac{1}{\abs{S^{n-1}}}\int_{S^{n-1}}\grad u(\vb{x}_0 + s\vb{\omega})\cdot\vb{\omega}\,\dd\sigma = \frac{1}{\abs{S^{n-1}}\,s^{n-1}}\oint_{\partial B_s}\partial_n u\,\dd S = \frac{1}{\abs{S^{n-1}}\,s^{n-1}}\int_{B_s}\Delta u\,\dd\vb{x} = 0,

by the divergence theorem applied to ∇u\grad u. Thus φ\varphi is constant, and since φ(s)→u(x0)\varphi(s) \to u(\vb{x}_0) as s→0s \to 0 by continuity, φ≡u(x0)\varphi \equiv u(\vb{x}_0). The ball mean follows by integrating in ss with weight sn−1s^{n-1} (spherical coordinates, lesson 11).

∎
Proof

Let M=max⁡Ω‾uM = \max_{\overline\Omega}u be attained at x0∈Ω\vb{x}_0 \in \Omega. For a small ball with Br(x0)‾⊂Ω\overline{B_r(\vb{x}_0)} \subset \Omega, M=u(x0)M = u(\vb{x}_0) is the mean of u≤Mu \le M over it; a mean of numbers ≤M\le M equaling MM forces all to equal MM (the function is continuous). Thus u=Mu = M on the ball. Set {u=M}\{u = M\} is then open in Ω\Omega, closed by continuity and nonempty, and Ω\Omega is connected: it is all Ω\Omega.

∎

Consequences are familiar: the Dirichlet problem Δu=0\Delta u = 0 in Ω\Omega, u=gu = g on ∂Ω\partial\Omega has at most one solution (the difference has zero maximum and minimum) and depends continuously on the data, max⁡∣u−u~∣≤max⁡∣g−g~∣\max\abs{u - \tilde u} \le \max\abs{g - \tilde g}. It is well posed. For the unit disk the solution also has a formula in the boundary data’s Fourier series g(θ)=a02+∑n(ancos⁡nθ+bnsin⁡nθ)g(\theta) = \tfrac{a_0}{2} + \sum_n(a_n\cos n\theta + b_n\sin n\theta):

u(r,θ)=a02+∑n=1∞rn(ancos⁡nθ+bnsin⁡nθ).u(r, \theta) = \frac{a_0}{2} + \sum_{n=1}^\infty r^n\big(a_n\cos n\theta + b_n\sin n\theta\big).

Each rncos⁡nθ=Re⁡znr^n\cos n\theta = \operatorname{Re}z^n and rnsin⁡nθ=Im⁡znr^n\sin n\theta = \operatorname{Im}z^n is harmonic, and for r≤r0<1r \le r_0 < 1 the series and its derivative series converge uniformly (coefficients are bounded), so the sum is harmonic on the open disk. That it also takes the boundary data, u(r,θ)→g(θ)u(r, \theta) \to g(\theta) uniformly as r→1−r \to 1^- if gg is continuous, is not immediate (a continuous gg Fourier series need not converge at r=1r = 1): prove it by writing uu as the convolution of gg with the Poisson kernel, analogous to part (2) of the heat theorem. Each boundary mode is “damped” toward the interior as rnr^n, faster modes first: the stationary version of heat smoothing.

InteractiveHarmonic functions on the disk
  • red: u>0u > 0 (warm), blue: u<0u < 0 (cold)
  • probe circle and its sample points
  • boundary data g(θ)g(\theta) versus angle θ∈[0,2π]\theta \in [0, 2\pi] (draggable points)
Function
0.55
uu at the center0.38050
Average of uu on the circle0.38050
Average −- center0
Δu\Delta u at the center (finite differences)−1e-12
Max / min in the interior1.699 / −1.299
Max / min on the boundary1.723 / −1.323
The average of uu over a circle of radius 0.55 equals uu at its center, for every circle. Thus uu cannot have an interior maximum: its center would exceed its average. Max in disk: 1.699; max on boundary: 1.723.
Drag orange points in the lower plot to set temperature at the disk boundary; the interior is the unique harmonic function with those data. Move the dotted circle's center and change its radius: the mean of uu over the circle matches uu at its center, and the displayed difference is rounding (mean-value property). Interior maximum and minimum never exceed boundary extrema (maximum principle). Switch to ‘Nonharmonic’: with u=x2−0.2u = x^2 - 0.2, Δu=2\Delta u = 2 and the mean over a radius-rr circle exceeds its center by r2Δu/4r^2\Delta u/4.

Separation of variables

We solved heat and waves on the whole line. An interval with fixed ends has no equally simple formula, but linearity lets a method turn the PDE into two ODEs. Seek separated-variable solutions u(x,t)=X(x) T(t)u(x, t) = X(x)\,T(t), then add them.

Take heat on [0,π][0, \pi] with Dirichlet conditions u(0,t)=u(π,t)=0u(0, t) = u(\pi, t) = 0. Substitute u=XTu = XT in ut=uxxu_t = u_{xx} and divide by XTXT,

T′(t)T(t)=X′′(x)X(x).\frac{T'(t)}{T(t)} = \frac{X''(x)}{X(x)}.

The left side depends only on tt and the right only on xx, and they are equal for every (x,t)(x, t): both are one constant −λ-\lambda. The PDE separates into ODEs T′=−λTT' = -\lambda T and X′′+λX=0X'' + \lambda X = 0, with boundaries forcing X(0)=X(π)=0X(0) = X(\pi) = 0. For which λ\lambda does this eigenvalue problem have a solution X≠0X \ne 0?

  • λ≤0\lambda \le 0: solutions of X′′=−λXX'' = -\lambda X are combinations of cosh⁡(−λ x)\cosh(\sqrt{-\lambda}\,x) and sinh⁡(−λ x)\sinh(\sqrt{-\lambda}\,x) (or affine if λ=0\lambda = 0), and condition X(0)=0X(0) = 0 leaves only sinh⁡\sinh or xx, nonzero at π\pi. Only X≡0X \equiv 0.
  • λ>0\lambda > 0: X=Acos⁡(λ x)+Bsin⁡(λ x)X = A\cos(\sqrt\lambda\,x) + B\sin(\sqrt\lambda\,x); X(0)=0X(0) = 0 gives A=0A = 0 and X(π)=0X(\pi) = 0 requires sin⁡(λ π)=0\sin(\sqrt\lambda\,\pi) = 0, i.e. λ=m∈N\sqrt\lambda = m \in \N.

Only values λm=m2\lambda_m = m^2 are possible, with Xm(x)=sin⁡mxX_m(x) = \sin mx. The separable time equation gives Tm=e−m2tT_m = e^{-m^2t}. Each e−m2tsin⁡mxe^{-m^2t}\sin mx solves the equation with zero boundary. By linearity any combination does too, and that is the method.

For heat: u(x,t)=∑m≥1bm e−m2tsin⁡mxu(x, t) = \sum_{m \ge 1}b_m\,e^{-m^2t}\sin mx, and at t=0t = 0 it must be f(x)=∑bmsin⁡mxf(x) = \sum b_m\sin mx: the Fourier sine series of ff. Functions sin⁡mx\sin mx are orthogonal on L2(0,π)L^2(0, \pi), with ∫0πsin⁡mxsin⁡nx  ⁣dx=π2δmn\int_0^\pi\sin mx\sin nx\,\dd x = \tfrac\pi2\delta_{mn}, so

bm=2π∫0πf(x) sin⁡mx  ⁣dx.b_m = \frac{2}{\pi}\int_0^\pi f(x)\,\sin mx\,\dd x.

For the wave, T′′=−c2m2TT'' = -c^2m^2T gives cos⁡(mct)\cos(mct) and sin⁡(mct)\sin(mct), and

u(x,t)=∑m≥1(bmcos⁡(mct)+dmmcsin⁡(mct))sin⁡mx,dm=2π∫0πg(x)sin⁡mx  ⁣dx.u(x, t) = \sum_{m \ge 1}\Big(b_m\cos(mct) + \frac{d_m}{mc}\sin(mct)\Big)\sin mx, \qquad d_m = \frac2\pi\int_0^\pi g(x)\sin mx\,\dd x.

These are standing waves on a guitar string: mode mm vibrates at frequency mc/(2π)mc/(2\pi), and harmonics are integer multiples of the fundamental. The final graph in the wave-versus-heat figure shows this: in the wave each bmb_m oscillates with cos⁡(mt)\cos(mt) (blue bars); in heat it decays with e−κm2te^{-\kappa m^2t} (magenta; the figure uses ut=κ uxxu_t = \kappa\,u_{xx} with adjustable diffusivity κ\kappa, each mode mm decaying at rate κm2\kappa m^2). For example, the plucked string at x=ax = a (a triangle of height 1) has bm=2sin⁡(ma)m2 a (π−a)b_m = \dfrac{2\sin(ma)}{m^2\,a\,(\pi - a)}, decaying as 1/m21/m^2 because ff has a corner.

Proof

Coefficients are bounded, ∣bm∣≤B=2π∫∣f∣\abs{b_m} \le B = \tfrac2\pi\int\abs f. For t≥εt \ge \varepsilon, the mm-th term differentiated ii times in tt and jj times in xx is bounded by B m2i+je−m2εB\,m^{2i + j}e^{-m^2\varepsilon}, which is summable. By Weierstrass’s MM test all derivative series converge uniformly on t≥εt \ge \varepsilon, and termwise differentiation is legitimate: u∈C∞u \in C^\infty and, since each term satisfies the equation and boundary conditions, uu does too. For initial data, by Parseval ∥u(⋅,t)−f∥22=π2∑bm2(1−e−m2t)2\norm{u(\cdot, t) - f}_2^2 = \tfrac\pi2\sum b_m^2(1 - e^{-m^2t})^2; each term tends to 00 and is dominated by summable bm2b_m^2, so the sum tends to 00.

∎

This proof explains smoothing through coefficients: factor e−m2te^{-m^2t} crushes all but a few, so the solution increasingly resembles its first mode. Heat smooths data instantly. Waves have no damping (∣cos⁡(mct)∣≤1\abs{\cos(mct)} \le 1): coefficients do not decay and the series converges only as well as the data series, so corners persist. The wave figure shows this with the plucked string.

Ill-posedness: blurring is easy, sharpening is hard

All this points to asymmetry. Forward heat smooths and damps; backward it would have to unsmooth. Suppose temperature u(⋅,T)u(\cdot, T) is known and initial u0u_0 sought (blur an image then refocus it). In modes, bm(0)=bm(T) e+m2Tb_m(0) = b_m(T)\,e^{+m^2T}: multiply each coefficient by something growing as em2Te^{m^2T}.

The problem lacks continuous dependence. If data u(⋅,T)u(\cdot, T) are perturbed by arbitrarily small error εsin⁡mx\varepsilon\sin mx, the solution changes by ε em2Tsin⁡mx\varepsilon\,e^{m^2T}\sin mx. With T=0.1T = 0.1, ε=10−8\varepsilon = 10^{-8} and m=15m = 15, data perturbation has size 10−810^{-8} and solution error 10−8 e22.5≈5910^{-8}\,e^{22.5} \approx 59. Measurement noise is not even needed: floating-point rounding 10−1610^{-16} suffices for reconstruction to become garbage above a certain frequency.

InteractiveBlurring is easy, sharpening is hard
reconstruction off scale (max. 3e77)
  • u0u_0 original
  • measured: u(⋅,T)u(\cdot, T) with noise
  • backward reconstruction
  • measured signal ∣u^(k,T)∣|\hat u(k, T)| (with noise)
  • noiseless signal
  • reconstruction ∣u^(k,T)∣ ek2T|\hat u(k, T)|\,e^{k^2 T}
0.080
1e-9
no cutoff
Maximum amplification eK2Te^{K^2 T}6.1e87
Noise level per mode1.2e-10
Optimal cutoff k∗k_* (signal = noise)14.5
Relative error ∥urec−u0∥/∥u0∥\lVert u_{\text{rec}} - u_0\rVert / \lVert u_0\rVert7e77
Without cutoff the reconstruction is garbage: mode k=50.3k = 50.3 is multiplied by ek2T≈1088e^{k^2T} \approx 10^{88}, amplifying the noise. Try lowering ε\varepsilon to 10−1510^{-15}: machine rounding alone is enough to spoil it.
The blue profile is the original after diffusing for time TT and adding noise of size ε\varepsilon; red is what results from undoing diffusion by multiplying each mode by ek2Te^{k^2T}. Without cutoff and with initial T=0.08T = 0.08, reconstruction is useless even with noise 10−1210^{-12}. On the logarithmic plot, measured signal (blue) falls to the flat noise level, and beyond it amplification (red) only rises. Lower cutoff frequency KK or press ‘Optimal cutoff’, placing it where signal and noise match: high-frequency information is lost but the rest recovered. Increase TT and see how much worse it gets.

The same phenomenon occurs in the Laplace Cauchy problem, Hadamard’s ill-posedness example. Functions un(x,y)=sin⁡(nx)sinh⁡(ny)n2u_n(x, y) = \dfrac{\sin(nx)\sinh(ny)}{n^2} are harmonic (Δun=(−n2+n2) un=0\Delta u_n = (-n^2 + n^2)\,u_n = 0), satisfy un(x,0)=0u_n(x, 0) = 0 and ∂yun(x,0)=sin⁡nxn\partial_yu_n(x, 0) = \dfrac{\sin nx}{n}. Data tend to 00 as n→∞n \to \infty, but at y=1y = 1 the solution measures sinh⁡(n)/n2→∞\sinh(n)/n^2 \to \infty. The disk Dirichlet problem with data on the whole boundary is instead well posed (maximum principle). Type matters: elliptic problems use boundary conditions on the whole boundary, evolution problems initial data in the properly oriented direction.

What if diffusion really must be inverted (deblurring an image, finding a pollutant source)? Regularize: discard frequencies where signal is below noise (spectral cutoff, as in the figure), or damp gain with a Wiener or Tikhonov filter. No algorithm can avoid that loss. Deep learning has a version of this observation. Reversing a diffusion model’s forward process requires information destroyed by the heat equation: the data distribution. A diffusion model learns it as score ∇log⁡pt\grad\log p_t, acting as a regularizer (Anderson, 1982; Song et al., 2021). Without it, the backward path is unstable.

Implementation from scratch

The first cell solves heat on [0,π][0, \pi] by separation of variables and checks numerically what was proved: the exercise statement’s example, the convolution relationship (kernel formula matches the sine series only far from boundaries, and exactly with boundary-enforcing images), semigroup property, and each mode’s −m2-m^2 decay rate.

[ ]Heat by Fourier and convolutionBrowser
import numpy as np

# Intervalo [0, pi], extremos a cero: serie de senos truncada
def coef_senos(f, M, n=4000):
    x = (np.arange(n) + 0.5) * np.pi / n              # regla del punto medio
    h = np.pi / n
    return np.array([2 / np.pi * np.sum(f(x) * np.sin(m * x)) * h for m in range(1, M + 1)])

def calor_senos(b, x, t):
    m = np.arange(1, len(b) + 1)
    return (b * np.exp(-m**2 * t)) @ np.sin(np.outer(m, x))

f = lambda x: np.sin(x) + 0.5 * np.sin(3 * x)
b = coef_senos(f, 8)
print("coeficientes b_1..b_4:", np.round(b[:4], 6))
print("u(pi/2, 1) =", calor_senos(b, np.array([np.pi / 2]), 1.0)[0], " exacto:", np.exp(-1) - 0.5 * np.exp(-9))

# Núcleo del calor y método de las imágenes
G = lambda x, t: np.exp(-x**2 / (4 * t)) / np.sqrt(4 * np.pi * t)

s0 = 0.2
bump = lambda x: np.exp(-(x - 1.3)**2 / (2 * s0**2))
b = coef_senos(bump, 80)
x = np.linspace(0, np.pi, 301)
y = (np.arange(3000) + 0.5) * np.pi / 3000
dy = np.pi / 3000
print("\nt      |Fourier - recta|   |Fourier - imágenes|")
for t in [0.01, 0.05, 0.2, 0.5]:
    u_f = calor_senos(b, x, t)
    u0 = bump(y)
    u_r = np.array([np.sum(G(xi - y, t) * u0) * dy for xi in x])               # u0 extendida con ceros fuera de [0, pi]
    u_i = np.array([sum(np.sum((G(xi - y + 2 * np.pi * k, t) - G(xi + y + 2 * np.pi * k, t)) * u0) * dy
                        for k in range(-2, 3)) for xi in x])                    # extensión impar y 2 pi periódica
    print(f"{t:<6} {np.max(np.abs(u_f - u_r)):.2e}          {np.max(np.abs(u_f - u_i)):.2e}")

# Semigrupo: G_s * G_t = G_{s+t}
xs = np.linspace(-20, 20, 4001)
h = xs[1] - xs[0]
conv = np.convolve(G(xs, 0.3), G(xs, 0.5), mode="same") * h
print("\nmax |G_0.3 * G_0.5 - G_0.8| =", np.max(np.abs(conv - G(xs, 0.8))))

# Decaimiento de cada modo: pendiente de log b_m(t) frente a t
ts = np.array([0.02, 0.04, 0.06, 0.08])
rows = np.array([coef_senos(lambda z, t=t: calor_senos(b, z, t), 3) for t in ts])
for m in range(3):
    pend = np.polyfit(ts, np.log(np.abs(rows[:, m])), 1)[0]
    print(f"modo {m + 1}: pendiente medida {pend:.4f}   -m^2 = {-(m + 1)**2}")

# Autovalores del laplaciano discreto con extremos a cero (el operador simétrico de la intuición anterior)
n = 60
hh = np.pi / (n + 1)
A = (2 * np.eye(n) - np.eye(n, k=1) - np.eye(n, k=-1)) / hh**2
lam = np.linalg.eigvalsh(A)
print("\nautovalores de -d2/dx2 discreto:", np.round(lam[:5], 4), " frente a m^2 = 1, 4, 9, 16, 25")

The first result reproduces u(π/2,1)=e−1−12e−9=0.367818u(\pi/2, 1) = e^{-1} - \tfrac12e^{-9} = 0.367818. The difference table tells a story: the whole-line solution (pulse surrounded by zeros) and sine series agree only while heat has not reached the ends, differences growing from 6×10−76\times 10^{-7} at t=0.01t = 0.01 to 0.090.09 at t=0.5t = 0.5; boundary-enforcing images give rounding-order agreement 10−1610^{-16} for all tt. This is the method of images: heat with Dirichlet boundary is convolution with the heat kernel of the odd 2π2\pi-periodic extension of data, as d’Alembert said for waves. Slopes are −1-1, −4-4 and −9-9: each mode decays with its −m2-m^2. Discrete Laplacian eigenvalues 0.99980.9998, 3.99653.9965, 8.98218.9821, 15.943515.9435, 24.862224.8622 increasingly differ from m2m^2 as mm grows: the discrete operator sees only low frequencies well.

The second cell uses scipy.integrate.solve_ivp for characteristics: transports a profile by current c(x)=1+x/2c(x) = 1 + x/2 integrating x′=c(x)x' = c(x) backward, compares with the exact formula, and carries a cloud of 200 000200\,000 particles through field v=−sin⁡xv = -\sin x to see its histogram follow the continuity equation. For density, integrate pair (X,I)(X, I) backward with I′=div⁡vI' = \operatorname{div}v.

[ ]Characteristics and density transportBrowser
import numpy as np
from scipy.integrate import solve_ivp

# 1. Transporte u_t + c(x) u_x = 0 con c(x) = 1 + x/2: u(x, t) = u0(pie de la característica)
c = lambda x: 1.0 + 0.5 * x
u0 = lambda x: np.exp(-((x + 1.0) / 0.6) ** 2)

def transporte(u0, c, x, t):
    """u(x, t): se integra x' = c(x) hacia atrás, de t a 0, para todos los x a la vez."""
    if t == 0:
        return u0(x)
    sol = solve_ivp(lambda s, y: c(y), (t, 0.0), x, rtol=1e-10, atol=1e-12)
    return u0(sol.y[:, -1])

x = np.linspace(-3, 6, 7)
t = 2.0
exacta = u0((x + 2.0) * np.exp(-t / 2) - 2.0)           # x(t) = (x0 + 2) e^{t/2} - 2
print("error del transporte:", np.max(np.abs(transporte(u0, c, x, t) - exacta)))

# 2. Densidad transportada por v(x, t) = -sin x: partículas frente a la ecuación de continuidad
v = lambda x, t: -np.sin(x)
dv = lambda x, t: -np.cos(x)
rho0 = lambda x: np.exp(-0.5 * x**2) / np.sqrt(2 * np.pi)

rng = np.random.default_rng(0)
x0 = rng.normal(size=200_000)
T = 1.5
sol = solve_ivp(lambda s, y: v(y, s), (0, T), x0, rtol=1e-8, atol=1e-10)
xT = sol.y[:, -1]

def densidad(x, T):
    """rho(x, T) = rho0(pie) exp(-int div v): se integra hacia atrás el par (X, I)."""
    def f(s, z):
        X = z[: len(x)]
        return np.concatenate([v(X, s), dv(X, s)])        # I' = div v a lo largo de la característica
    z = solve_ivp(f, (T, 0.0), np.concatenate([x, np.zeros_like(x)]), rtol=1e-10, atol=1e-12).y[:, -1]
    return rho0(z[: len(x)]) * np.exp(z[len(x):])         # integrar de T a 0 cambia el signo de I

edges = np.linspace(-3, 3, 31)
hist, _ = np.histogram(xT, bins=edges, density=True)
# el histograma promedia la densidad en cada intervalo: se compara con la media de rho sobre él (Simpson, 3 nodos)
a, b_ = edges[:-1], edges[1:]
media = (densidad(a, T) + 4 * densidad(0.5 * (a + b_), T) + densidad(b_, T)) / 6
print("max |histograma - media de rho por intervalo| =", np.max(np.abs(hist - media)))
print("rho(0, T) =", densidad(np.array([0.0]), T)[0], "  rho0(0) =", rho0(0.0))

# 3. Residuo de la ecuación de continuidad por diferencias finitas
xs = np.linspace(-2.5, 2.5, 6)
h = 1e-4
rt = (densidad(xs, T + h) - densidad(xs, T - h)) / (2 * h)
flujo = lambda z: densidad(z, T) * v(z, T)
fx = (flujo(xs + h) - flujo(xs - h)) / (2 * h)
print("residuo max |rho_t + (rho v)_x| =", np.max(np.abs(rt + fx)))

Transport agrees with the exact formula to 10−1110^{-11}. The histogram of 200 000200\,000 particles differs from continuity-equation density by 0.0060.006, order of sampling noise for a histogram that size. And ρ(0,1.5)=1.788=ρ0(0) e1.5\rho(0, 1.5) = 1.788 = \rho_0(0)\,e^{1.5}: since 00 is a field fixed point (v(0)=0v(0) = 0) where div⁡v=−1\operatorname{div} v = -1, density there grows exactly as e−∫div⁡v=ete^{-\int\operatorname{div}v} = e^{t}. Equation residual is order 10−910^{-9}.

Practical PDEs are classified by signs of eigenvalues of A\mat{A}, automated by this short cell.

[ ]Classifying a second-order PDEBrowser
import numpy as np

def tipo(A, tol=1e-12):
    """Tipo de la parte principal sum a_ij d_i d_j u según los signos de los autovalores de A (simétrica)."""
    w = np.linalg.eigvalsh(np.asarray(A, dtype=float))
    pos, neg, cero = int((w > tol).sum()), int((w < -tol).sum()), int((np.abs(w) <= tol).sum())
    if cero == 0 and (pos == 0 or neg == 0):
        return "elíptica"
    if cero == 0 and min(pos, neg) == 1:
        return "hiperbólica"
    if cero == 1 and (pos == 0 or neg == 0):
        return "parabólica"
    return "otro tipo"

sigma = 0.3
casos = {
    "Laplace  u_xx + u_yy = 0":                       [[1, 0], [0, 1]],
    "calor  u_t - u_xx = 0  (x, t)":                  [[-1, 0], [0, 0]],
    "ondas  u_tt - u_xx = 0  (x, t)":                 [[-1, 0], [0, 1]],
    "Black-Scholes en S = 2  (S, t)":                 [[0.5 * sigma**2 * 2**2, 0], [0, 0]],
    "u_xx + 4 u_xy + u_yy = 0":                       [[1, 2], [2, 1]],
    "Poisson en 3D":                                  np.eye(3),
}
for nombre, A in casos.items():
    print(f"{nombre:50s} autovalores {np.round(np.linalg.eigvalsh(np.asarray(A, float)), 3)}  ->  {tipo(A)}")

a, b, c = 1, 2, 1
print("\nb^2 - ac =", b * b - a * c, "(> 0: hiperbólica)")

Finally, symbolic verification of identities used: GtG_t solves heat, F(x−ct)+G(x+ct)F(x - ct) + G(x + ct) solves waves, Re⁡zn\operatorname{Re}z^n are harmonic, and e−m2tsin⁡mxe^{-m^2t}\sin mx solves heat.

[ ]Symbolic verificationBrowser
import sympy as sp

x, t, c = sp.symbols("x t c", positive=True)
G = sp.exp(-x**2 / (4 * t)) / sp.sqrt(4 * sp.pi * t)
print("G_t es solución del calor:", sp.simplify(sp.diff(G, t) - sp.diff(G, x, 2)) == 0)

F, H = sp.Function("F"), sp.Function("H")
u = F(x - c * t) + H(x + c * t)
print("d'Alembert resuelve u_tt = c^2 u_xx:", sp.simplify(sp.diff(u, t, 2) - c**2 * sp.diff(u, x, 2)) == 0)

X, Y = sp.symbols("X Y", real=True)
for n in range(1, 5):
    w = sp.expand(sp.re(sp.expand((X + sp.I * Y) ** n)))
    print(f"Re z^{n} = {w}   laplaciano = {sp.simplify(sp.diff(w, X, 2) + sp.diff(w, Y, 2))}")

m = sp.symbols("m", positive=True, integer=True)
modo = sp.exp(-m**2 * t) * sp.sin(m * x)
print("modo e^(-m^2 t) sin(m x) resuelve el calor:", sp.simplify(sp.diff(modo, t) - sp.diff(modo, x, 2)) == 0)

The professional version

FFT and filters suffice for periodic profiles and regular grids. scipy.fft.rfft implements exactly “multiply each mode by e−k2te^{-k^2t}”, and scipy.ndimage.gaussian_filter1d is Gaussian blur, i.e. convolution with GtG_t for σ=2t/Δx\sigma = \sqrt{2t}/\Delta x (in pixels).

ToolWhat it doesUse here
scipy.fft.rfft / irfft, rfftfreqreal Fourier transform and wave numberssolve periodic heat and waves by modes
scipy.ndimage.gaussian_filter1d (and gaussian_filter in 2D)Gaussian blur with σ\sigma in pixelsimage diffusion and scale space (m16)
scipy.integrate.solve_ivperror-controlled ODE integratorcharacteristics and particle flows
sympy (diff, simplify, dsolve, pdsolve)symbolic algebracheck solutions and study simple PDEs
torch.nn.functional.conv1d / conv2dconvolutiona Gaussian blur layer is diffusion
[ ]Gaussian blur versus FourierBrowser
import numpy as np
from scipy.ndimage import gaussian_filter1d
from scipy.fft import rfft, irfft, rfftfreq

# Perfil periódico en [-8, 8): dos escalones suavizados
N, L = 512, 8.0
x = -L + 2 * L * np.arange(N) / N
dx = x[1] - x[0]
u0 = 0.5 * (np.tanh((x + 4) / 0.1) - np.tanh((x + 1) / 0.1)) + 0.5 * (np.tanh((x - 1) / 0.1) - np.tanh((x - 3) / 0.1))

t = 0.2
k = 2 * np.pi * rfftfreq(N, d=dx)                       # números de onda
u_fourier = irfft(rfft(u0) * np.exp(-k**2 * t), n=N)    # cada modo se multiplica por e^{-k^2 t}
u_blur = gaussian_filter1d(u0, sigma=np.sqrt(2 * t) / dx, mode="wrap", truncate=8.0)   # desenfoque gaussiano, sigma^2 = 2t

print("max |Fourier - gaussian_filter1d| =", np.max(np.abs(u_fourier - u_blur)))
print("calor total antes y después:", u0.sum() * dx, u_fourier.sum() * dx)
print("máximo antes y después:", u0.max(), u_fourier.max())

Both Fourier and filter approaches agree to 10−1510^{-15}. A Gaussian filter has σ\sigma in pixels, while its relation to physical time is σreal=2t\sigma_{\text{real}} = \sqrt{2t}: image blur is the heat equation evolved to t=σ2/2t = \sigma^2/2. Total heat is conserved and the maximum decreases, as the theorem and maximum principle predict.

Common mistakes

Exercises

NumericHeat with two modes
For ut=uxxu_t = u_{xx} on [0,π][0, \pi] with u=0u = 0 at the ends and u(x,0)=sin⁡x+0.5sin⁡3xu(x, 0) = \sin x + 0.5\sin 3x, calculate u(π/2,1)u(\pi/2, 1).
NumericHeight of a diffusing Gaussian
The initial density of ut=uxxu_t = u_{xx} on R\R is that of a N(0,1)\Normal(0, 1). What is u(0,1.5)u(0, 1.5)?
QuizClassifying PDEs
Which classifications are correct?

More than one answer may be correct.

NumericThe first shock
For Burgers' equation ut+u ux=0u_t + u\,u_x = 0 with u0(x)=1/(1+x2)u_0(x) = 1/(1 + x^2), at what time t∗t_* do characteristics first cross?
NumericDensity under dilation
Initial density ρ0=N(0,1)\rho_0 = \Normal(0, 1) is carried by field v(x)=0.5 xv(x) = 0.5\,x. Solve the continuity equation: what is ρ(0,2)\rho(0, 2)?
QuizDivergence and density
A one-dimensional velocity field satisfies v′(x)>0v'(x) > 0 in a region. Which statements about the continuity-equation solution are true?

More than one answer may be correct.

NumericThe average over a circle
Calculate the mean of u(x,y)=x2+y2u(x, y) = x^2 + y^2 over the circle of radius 22 centered at (1,1)(1, 1).
NumericA value via d'Alembert
Solve utt=uxxu_{tt} = u_{xx} on R\R with u(x,0)=e−x2u(x, 0) = e^{-x^2} and ut(x,0)=0u_t(x, 0) = 0. What is u(0,2)u(0, 2)?
NumericHow long a mode takes to die out
In ut=uxxu_t = u_{xx} on [0,π][0, \pi] with u=0u = 0 at the ends, mode sin⁡3x\sin 3x has initial amplitude 11. At what time tt does its amplitude fall to 1 %1\,\%?
QuizWell posed or ill posed?
Which problems are well posed in Hadamard's sense?

More than one answer may be correct.

ProofThe heat kernel solves heat
Prove: Kernel Gt(x)=(4πt)−1/2e−x2/(4t)G_t(x) = (4\pi t)^{-1/2}e^{-x^2/(4t)} satisfies ∂tGt=∂x2Gt\partial_tG_t = \partial_x^2G_t for t>0t > 0, and ∫RGt  ⁣dx=1\int_{\R}G_t\,\dd x = 1.
0
Write G=Gt(x)G = G_t(x) for brevity and differentiate carefully: the exponent depends on both xx and tt.

Step 1 of 4. What is ∂xG\partial_xG?

ProofHeat uniqueness by the energy method
Prove: If u1u_1 and u2u_2 solve ut=uxxu_t = u_{xx} on (0,π)×(0,T](0, \pi) \times (0, T], continuous with derivatives up to the boundary, with ui(x,0)=f(x)u_i(x, 0) = f(x) and ui(0,t)=ui(π,t)=0u_i(0, t) = u_i(\pi, t) = 0, then u1=u2u_1 = u_2.
0
Let w=u1−u2w = u_1 - u_2. It solves wt=wxxw_t = w_{xx} with w(x,0)=0w(x, 0) = 0 and w=0w = 0 at the ends. Define energy E(t)=∫0πw2  ⁣dxE(t) = \int_0^\pi w^2\,\dd x.

Step 1 of 4. What is E′(t)E'(t)?

CodeTransport by characteristics
Implement transport_by_characteristics(u0, c, x_grid, t), returning an array of u(x,t)u(x, t) for equation ut+c(x) ux=0u_t + c(x)\,u_x = 0, u(x,0)=u0(x)u(x, 0) = u_0(x), at points in x_grid. Integrate ODE x′=c(x)x' = c(x) backward, from time tt to 00, to find the foot of characteristic Φ−t(x)\Phi_{-t}(x) for each point, and evaluate u0 there. Use scipy.integrate.solve_ivp with rtol=1e-10, atol=1e-12. Functions u0 and c act elementwise on NumPy arrays; c returns an array with the same shape as its argument.
import numpy as np
from scipy.integrate import solve_ivp

def transport_by_characteristics(u0, c, x_grid, t):
  """u(x, t) para u_t + c(x) u_x = 0 con u(x, 0) = u0(x), evaluada en x_grid."""
  x = np.asarray(x_grid, dtype=float)
  # tu código: pie de la característica de cada x y evaluación de u0 en él
  return u0(x)
Shift+Enter to run

Summary

Key idea
Each second-order linear PDE type encodes behavior: elliptic (Laplace) is equilibrium, each value the mean of its surroundings; parabolic (heat) is diffusion, smoothing and dissipating; hyperbolic (waves) is finite-speed propagation without smoothing. First-order equations transport values along characteristics and, for densities, the continuity equation conserves mass.
  • A PDE is linear if Lu=fLu = f with LL linear. It is well posed if it has a unique solution depending continuously on data. Second-order type is intrinsic and read from eigenvalue signs of the principal-part matrix.
  • Transport. ut+c(x)ux=0u_t + c(x)u_x = 0 is solved by integrating x′=c(x)x' = c(x): u(x,t)=u0(Φ−t(x))u(x, t) = u_0(\Phi_{-t}(x)). Characteristics do not cross if cc is Lipschitz. In Burgers c=uc = u, they cross at t∗=−1/min⁡u0′t_* = -1/\min u_0' and shocks appear.
  • Continuity. ρt+div⁡(ρv)=0\rho_t + \operatorname{div}(\rho\vb{v}) = 0 conserves mass; along characteristics, ρ=ρ0 e−∫div⁡v\rho = \rho_0\,e^{-\int\operatorname{div}\vb{v}}. It underlies flow matching and normalizing-flow likelihood.
  • Heat. u=Gt∗u0u = G_t * u_0 with GtG_t a N(0,2t)\Normal(0, 2t): instant smoothing, infinite speed, semigroup, maximum principle, decomposition into modes e−k2te^{-k^2t}. It is the forward process of diffusion models.
  • Waves. u=F(x−ct)+G(x+ct)u = F(x - ct) + G(x + ct) (d’Alembert): finite speed, no smoothing, conserved energy and reversibility.
  • Laplace. Harmonic functions equal their neighborhood means; they satisfy the maximum principle and the Dirichlet problem is well posed.
  • Separation of variables. On an interval, u=∑bm Tm(t)sin⁡mxu = \sum b_m\,T_m(t)\sin mx: heat multiplies each mode by e−m2te^{-m^2t}, waves make it oscillate with cos⁡(mct)\cos(mct).
  • Ill-posedness. Reversing heat amplifies frequency kk by ek2Te^{k^2T}: without regularization, noise and rounding destroy the solution.