---
title: Partial differential equations and their boundary conditions
heading: Equilibrium, diffusion and waves, and what pins them down
eyebrow: A12 · Lesson 28 · Partial differential equations and their boundary conditions
xp: 40
---

::: hook
Fields, temperatures, voltages along a line: the quantities engineers care about vary in space and in time, and the laws that govern them are **partial differential equations**. Three equations cover most of electrical engineering. **Laplace's equation** describes equilibrium: the potential in a charge-free region. The **heat (diffusion) equation** describes spreading: heat through a circuit board, charge carriers through a semiconductor, current soaking into a conductor's skin. The **wave equation** describes propagation: signals on transmission lines, fields in space. Each needs the right side conditions to have one answer, and getting those conditions right is half of modeling.
:::

::: play
- A rod from x = 0 to 1, held at 0 at both ends, starts with a temperature made of two sine shapes: one gentle bump and one with three humps. The heat equation lets each shape decay on its own.
- Advance t: the three-hump part fades nine times faster than the bump, because its rate goes as the square of its wavenumber. Diffusion always smooths: sharp features die first.
- Raise the diffusivity α: everything happens faster, in proportion.
:::
:::

```sim plot
view: graph
x: x = 0..1 m
y: u = -0.6..1.6
slider: t = 0..0.2 step 0.002 = 0 s
slider: a = 0.2..2 step 0.1 = 1
plot: sin(pi*x)*exp(-pi^2*a*t) + 0.5*sin(3*pi*x)*exp(-9*pi^2*a*t) | label: u(x, t)
plot: sin(pi*x)*exp(-pi^2*a*t) | dashed | label: the slow mode
plot: 0.5*sin(3*pi*x)*exp(-9*pi^2*a*t) | dashed | color: ch3 | label: the fast mode
readout: slow mode left, % = 100*exp(-pi^2*a*t)
readout: fast mode left, % = 100*exp(-9*pi^2*a*t)
```

::: predict
## Classify $3u_{xx} + 2u_{xy} + u_{yy} = 0$ by its discriminant $B^2 - 4AC$.

- [x] Elliptic
- [ ] Parabolic
- [ ] Hyperbolic
- [ ] It changes type from point to point

::: reveal
Elliptic: $B^2 - 4AC = 4 - 12 = -8 < 0$, the same class as Laplace's equation. Elliptic equations describe equilibria: no time, boundary values everywhere, and smooth solutions inside.
:::
:::

::: nameit
## Three types

For $Au_{xx} + Bu_{xy} + Cu_{yy} + \text{(lower-order terms)} = 0$:

| $B^2 - 4AC$ | Type | Prototype | Behaves like |
|---|---|---|---|
| < 0 | elliptic | Laplace $u_{xx} + u_{yy} = 0$ | equilibrium, smooth |
| = 0 | parabolic | heat $u_t = \alpha u_{xx}$ | diffusion, smoothing, irreversible |
| > 0 | hyperbolic | wave $u_{tt} = c^2u_{xx}$ | propagation at finite speed, sharp fronts survive |

## Boundary and initial conditions

- **Dirichlet:** the value is given on the boundary (a conductor at a fixed voltage, an end held at a temperature).
- **Neumann:** the normal derivative is given (an insulated end, $\partial u/\partial x = 0$; a known heat flux, $-k\,\partial u/\partial x = q$).
- **Robin:** a combination (a surface cooled by convection, $-k\,\partial u/\partial n = h(u - u_\infty)$).
- **Initial conditions:** the heat equation needs u at t = 0; the wave equation needs u and $u_t$ at t = 0, because it's second order in time.

A problem is **well posed** when it has exactly one solution that depends continuously on the data. Laplace's equation with Dirichlet data on a closed boundary is well posed; with only initial-style data, it isn't.

## Superposition

These equations are linear: sums of solutions are solutions. Most of this half of the course builds solutions out of simple ones (sines, exponentials, Bessel functions) and adds them up to fit the conditions.
:::

::: example
## A rod has diffusivity α = 10⁻⁴ m²/s and length L = 0.1 m with both ends at 0. How fast does the mode $\sin(\pi x/L)$ decay?

