Three Types of Boundary Conditions
Dirichlet (homogeneous & non-homogeneous) • Neumann • Complete case analysis for each
Overview: Why BCs Matter
In Section 6.2 we solved the heat equation with homogeneous Dirichlet boundary conditions $u(0,t)=u(L,t)=0$. But real physical problems come with many different boundary situations. On this page we tackle three important cases:
Non-Homogeneous Dirichlet
Ends held at prescribed temperatures $T_1, T_2$. Strategy: steady-state + transient.
Non-Homog. BC with Source
Internal heat source $p(x)$ present. Steady state absorbs the source term.
Neumann (insulated ends)
$u_x(0,t) = u_x(L,t) = 0$. Now $\lambda = 0$ is non-trivial — a constant mode!
For every boundary-condition type, we follow the same strategy: reduce the problem to one with homogeneous Dirichlet BCs, which we already know how to solve, or adapt the three-case analysis to the new boundary conditions. The three cases $\lambda < 0$, $\lambda = 0$, $\lambda > 0$ must be checked afresh whenever the BCs change.
Case A: Non-Homogeneous Dirichlet Boundary Conditions
where $T_1, T_2$ are constants (not both zero).
If we try $u(x,t) = P(x)Q(t)$, the boundary condition $u(0,t) = T_1$ becomes $P(0)Q(t) = T_1$. For this to hold at every $t$, $Q(t)$ would have to be constant — which is incompatible with the temporal ODE $Q' + K\lambda Q = 0$ (except trivially). Separation only works for homogeneous BCs.
The Decomposition Strategy
Write the solution as the sum of a steady-state piece and a transient piece:
$$u(x,t) = V(x) + w(x,t)$$where $V(x)$ is chosen to satisfy the non-homogeneous BCs on its own, leaving $w(x,t)$ to satisfy a problem with homogeneous BCs.
Finding the Steady-State $V(x)$
As $t \to \infty$, the transient should die out: $w \to 0$. So $u(x,t) \to V(x)$. The limiting profile satisfies the steady-state equation (no time derivative):
$$0 = K\,V''(x) \implies V''(x) = 0$$with the non-homogeneous BCs $V(0) = T_1$, $V(L) = T_2$.
Integrating twice: $V(x) = A x + B$. Apply BCs:
- $V(0) = B = T_1$
- $V(L) = AL + T_1 = T_2 \implies A = (T_2 - T_1)/L$
This is the straight line connecting $(0, T_1)$ to $(L, T_2)$ — the temperature profile once all transient behaviour has died out.
The Transient Problem for $w$
Substitute $u = V + w$ into the PDE:
$$\underbrace{V_t}_{=0} + w_t = K(\underbrace{V_{xx}}_{=0} + w_{xx}) \implies w_t = K\,w_{xx}.$$Check the BCs for $w$:
- $w(0,t) = u(0,t) - V(0) = T_1 - T_1 = 0$
- $w(L,t) = u(L,t) - V(L) = T_2 - T_2 = 0$
And the initial condition for $w$:
$$w(x,0) = u(x,0) - V(x) = f(x) - V(x).$$This is exactly the problem we solved in Section 6.2. The three-case analysis gives $\lambda_m = (m\pi/L)^2$ and $P_m(x) = \sin(m\pi x/L)$, and
$$w(x,t) = \sum_{m=1}^{\infty} C_m\,\sin\!\left(\frac{m\pi x}{L}\right)\,e^{-K(m\pi/L)^2 t},$$with
$$C_m = \frac{2}{L}\int_0^L \bigl[f(x) - V(x)\bigr]\,\sin\!\left(\frac{m\pi x}{L}\right)dx.$$Case B: Non-Homogeneous Dirichlet with Source Term
where $p(x)$ is a prescribed internal source (time-independent heat generation per unit length).
Modified Steady-State Equation
Again let $u = V(x) + w(x,t)$ with $w \to 0$ as $t \to \infty$. Substituting:
$$V_t + w_t = K(V_{xx} + w_{xx}) + p(x).$$For the steady-state part (time-independent), $V_t = 0$, so
This is a two-point BVP for $V$. Solve by integrating twice and fitting the boundary data.
Residual Equation for $w$
Subtracting the steady-state equation from the full PDE leaves
$$w_t = K\,w_{xx}, \qquad w(0,t) = w(L,t) = 0, \qquad w(x,0) = f(x) - V(x).$$Same homogeneous problem as before.
Case C: Neumann Boundary Conditions (Insulated Ends)
Both ends are insulated: no heat flux in or out.
Separation and Inherited BCs
Same start as before: $u = P(x)Q(t)$ gives the same two ODEs. The difference is in the spatial boundary conditions. Since $u_x = P'(x)Q(t)$,
$$u_x(0,t) = P'(0)\,Q(t) = 0 \implies P'(0) = 0,$$ $$u_x(L,t) = P'(L)\,Q(t) = 0 \implies P'(L) = 0.$$So now the spatial BVP is
$$P''(x) + \lambda P(x) = 0, \qquad P'(0) = P'(L) = 0.$$Three-Case Analysis — Watch Case II!
We repeat the three-case analysis, but with derivative boundary conditions. The outcome for $\lambda = 0$ changes dramatically.
General solution: $P(x) = A\cosh(\alpha x) + B\sinh(\alpha x)$.
Derivative: $P'(x) = A\alpha\sinh(\alpha x) + B\alpha\cosh(\alpha x)$.
Apply $P'(0) = 0$: $P'(0) = A\alpha\cdot 0 + B\alpha\cdot 1 = B\alpha$. Since $\alpha \neq 0$, we get $B = 0$.
Apply $P'(L) = 0$: $P'(L) = A\alpha\sinh(\alpha L)$. Since $\alpha > 0$ and $\sinh(\alpha L) > 0$, we need $A = 0$.
General solution: $P(x) = C_1 x + C_2$.
Derivative: $P'(x) = C_1$.
Apply $P'(0) = 0$: $C_1 = 0$.
Apply $P'(L) = 0$: $C_1 = 0$ — already satisfied, no new constraint.
So $P(x) = C_2$ — any non-zero constant is a valid eigenfunction. We conventionally set the zeroth eigenvalue and eigenfunction as
$$\boxed{\;\lambda_0 = 0, \qquad P_0(x) = 1.\;}$$The corresponding temporal ODE $Q_0' + K\cdot 0\cdot Q_0 = 0$ gives $Q_0 = $ constant. The $m = 0$ mode is a steady, non-decaying average.
General solution: $P(x) = A\cos(\alpha x) + B\sin(\alpha x)$.
Derivative: $P'(x) = -A\alpha\sin(\alpha x) + B\alpha\cos(\alpha x)$.
Apply $P'(0) = 0$: $P'(0) = 0 + B\alpha = B\alpha$. Since $\alpha \neq 0$, we get $B = 0$.
So $P(x) = A\cos(\alpha x)$ and $P'(x) = -A\alpha\sin(\alpha x)$.
Apply $P'(L) = 0$: $-A\alpha\sin(\alpha L) = 0$. Non-triviality demands $A \neq 0$, so
$$\sin(\alpha L) = 0 \implies \alpha L = m\pi \implies \alpha_m = \frac{m\pi}{L}, \quad m = 1, 2, 3, \ldots$$Eigenvalues and eigenfunctions:
$$\boxed{\;\lambda_m = \left(\frac{m\pi}{L}\right)^2, \qquad P_m(x) = \cos\!\left(\frac{m\pi x}{L}\right),\; m = 1, 2, 3, \ldots\;}$$Combining both non-trivial cases:
- $m = 0$: $\lambda_0 = 0$, $P_0 = 1$ (constant mode, does not decay)
- $m = 1, 2, 3, \ldots$: $\lambda_m = (m\pi/L)^2$, $P_m = \cos(m\pi x/L)$ (decaying cosine modes)
General Solution with Neumann BCs
(The factor of $1/2$ on $C_0$ is the standard convention of the Fourier cosine series.)
The coefficients come from the Fourier cosine series of $f(x)$:
$$C_m = \frac{2}{L}\int_0^L f(x)\,\cos\!\left(\frac{m\pi x}{L}\right)dx, \qquad m = 0, 1, 2, \ldots$$The $m = 0$ term $C_0/2 = \dfrac{1}{L}\int_0^L f(x)\,dx$ is the spatial average of the initial temperature. Since no heat escapes through the insulated ends, this average is conserved forever. All the higher modes decay, but the average persists. As $t \to \infty$, the temperature approaches the initial average everywhere.
Summary: How the Three Cases Play Out for Each BC Type
| BCs | $\lambda < 0$ | $\lambda = 0$ | $\lambda > 0$ | Eigenfunctions |
|---|---|---|---|---|
| Dirichlet $P(0)=P(L)=0$ |
Trivial | Trivial | $\alpha = m\pi/L$ | $\sin(m\pi x/L)$, $m\geq 1$ |
| Neumann $P'(0)=P'(L)=0$ |
Trivial | Constant! | $\alpha = m\pi/L$ | $1$ and $\cos(m\pi x/L)$, $m\geq 1$ |
| Mixed $P(0)=0,\,P'(L)=0$ |
Trivial | Trivial | $\alpha = (2m-1)\pi/(2L)$ | $\sin((2m-1)\pi x/(2L))$, $m\geq 1$ |
Value-type BCs ($P=0$) select sines — sines vanish at $x=0$.
Derivative-type BCs ($P'=0$) select cosines — cosines have zero slope at $x=0$.
Mixing the two (value at one end, derivative at the other) gives half-integer modes.
Worked Examples
The examples below work through one problem of each type discussed above: non-homogeneous Dirichlet (A), non-homogeneous Dirichlet with an internal source (B), and Neumann / insulated ends (C). Click a header to expand the full solution.
Step 1 — Steady state.
$$V(x) = 3 + \frac{7 - 3}{4}\,x = x + 3.$$Check: $V(0) = 3\checkmark$, $V(4) = 7\checkmark$.
Step 2 — Transient initial condition.
$$w(x,0) = f(x) - V(x) = (2x+2) - (x+3) = x - 1.$$Exactly the Example 3 from Section 6.2.
Step 3 — Transient solution. From that example,
$$C_m = -\frac{2}{m\pi}\bigl[1 + 3(-1)^m\bigr].$$Also $K(m\pi/L)^2 = 4(m\pi/4)^2 = (m\pi)^2/4$.
Physical check: As $t \to \infty$, the exponentials vanish and $u \to x + 3$ — the linear temperature profile matching the fixed endpoint temperatures. At $t = 0$, direct substitution recovers $u(x,0) = 2x + 2$.
Step 1 — Solve for $V(x)$. The steady-state ODE is
$$4\,V''(x) + x = 0 \implies V''(x) = -\frac{x}{4}.$$Integrate once:
$$V'(x) = -\frac{x^2}{8} + A.$$Integrate again:
$$V(x) = -\frac{x^3}{24} + A x + B.$$Apply $V(0) = 3$: $B = 3$. Apply $V(4) = 7$:
$$-\frac{64}{24} + 4A + 3 = 7 \implies -\frac{8}{3} + 4A = 4 \implies 4A = \frac{20}{3} \implies A = \frac{5}{3}.$$ $$\boxed{\;V(x) = -\frac{x^3}{24} + \frac{5x}{3} + 3\;}$$Step 2 — Transient IC.
$$w(x,0) = \left(-\frac{x^3}{24} + \frac{8x}{3} + 2\right) - \left(-\frac{x^3}{24} + \frac{5x}{3} + 3\right) = x - 1.$$Again the $x - 1$ profile from Example 3 of Section 6.2.
Step 3 — Transient solution. Same $C_m$ as before:
$$C_m = -\frac{2}{m\pi}\bigl[1 + 3(-1)^m\bigr], \qquad K(m\pi/L)^2 = (m\pi)^2/4.$$Step 1 — Solve for $V$. $\tfrac{1}{6}V''(x) + x = 0 \implies V''(x) = -6x$.
Integrate: $V'(x) = -3x^2 + A$. Integrate again: $V(x) = -x^3 + Ax + B$.
$V(0) = 1 \implies B = 1$. $V(1) = -1 + A + 1 = 2 \implies A = 2$.
$$V(x) = -x^3 + 2x + 1.$$Step 2 — Transient IC.
$$w(x,0) = (1 - x^3) - (-x^3 + 2x + 1) = -2x.$$Step 3 — Compute $C_m$. With $L = 1$:
$$C_m = \frac{2}{1}\int_0^1 (-2x)\sin(m\pi x)\,dx = -4\int_0^1 x\sin(m\pi x)\,dx.$$By parts ($u = x$, $dv = \sin(m\pi x)dx$):
$$\int_0^1 x\sin(m\pi x)\,dx = \left[-\frac{x\cos(m\pi x)}{m\pi}\right]_0^1 + \frac{1}{m\pi}\int_0^1 \cos(m\pi x)\,dx = -\frac{(-1)^m}{m\pi} + 0.$$Therefore $C_m = -4\cdot\dfrac{-(-1)^m}{m\pi} = \dfrac{4(-1)^m}{m\pi}$.
General solution: With $L = \pi$, the cosine modes are $\cos(mx)$:
$$u(x,t) = \frac{C_0}{2} + \sum_{m=1}^{\infty} C_m\,\cos(mx)\,e^{-2 m^2 t}.$$Apply IC by comparison.
$$\frac{C_0}{2} + \sum_{m=1}^{\infty} C_m\,\cos(mx) = 5 + 3\cos(2x).$$Matching: $C_0/2 = 5 \Rightarrow C_0 = 10$, $C_2 = 3$, all others zero.
Physical check: As $t \to \infty$, $u \to 5$ — the spatial average of the initial data, conserved because of the insulated boundary.
Compute $C_0$ (the average):
$$C_0 = \frac{2}{\pi}\int_0^\pi x\,dx = \frac{2}{\pi}\cdot\frac{\pi^2}{2} = \pi.$$So the constant term is $C_0/2 = \pi/2$ — precisely the average of $x$ on $[0,\pi]$.
Compute $C_m$ for $m \geq 1$:
$$C_m = \frac{2}{\pi}\int_0^\pi x\,\cos(mx)\,dx.$$Integration by parts ($u = x$, $dv = \cos(mx)dx$):
$$\int_0^\pi x\,\cos(mx)\,dx = \left[\frac{x\sin(mx)}{m}\right]_0^\pi - \frac{1}{m}\int_0^\pi \sin(mx)\,dx = 0 - \frac{1}{m}\left[-\frac{\cos(mx)}{m}\right]_0^\pi.$$ $$= \frac{1}{m^2}\bigl[\cos(m\pi) - 1\bigr] = \frac{(-1)^m - 1}{m^2}.$$For even $m$: $(-1)^m = 1$, so $C_m = 0$. For odd $m$: $(-1)^m - 1 = -2$, so $C_m = \dfrac{2}{\pi}\cdot\dfrac{-2}{m^2} = -\dfrac{4}{\pi m^2}$.
As $t \to \infty$, all cosine terms die and $u \to \pi/2$ — the average of the initial linear temperature.
📝 Exam-Style Practice Problems
These are the boundary-condition problems most likely to appear on an exam. Each statement below gives the PDE, both boundary conditions and the initial condition — check that yours does too before you start solving. Click a problem to reveal the step-by-step solution.
Solution
Step 1: Find the steady state. $V'' = 0$ with $V(0) = 10$, $V(3) = 4$:
$$V(x) = T_1 + \frac{T_2 - T_1}{L}x = 10 + \frac{4-10}{3}x = 10 - 2x.$$Check: $V(0) = 10$ ✓, $V(3) = 10 - 6 = 4$ ✓.
Step 2: Subtract it off to get the transient problem.
$$w(x,0) = u(x,0) - V(x) = \bigl(10 - 2x + 5\sin(\pi x)\bigr) - (10 - 2x) = 5\sin(\pi x),$$ $$w_t = 2w_{xx}, \qquad w(0,t) = w(3,t) = 0.$$Step 3: Solve the transient problem by comparison. With $L = 3$ the eigenfunctions are $\sin(m\pi x/3)$. Matching $\dfrac{m\pi}{3} = \pi$ gives $m = 3$, so $C_3 = 5$ and every other $C_m = 0$. The decay rate is
$$K\left(\frac{3\pi}{3}\right)^2 = 2\pi^2.$$Step 4: Recombine $u = V + w$.
$$\boxed{u(x,t) = 10 - 2x + 5\,e^{-2\pi^2 t}\sin(\pi x)}$$Solution
Step 1: General solution. $K = 3$, $L = 2$:
$$u(x,t) = \frac{C_0}{2} + \sum_{m=1}^{\infty} C_m\cos\!\left(\frac{m\pi x}{2}\right)e^{-3(m\pi/2)^2 t} = \frac{C_0}{2} + \sum_{m=1}^{\infty} C_m\cos\!\left(\frac{m\pi x}{2}\right)e^{-3m^2\pi^2 t/4}.$$Step 2: The $m = 0$ coefficient (twice the average).
$$C_0 = \frac{2}{2}\int_0^2 x\,dx = \left[\frac{x^2}{2}\right]_0^2 = 2 \quad\Longrightarrow\quad \frac{C_0}{2} = 1.$$Step 3: The cosine coefficients for $m \geq 1$.
$$C_m = \frac{2}{2}\int_0^2 x\cos\!\left(\frac{m\pi x}{2}\right)dx.$$By parts with $u = x$, $dv = \cos(m\pi x/2)dx$, $v = \dfrac{2}{m\pi}\sin(m\pi x/2)$:
$$\int_0^2 x\cos\!\left(\frac{m\pi x}{2}\right)dx = \underbrace{\left[\frac{2x}{m\pi}\sin\!\left(\frac{m\pi x}{2}\right)\right]_0^2}_{=\,0\ \text{since}\ \sin(m\pi)=0} - \frac{2}{m\pi}\int_0^2\sin\!\left(\frac{m\pi x}{2}\right)dx$$ $$= -\frac{2}{m\pi}\left[-\frac{2}{m\pi}\cos\!\left(\frac{m\pi x}{2}\right)\right]_0^2 = \frac{4}{m^2\pi^2}\bigl[(-1)^m - 1\bigr].$$So $C_m = 0$ for even $m$, and $C_m = -\dfrac{8}{m^2\pi^2}$ for odd $m$.
Step 4: Assemble.
$$\boxed{u(x,t) = 1 - \frac{8}{\pi^2}\sum_{\substack{m=1\\ m\ \text{odd}}}^{\infty}\frac{1}{m^2}\cos\!\left(\frac{m\pi x}{2}\right)e^{-3m^2\pi^2 t/4}}$$Solution
Step 1: Inherit the spatial BCs. With $u = P(x)Q(t)$, $u(0,t) = P(0)Q(t) = 0 \Rightarrow P(0) = 0$, and $u_x(1,t) = P'(1)Q(t) = 0 \Rightarrow P'(1) = 0$. The BVP is
$$P'' + \lambda P = 0, \qquad P(0) = 0,\; P'(1) = 0.$$Step 2: Three-case analysis.
Case $\lambda < 0$ ($\lambda = -\alpha^2$): $P = A\cosh\alpha x + B\sinh\alpha x$; $P(0) = A = 0$, then $P'(1) = B\alpha\cosh\alpha = 0$ forces $B = 0$ since $\cosh\alpha \geq 1$. Trivial.
Case $\lambda = 0$: $P = C_1x + C_2$; $P(0) = C_2 = 0$ and $P'(1) = C_1 = 0$. Trivial.
Case $\lambda = \alpha^2 > 0$: $P = A\cos\alpha x + B\sin\alpha x$; $P(0) = A = 0$, so $P = B\sin\alpha x$ and $P'(1) = B\alpha\cos\alpha = 0$. Non-triviality requires $\cos\alpha = 0$, i.e.
$$\alpha_m = \frac{(2m-1)\pi}{2}, \qquad \lambda_m = \left[\frac{(2m-1)\pi}{2}\right]^2, \qquad P_m(x) = \sin\!\left(\frac{(2m-1)\pi x}{2}\right),\quad m \geq 1.$$Step 3: General solution and comparison.
$$u(x,t) = \sum_{m=1}^{\infty} C_m \sin\!\left(\frac{(2m-1)\pi x}{2}\right)e^{-\left[(2m-1)\pi/2\right]^2 t}.$$The initial condition $3\sin(\pi x/2)$ is exactly the $m = 1$ eigenfunction, so $C_1 = 3$ and all other $C_m = 0$, with $\lambda_1 = \pi^2/4$.
Final Solution:
$$\boxed{u(x,t) = 3\,e^{-\pi^2 t/4}\sin\!\left(\frac{\pi x}{2}\right)}$$Practice Problems
Test your understanding with these multiple-choice questions. Click a choice to see if you're correct.
Q1: For $u_t = Ku_{xx}$ with $u(0,t) = T_1$ and $u(L,t) = T_2$, which problem does the steady state $V(x)$ solve?
Answer: (B). A steady state is time-independent, so $u_t = 0$ and the PDE collapses to $KV'' = 0$, i.e. $V'' = 0$. The whole point of $V$ is that it carries the non-homogeneous data, so it inherits $V(0) = T_1$, $V(L) = T_2$. The result is the straight line $V(x) = T_1 + \frac{T_2-T_1}{L}x$.
Q2: With Neumann BCs $P'(0) = P'(L) = 0$, what happens in the case $\lambda = 0$?
Answer: (D). For $\lambda = 0$, $P = C_1x + C_2$ so $P' = C_1$. Both BCs say only $C_1 = 0$, leaving $P = C_2$, any non-zero constant. This is the mode most often forgotten — it is the non-decaying "DC" component of the solution.
Q3: Let $u_t = 3u_{xx}$ on $0 < x < 2$ with $u_x(0,t) = u_x(2,t) = 0$ and $u(x,0) = x$. What is $\displaystyle\lim_{t\to\infty} u(x,t)$?
Answer: (A). Insulated ends conserve total heat, so the solution relaxes to the spatial average of the initial data: $\dfrac{1}{L}\displaystyle\int_0^L f = \dfrac{1}{2}\int_0^2 x\,dx = \dfrac{1}{2}\cdot 2 = 1$. Choice (B) is the Dirichlet answer, where heat leaks out through the ends.
Q4: For $u_t = 2u_{xx} + 4$ with $u(0,t) = u(1,t) = 0$, what is the steady state $V(x)$?
Answer: (C). The steady-state ODE is $KV'' + p = 0$, i.e. $2V'' + 4 = 0 \Rightarrow V'' = -2$, so $V = -x^2 + Ax + B$. Then $V(0) = 0 \Rightarrow B = 0$ and $V(1) = -1 + A = 0 \Rightarrow A = 1$, giving $V = x - x^2 = x(1-x)$. Choice (D) is the classic trap: a source term produces a non-zero steady state even with zero boundary data.
Q5: For the mixed BCs $P(0) = 0$, $P'(L) = 0$, what are the eigenvalues?
Answer: (B). $P(0) = 0$ kills the cosine, leaving $P = B\sin(\alpha x)$; then $P'(L) = B\alpha\cos(\alpha L) = 0$ requires $\cos(\alpha L) = 0$, so $\alpha L = \frac{\pi}{2}, \frac{3\pi}{2}, \frac{5\pi}{2},\ldots = \frac{(2m-1)\pi}{2}$. Mixing a value BC with a derivative BC gives half-integer (quarter-wavelength) modes.
Q6: Why must non-homogeneous boundary conditions be removed before separating variables?
Answer: (C). Separation of variables needs each BC to be satisfied by the spatial factor alone, which only works when the BC is homogeneous. Splitting $u = V(x) + w(x,t)$ hands the non-homogeneous data to $V$ and leaves $w$ with zero BCs, where separation does work.