Separation of variables ends in a sentence that sounds harmless: “the left side depends only on t, the right side only on x, so both equal a constant, −λ.” 9.1 What Is a PDE? Conservation Laws & Classification stopped right there, and 9.6 Laplace's Equation: Rectangles & Disks used the next step without justifying it. The spatial equation is X′′=−λX with conditions at both walls, and by the reasoning of 8.1 Two-Point Boundary Value Problems it has a nonzero solution only for special values of λ. Those values set how fast each heat mode decays, which pitches a string plays, and which pressure patterns a box of fluid holds. This lesson finds them, proves their eigenfunctions are perpendicular, allows variable coefficients, and checks everything against the second-difference matrix of 10.1 Finite Differences: Discretizing Derivatives.
▶ VideoThe same vibrating-string picture for three boundary conditions, then the finite-difference matrix reproducing the eigenvaluescaptions only
Transcript
Separation of variables ends in an equation with an unknown constant: minus y double prime equals lambda y, with the ends held at zero. Only special values of lambda give a nonzero solution. Negative lambda gives sinh, never zero at L. Zero gives a line through both zeros, so nothing. Positive lambda gives B sine mu L, and mu L must be k pi. So lambda k is k pi over L squared, with sine eigenfunctions, and for L equal 1 the first three are 9.8696, 39.4784 and 88.8264. The k-th has k minus 1 zeros inside.
Now insulate the ends: the slope is zero at both. Negative lambda still gives nothing, but lambda equal 0 works. The line A x plus B has slope A, so A is zero, and the constant function 1 is an eigenfunction. The rest are cosines with the same values as before, 9.8696 and 39.4784. That zero is real. An insulated rod keeps its total heat, so the constant mode never decays. On a grid with 40 cells the sim returns 0 to round-off, then 9.8645 and 39.3973.
Let the right end exchange heat, so y prime plus h y is zero. The solution is sine mu x, and the right end condition becomes tan of mu L equals minus mu over h. No algebra solves that, so the sim scans for sign changes and bisects. For L equal 1 and h equal 1, lambda one is 4.1159. For h equal 0, an insulated right end, it is 2.4674. At h equal 10 it is 8.1955, at h equal 100 it is 9.6752, and as the end stiffens the roots slide up to the Dirichlet value 9.8696.
Why are the eigenfunctions perpendicular? Let A u be minus u double prime. Integrating by parts, A u with v minus u with A v equals a boundary bracket. For Dirichlet ends both functions vanish. For Neumann ends both slopes vanish. For Robin ends u prime is minus h u and v prime is minus h v, and the two terms cancel. So the operator is symmetric, like a symmetric matrix, and lambda j minus lambda k times the inner product of y j and y k is zero: different eigenvalues, perpendicular functions. The sim checks the first three sines with Simpson quadrature: off-diagonals below 3 times 10 to the minus 16.
Real problems have variable coefficients. Heat in a rod with varying conductivity fits the Sturm Liouville form: minus p y prime, prime, plus q y, equals lambda w y. The symmetry argument now gives the integral of w y j y k, zero: the inner product carries the weight w. Think of beads on a string, where heavy beads count more. The theorem has four claims: real ordered eigenvalues, orthogonality, k minus 1 zeros, and completeness. Orthogonality is proved here; the rest is from memory.
Try minus x y prime, prime, equals lambda y over x on 1 to e, so p is x and the weight is 1 over x. Put t equal to the log of x and it becomes the first problem, so lambda k is k pi squared. In the weighted inner product the off-diagonals are below 2.8 times 10 to the minus 13. Ignore the weight and the entries are minus 0.1778, 0.0187 and minus 0.1912: not perpendicular. With the weight x, minus y double prime equals lambda x y has Bessel solutions, from memory, and eigenvalues 18.9563, 81.8866 and 189.2209.
Multiply the equation by y and integrate, and lambda becomes a ratio, the Rayleigh quotient. For Dirichlet ends the top is the integral of y prime squared, zero only for a constant, and a constant that vanishes at 0 is zero. So every Dirichlet eigenvalue is positive. The smallest is the minimum of the ratio, from memory, so any trial function bounds it above. The parabola x times 1 minus x gives 10.0000, the tent gives 12.0000, and the true value is 9.8696. The parabola is 1.3 percent high. The constant 1 gives 0, below the minimum, because it breaks the boundary conditions.
Now the matrix. With N cells and Dirichlet ends the eigenvalues of the second difference matrix are 2 minus 2 cosine of k pi h over h squared. The first is 9.788697 at N equal 10, 9.849328 at 20, 9.864532 at 40, against the exact 9.869604. The relative error is minus 8.20 times 10 to the minus 3, then minus 2.05 times 10 to the minus 3, then minus 5.14 times 10 to the minus 4: divided by 4 each time h halves, and growing like k squared. At N equal 10 the top grid eigenvalue is 390.2113, where the true mode 9 would be 799.4380, and the grid never exceeds 4 over h squared, 400. A grid gets only the low end right.
Each mode is a sine times e to the minus alpha lambda k t, so the eigenvalue is the decay rate. With alpha and L equal 1, at t equal 0.01 the three factors are 0.9060, 0.6738 and 0.4114. At t equal 0.05 they are 0.6105, 0.1389 and 0.0118. The third mode is down to about 1 percent while the first keeps 61 percent: high modes die first. Since lambda k is k squared times lambda 1, the factor for mode k is mode 1's raised to the power k squared: 0.6105 to the 4th is 0.1389. Run time backward and the factors grow: that is the ill posedness met in the PDE lesson.
The initial condition f of x must be written as a sum of eigenfunctions, and orthogonality gives the coefficients at once: multiply by y j and integrate. Whether the series really converges to f, how fast, and what happens at a jump is a different question. Completeness, claim 4, is only the promise. That is the next lesson, on Fourier series, and it is not yet written.
The problem: λ is unknown too
Find all numbers λ for which
−y′′=λy(0<x<L),boundary conditions at x=0 and x=L
has a solution y≡0. Such λ is an eigenvalue and y an eigenfunction. Read it as Ay=λy with A=−d2/dx2 acting on functions that obey the boundary conditions, which belong to the definition of the operator. As in 1.3 Linear Systems, Kernel & Column Space, (A−λ)y=0 has a nonzero solution exactly when λ is an eigenvalue. That is why L=π, b=0 in the previous lesson had infinitely many solutions ssinx: λ=1 was an eigenvalue.
λ<0, κ=−λ: y=Aeκx+Be−κx. Then y(0)=0 gives B=−A and y(L)=2AsinhκL=0 forces A=0. No eigenvalue.
λ=0: y=Ax+B, so B=0 and AL=0. No eigenvalue.
λ=μ2>0: y=Acosμx+Bsinμx. y(0)=0 gives A=0 and y(L)=BsinμL=0 with B=0 needs μL=kπ.
So
λk=(Lkπ)2,yk=sinLkπx,k=1,2,3,…
For L=1: 9.8696,39.4784,88.8264. The first eigenfunction is one arch, the second an S, and yk has k−1 zeros inside the interval (the sim counts them for every problem below).
Neumann ends: y′(0)=y′(L)=0
The case λ<0 again gives nothing (y′(0)=0 makes A=B, then y′(L)=2AκsinhκL=0). But now λ=0 works: y=Ax+B has y′=A, so A=0 and y=1 is an eigenfunction. For λ=μ2, y′(0)=Bμ=0 leaves y=Acosμx and y′(L)=−AμsinμL=0 gives μL=kπ:
λk=(Lkπ)2,yk=cosLkπx,k=0,1,2,…
The eigenvalue zero is real. An insulated rod keeps its total heat, so the constant mode never decays. In the sim, Neumann ends on a 40-cell grid return λ0=0 to round-off (below 10−12), then 9.8645 and 39.3973. The same constant is the freedom in the pressure of 11.10 The Projection Method for Incompressible Flow.
Robin ends: no formula
Take y(0)=0 at the left and y′(L)+hy(L)=0 at the right, with h≥0. This is Newton cooling from 8.1 Two-Point Boundary Value Problems: h=0 is an insulated right end and h→∞ a held one. For λ≤0 nothing survives (for λ=0, y=Ax gives A(1+hL)=0). For λ=μ2, y=sinμx and the right condition becomes
μcosμL+hsinμL=0⟺tanμL=−hμ.
No algebra solves a transcendental equation. The roots are the crossings of tanμL with a line of slope −1/h, one in each interval ((k−21)π/L,kπ/L); the sim scans for sign changes and bisects, as the PyCell below does. For L=1 the first three eigenvalues are:
h
λ1
λ2
λ3
0
2.4674
22.2066
61.6850
1
4.1159
24.1393
63.6591
10
8.1955
33.1840
75.8347
100
9.6752
38.7015
87.0812
∞ (Dirichlet)
9.8696
39.4784
88.8264
At h=1 the roots are μ=2.0288,4.9132,7.9787. The table slides from the mixed values ((k−21)π)2 at h=0 to the Dirichlet values as the right end stiffens.
Why the eigenfunctions are orthogonal
Write (u,v)=∫0Luvdx and Au=−u′′. For any two functions,
(Au,v)−(u,Av)=∫0L(−u′′v+uv′′)dx=[−u′v+uv′]0L,
because dxd(−u′v+uv′)=−u′′v+uv′′. If both functions satisfy the boundary conditions, the bracket vanishes:
Dirichlet: u=v=0 at both ends.
Neumann: u′=v′=0 at both ends.
Robin at L: u′=−hu and v′=−hv, so −u′v+uv′=huv−huv=0.
So (Au,v)=(u,Av): the operator is symmetric, the function-space version of AT=A in 1.6 Change of Basis & Diagonalization. The proof of orthogonality is then the same one-line argument as for symmetric matrices. If Ayj=λjyj and Ayk=λkyk,
so (yj,yk)=0 whenever λj=λk. Real eigenvalues follow the same way: for a complex eigenfunction, λ∫∣y∣2=∫∣y′∣2+(boundary terms), and the boundary terms are 0 or h∣y(L)∣2, so λ is real and not negative. The sim checks the first three Dirichlet sines on [0,1] with Simpson quadrature (4000 cells): the off-diagonal entries are below 3×10−16.
Sturm–Liouville form and the weight
Variable coefficients arise at once. Heat in a rod with conductivity k(x), density ρ and specific heat c obeys ρcut=(kux)x, and separation gives −(kX′)′=λρcX; a string with density ρ(x) gives −(τy′)′=λρy. Both fit the Sturm–Liouville form
−(p(x)y′)′+q(x)y=λw(x)y,a<x<b,p>0,w>0.
The earlier problem is p=w=1, q=0. Integration by parts gives ∫(Luv−uLv)dx=[−p(u′v−uv′)]ab, zero for the same boundary conditions, but now λ sits next to w, so the symmetry argument yields
(λj−λk)∫abwyjykdx=0.
The inner product carries the weight w. Picture a string of beads: springs give a symmetric stiffness matrix K, beads have masses mi, and Kv=λMv with M=diag(mi). Eigenvectors satisfy vjTMvk=0, not vj⋅vk=0: heavy beads count more. Setting v=M−1/2z gives the ordinary symmetric problem M−1/2KM−1/2z=λz, which is exactly what the sim and the exercise build.
Worked example: a weight you can solve by hand
Take −(xy′)′=λy/x on [1,e] with y(1)=y(e)=0: here p=x and w=1/x. Put t=lnx, so xd/dx=d/dt and (xy′)′=ytt/x. The equation becomes −ytt=λy on 0<t<1 with Dirichlet ends: the first problem of the lesson. Hence
The sim (“Cauchy-Euler”, Dirichlet) confirms it with the exact functions and Simpson on 4000 cells: with weight 1/x the off-diagonal entries of the normalized inner-product matrix are below 2.8×10−13. Ignoring the weight, the entries are (y1,y2)=−0.1778, (y1,y3)=0.0187 and (y2,y3)=−0.1912: the sines are not perpendicular in the plain ∫dx inner product.
◆ InteractiveChoose coefficients and boundary conditions; read eigenvalues, node counts, the inner-product matrix and Rayleigh quotients
Loading simulation…
What to try. (1) Constant coefficients, Dirichlet, N=10,20,40: the error of λk falls by 4 per halving. (2) Neumann: the first eigenvalue is zero. (3) Robin: sweep h and compare with the table. (4) Cauchy-Euler: tick the box and compare weighted and unweighted off-diagonals (the readout prints both). (5) Airy and Bessel: the weight vanishes at 0, yet the eigenfunctions behave. (6) Slide the heat time t.
Variable coefficients solved numerically
For −y′′=λxy on [0,1] with y(0)=y(1)=0 (weight w=x) the solutions are Bessel functions: y=xJ1/3(32λx3/2), so λ=(23j)2 where j is a zero of J1/3 (from memory; the sim’s check follows). The sim finds the roots from the power series:
The finite-difference solve with N=50,100,200 cells gives λ1=18.9491,18.9545,18.9558 and λ2=81.7525,81.8531,81.8782, with errors shrinking by about 4 per doubling, and the eigenfunctions have 0,1,2,3 zeros for k=1 to 4. With the weight x the grid eigenfunctions (N=200) are orthogonal to better than 2×10−13 (the symmetry of the discrete system); without the weight the normalized entries are 0.3077, 0.1519 and 0.3650. The Bessel problem −(xy′)′=λxy (singular at 0, bounded solutions; it governs circular drums) has j0,k2=5.7832,30.4713,74.8870, and the N=400 grid gives 5.7831,30.4704,74.8825.
The Rayleigh quotient and λ1>0
Multiply −(py′)′+qy=λwy by y and integrate, using integration by parts:
For Dirichlet ends the boundary terms vanish. With p=w=1, q=0 the numerator is ∫y′2, which is zero only if y is constant, and a constant that vanishes at x=0 is zero. So every Dirichlet eigenvalue is positive: heat in a rod held at fixed temperature always decays. (For Neumann the constant escapes, which is why λ0=0.)
The quotient also bounds λ1 from above: λ1=minR[y] over functions obeying the Dirichlet conditions (from memory). Any trial function gives an upper bound. On [0,1]:
The sim reproduces 10.0000 and 12.0000 against the true λ1=9.8696: a parabola is within 1.3% of the first eigenvalue with no eigenvalue computation. The constant y=1 gives R=0, belowλ1, because it does not vanish at the ends and is not allowed: the boundary conditions are not a detail.
The matrix that approximates it
10.1 Finite Differences: Discretizing Derivatives built the second-difference matrix and quoted its eigenvalues. This is the same eigenvalue problem with N cells. With h=1/N, Dirichlet ends, and p=w=1, the matrix is (2,−1,−1)/h2, symmetric with eigenvectors sin(kπxi) and
λk(N)=h22−2cos(kπh)=k2π2−12k4π4h2+⋯.
The sim, on its constant-coefficient Dirichlet problem:
N
λ1
λ2
λ3
rel. errors
10
9.788697
38.196601
82.442950
−8.20×10−3,−3.25×10−2,−7.19×10−2
20
9.849328
39.154787
87.194781
−2.05×10−3,−8.20×10−3,−1.84×10−2
40
9.864532
39.397310
88.416255
−5.14×10−4,−2.05×10−3,−4.62×10−3
exact
9.869604
39.478418
88.826440
Doubling N divides the error by 4 (second order) and the error grows like k2, matching (kπh)2/12 from the series. At N=10 the largest eigenvalue is 390.2113, where the eigenvalue of the true mode k=9 would be 799.4380, and the grid values never exceed 4/h2=400. At N=40 the tenth mode has 937.2583 against 986.9604 (−5.04%). Modes up to about k≈N/10 are right to within 1%: a grid sees only the low end of the spectrum correctly.
The same code handles any p and w. For p=x, w=1/x on [1,e] the grid gives λ1=9.841966 (N=20) and 9.862664 (N=40) against π2: errors −2.80×10−3 and −7.03×10−4, again a factor 4.
Why this is exactly what separation of variables needs
Heat on [0,L] with ends held at 0: ut=αuxx. Try u=X(x)T(t):
αTT′=XX′′=−λ⟹T′=−αλT,−X′′=λX.
The spatial equation with X(0)=X(L)=0 is the Dirichlet problem: only λk=(kπ/L)2 gives a nonzero X, and then T=e−αλkt. Superposition adds the modes:
u(x,t)=k≥1∑cke−αλktsinLkπx.
The eigenvalue is the decay rate. With α=L=1 the sim’s heat readout gives the amplification factors e−λkt:
t
mode 1
mode 2
mode 3
0.01
0.9060
0.6738
0.4114
0.05
0.6105
0.1389
0.0118
At t=0.05 the third mode is down to about 1% while the first keeps 61%: high modes die first, so heat flow smooths. Since λk=k2λ1, mode k‘s factor is mode 1’s raised to the power k2 (0.61054=0.1389). This also explains the ill-posedness in 9.1 What Is a PDE? Conservation Laws & Classification: running time backwards multiplies by e+λkt with λk→∞. Other boundary conditions only change the list of λk.
What remains is the initial condition u(x,0)=f(x)=∑ckyk(x). Orthogonality gives the coefficients at once: multiply by yj and integrate, so cj=(f,yj)/(yj,yj). Whether the series really converges to f, how fast, and what happens at jumps is the subject of the next lesson on Fourier series (8.3 Fourier Series); completeness, item 4 above, is its promise.
Computing it
🐍 PythonLab: the weighted eigenvalue solver, the second-difference errors, the weighted Gram matrix and a Robin root
⌘/Ctrl + Enter
Now build the solver yourself. The key step is the change of variables that makes a weighted problem symmetric.
🧪 Coding exerciseExercise: eigenvalues of -(p y')' = lambda w y with Dirichlet ends, checked on two problems✓ passed
⌘/Ctrl + Enter
💡 With s = 1/np.sqrt(m), the symmetric matrix is s[:, None]*K*s[None, :], and the eigenfunctions are V*s[:, None].
Concept checks
✅ Concept check
For $-y'' = \lambda y$ on $[0, L]$ with $y'(0) = y'(L) = 0$, which statement is true?
Why: Neumann ends give $\lambda_k = (k\pi/L)^2$ with $k = 0, 1, 2, \dots$ and eigenfunctions $\cos(k\pi x/L)$.
✅ Concept check
For $-(xy')' = \lambda\,y/x$ on $[1, e]$ the eigenfunctions $\sin(k\pi\ln x)$ are orthogonal in the inner product
Why: The weight $w$ in $-(py')' + qy = \lambda wy$ is the inner-product weight.
✅ Concept check
The first Dirichlet eigenvalue of the grid matrix has relative error $-8.20\times10^{-3}$ at $N = 10$. Predict the error at $N = 40$, in units of $10^{-4}$ (absolute value).
Why: Two halvings of $h$ divide a second-order error by $16$: $8.20\times10^{-3}/16 = 5.1\times10^{-4}$; the sim shows $5.14\times10^{-4}$.
✅ Concept check
Dirichlet ends on $[0, L]$. How many zeros strictly inside the interval does the fifth eigenfunction have?
Why: $y_5 = \sin(5\pi x/L)$ has zeros at $x = jL/5$ for $j = 1, 2, 3, 4$: $k - 1 = 4$ (oscillation theorem, counting from $k = 1$).
✅ Concept check
Why does the Robin boundary term in $(Au, v) - (u, Av)$ vanish for $u' + hu = 0$ and $v' + hv = 0$ at $x = L$?
Why: Both functions satisfy the same linear condition, so the boundary term cancels and the operator stays symmetric.
Problems
✏️ Pen & paperInsulated at one end●○○
Solve −y′′=λy on [0,L] with y(0)=0 and y′(L)=0. Give the eigenvalues and eigenfunctions, and evaluate the first three for L=1.
Show worked solution
For λ≤0 the solution is sinh or a line vanishing at 0, with nonzero slope at L: no eigenvalue. For λ=μ2: y=sinμx and y′(L)=μcosμL=0, so μL=(k−21)π. Therefore λk=((k−21)π/L)2 and yk=sin((k−21)πx/L). For L=1: 2.4674,22.2066,61.6850, which are the h=0 row of the Robin table in the sim.
✏️ Pen & paperA bound without solving●●○
On [0,L] with Dirichlet ends, use the trial function y=x(L−x) to bound λ1 from above. By how many percent does the bound exceed the true value?
Show worked solution
∫0Ly′2=∫0L(L−2x)2dx=L3/3 and ∫0Ly2=L5/30, so R=10/L2. The true value is π2/L2, and 10/π2=1.0132: the bound is 1.3% too high, matching the sim’s 10.0000 against 9.8696 for L=1. It must be an upper bound because λ1 is the minimum of R.
✏️ Pen & paperSame trick, different interval●●○
Solve −(xy′)′=λy/x on [1,e2] with y(1)=y(e2)=0. Find λk, the eigenfunctions, and the weight that makes them orthogonal.
Show worked solution
With t=lnx∈[0,2] the equation is −ytt=λy with Dirichlet ends, so λk=(kπ/2)2 and yk=sin(kπlnx/2). Orthogonality: ∫1e2yjykdx/x=∫02sin(jπt/2)sin(kπt/2)dt=0 for j=k, so the weight is 1/x. The first eigenvalue is π2/4=2.4674.
✏️ Pen & paperHow long until the fundamental dominates?●●●
A rod with L=α=1 and ends held at 0 starts with equal amounts of modes 1 and 2. When is mode 1 down to 1% of its start, and what fraction of its start is mode 2 then?
Show worked solution
e−π2t=0.01 gives t=ln100/π2=0.4666. Mode 2 is e−4π2t=(e−π2t)4=10−8 of its start, a million times smaller than mode 1 in relative terms, and modes 3,4,… are smaller still. The long-time shape is the first eigenfunction.
Key Takeaways
−y′′=λy with boundary conditions has nonzero solutions only for special λ. Dirichlet gives (kπ/L)2 with sin (k≥1); Neumann the same values with cos plus the eigenvalue 0 (k≥0).
Robin ends give tanμL=−μ/h, solved numerically: at L=1, h=1, λ1=4.1159, between 2.4674 (h=0) and 9.8696 (h→∞).
The boundary term [−p(u′v−uv′)] vanishes for all these conditions, so the operator is symmetric: real eigenvalues, orthogonal eigenfunctions, as for symmetric matrices.
The Sturm–Liouville form −(py′)′+qy=λwy puts the weight w into the inner product: for p=x, w=1/x the unweighted inner product of modes 1 and 2 is −0.1778, the weighted one zero. Simplicity, ordering, k−1 zeros and completeness are from memory.
The Rayleigh quotient shows λ1>0 for Dirichlet ends and bounds it above: x(1−x) gives 10.0000 against 9.8696.
The second-difference matrix has eigenvalues (2−2coskπh)/h2, with errors growing like k2 and a ceiling of 4/h2.
Each eigenvalue is a decay rate e−λkt; the initial condition needs an expansion in the eigenfunctions, the next lesson (8.3 Fourier Series).
Finished this lesson?
Mark it complete to track your progress (saved in this browser). Reading every section does this for you.