::: solution
1. **Decay of the first mode.** It decays as $e^{-\alpha(\pi/L)^2t}$, with time constant
   $$\begin{aligned} \tau &= \frac{L^2}{\alpha\pi^2} \\ &= \frac{0.01}{10^{-4} \times 9.87} \\ &= 10.1\ \text{s} \end{aligned}$$
2. **The third mode.** The mode $\sin(3\pi x/L)$ decays nine times faster, in 1.1 s.

**Answer:** the mode decays as $e^{-\alpha(\pi/L)^2t}$, with a time constant of 10.1 s.
:::
:::

::: example
## An end of a copper rod (k = 400 W/(m·K)) receives a heat flux of 20 kW/m². What's the temperature gradient there?

::: solution
1. **The Neumann condition.**
   $$-k\,\frac{\partial u}{\partial x} = q$$
2. **Solve for the slope.**
   $$\begin{aligned} \frac{\partial u}{\partial x} &= -\frac{20\,000}{400} \\ &= -50\ \text{K/m} \end{aligned}$$
3. **What it sets.** The Neumann condition fixes the slope and leaves the temperature itself free.

**Answer:** the gradient is −50 K/m.
:::
:::

::: example
## Classify $u_{xx} + 4u_{xy} + 3u_{yy} = 0$ and find its general solution.

::: solution
1. **Classify.**
   $$\begin{aligned} B^2 - 4AC &= 16 - 12 \\ &= 4 > 0 \end{aligned}$$
   so the equation is hyperbolic, like the wave equation.
2. **Try a traveling shape.** Look for solutions of the form $F(y - mx)$: substituting gives
   $$F''(m^2 - 4m + 3) = 0$$
   so $m = 1$ or $m = 3$.
3. **The general solution.**
   $$u = F(y - x) + G(y - 3x)$$
   for any two smooth functions F and G.
4. **Characteristics.** The lines $y - x$ = constant and $y - 3x$ = constant are the **characteristics**: shapes travel along them unchanged, just as a wave on a string is two shapes moving apart.
5. **Check one.** For $u = G(y - 3x)$, $u_{xx} = 9G''$, $u_{xy} = -3G''$ and $u_{yy} = G''$, and $9 - 12 + 3 = 0$.

**Answer:** the equation is hyperbolic, and its general solution is $u = F(y - x) + G(y - 3x)$.
:::
:::

::: check
given: A = 1 | 3 | 2; B = 2 | 4 | 0; C = 1 | -1 | 5
answer: B^2 - 4*A*C
tolerance: 0

## What's the discriminant $B^2 - 4AC$ of $\given{A}u_{xx} + \given{B}u_{xy} + \given{C}u_{yy} = 0$? (Negative: elliptic; zero: parabolic; positive: hyperbolic.)

::: right
Right. {answer}.
:::

::: misses
- [B^2 + 4*A*C] It's minus 4AC.
- [any] Not yet. $B^2 - 4AC$.
:::
:::

::: check
given: a = 0.0001 | 0.00002 | 0.001; L = 0.05 | 0.1 | 0.3; n = 2 | 3 | 4
answer: L^2/(a*pi^2*n^2)
unit: s
tolerance: 0.5%

## A rod of length {L} m with diffusivity {a} m²/s and both ends at 0: what's the time constant of the mode $\sin(\given{n}\pi x/L)$?

::: right
Right. $L^2/(\alpha\pi^2n^2)$ = {answer} s.
:::

::: misses
- [L^2/(a*pi^2*n)] The rate goes as $n^2$.
- [any] Not yet. The mode decays as $e^{-\alpha(n\pi/L)^2t}$.
:::
:::

::: check
given: n = 2 | 3 | 5 | 10
answer: n^2
tolerance: 0

## How many times faster does the mode $\sin(n\pi x/L)$ with n = {n} decay than the mode with n = 1?

::: right
Right. {answer} times.
:::

::: misses
- [n] The decay rate goes as the square of the wavenumber.
- [any] Not yet. Compare $(n\pi/L)^2$ with $(\pi/L)^2$.
:::
:::

::: check
given: q = 5000 | 20000 | 100000; k = 50 | 200 | 400
answer: -q/k
unit: K/m
tolerance: 0.5%

## A heat flux of {q} W/m² enters the end of a rod with conductivity {k} W/(m·K): $-k\,\partial u/\partial x = q$. What's $\partial u/\partial x$ there?

::: right
Right. {answer} K/m.
:::

::: misses
- [q/k] Mind the sign: heat flows down the gradient.
- [any] Not yet. $\partial u/\partial x = -q/k$.
:::
:::

::: check
kind: choice

## How many initial conditions does the wave equation $u_{tt} = c^2u_{xx}$ need?

- [ ] None
- [ ] One: the initial shape
- [x] Two: the initial shape and the initial velocity
- [ ] Three

::: misses
- [1] It's an evolution in time; something has to start it.
- [2] It's second order in time, like a mass on a spring, which needs a position and a velocity.
- [4] Second order in time needs two.
:::
:::

::: check
kind: match

## Match each situation to its equation's type.

- Steady potential between conductors in charge-free space :: elliptic
- A voltage step soaking into a long resistive-capacitive line :: parabolic
- A pulse traveling down a lossless transmission line :: hyperbolic
:::

::: check
kind: parts
given: k = 50 | 200; h = 10 | 100; D = 20 | 50; L = 0.05 | 0.2

## A rod with conductivity {k} W/(m·K) loses heat from its end to air by convection: $-ku_x = h(u - T_\text{air})$, with h = {h} W/(m²·K). The end is {D} K above the air.

::: part
answer: h*D/k
unit: K/m
tolerance: 0.5%

### How steep is the temperature gradient at the end?

::: misses
- [D*k/h] The gradient is the flux divided by k.
- [any] The flux leaving is $h\Delta T$; divide by k.
:::
:::

::: part
answer: h*L/k
tolerance: 0.5%

### For a rod {L} m long, what is the Biot number $hL/k$? (Much less than 1 means the rod stays nearly uniform.)

::: misses
- [k/(h*L)] That's its reciprocal.
- [any] $\frac{hL}{k}$.
:::
:::
:::

::: check
kind: derivation
vars: A = 1..2, B = 4..6, C = 0.5..1

## The hyperbolic equation $Au_{xx} + Bu_{xy} + Cu_{yy} = 0$ has solutions $F(y - mx)$ where $Am^2 - Bm + C = 0$.

::: step
answer: (B + sqrt(B^2 - 4*A*C))/(2*A)

### What is the steeper characteristic slope m?
:::

::: step
answer: (B - sqrt(B^2 - 4*A*C))/(2*A)

### And the shallower one?
:::

::: right
Right. Two real slopes exist exactly when $B^2 - 4AC > 0$, which is what makes the equation hyperbolic.
:::
:::

::: explain
## Why does the heat equation smooth out sharp features while the wave equation preserves them?

::: model
Writing any initial profile as a sum of sine shapes, the heat equation multiplies each by a decaying exponential whose rate grows as the square of its wavenumber, so the fine, rapidly varying components that make up sharp features die out first and fastest, leaving the smooth broad shapes: diffusion is irreversibly smoothing. The wave equation instead makes each component oscillate in time with constant amplitude, at a frequency proportional to its wavenumber; on a lossless line all components travel at the same speed and stay in step, so a sharp pulse keeps its shape as it propagates.
:::
:::

::: practice

::: check
given: A = 2 | 1; B = 4 | 1; C = 2 | 3
answer: B^2 - 4*A*C
tolerance: 0

## Discriminant of $\given{A}u_{xx} + \given{B}u_{xy} + \given{C}u_{yy}$?

::: misses
- [any] $B^2 - 4AC$.
:::
:::

::: check
given: a = 0.0001 | 0.00005; L = 0.02 | 0.2; n = 1 | 4
answer: L^2/(a*pi^2*n^2)
unit: s
tolerance: 0.5%

## Time constant of mode {n}, L = {L} m, α = {a}?

::: misses
- [any] $L^2/(\alpha\pi^2n^2)$.
:::
:::

::: check
given: q = 1000 | 50000; k = 10 | 400
answer: -q/k
unit: K/m
tolerance: 0.5%

## Gradient for flux {q} W/m², k = {k}?

::: misses
- [any] $-q/k$.
:::
:::
:::
