8.2 Eigenvalue Problems & Sturm–Liouville Theory ended with a promise. Every Sturm–Liouville problem hands you eigenfunctions that are mutually perpendicular, and the heat equation needs the initial temperature written as . Perpendicular directions mean the coefficients are found by projecting, exactly as in 1.1 Vectors, Linear Combinations & Span: . This lesson does the projection for the most important family of all, the sines and cosines. The expansion is a Fourier series. The same idea sits behind the FFT in a fluid solver and the way we read a turbulence spectrum.
Transcript
- A function has period two pi if it repeats every two pi. Give it on one period and repeat it forever: the periodic extension. Why sines and cosines? Take minus y double prime equals lambda y with periodic conditions: same value and same slope at both ends. The boundary bracket from the last lesson cancels, so the operator is symmetric. The eigenvalues are k squared, with two eigenfunctions each, cosine k x and sine k x, plus the constant for k equal 0.
- Now the products. The integral of cosine j x times cosine k x over a full period is zero when j and k differ, and pi when they are equal. Sines behave the same. The mixed integral of sine times cosine is zero for every j and k, because the integrand is odd. The picture shows it: sine x times sine 2 x has equal positive and negative areas. That pi is the squared length of each basis function.
- Suppose f is a constant over two, plus a sum of cosines and sines. Multiply by cosine j x and integrate over a period, term by term. Orthogonality kills every term except k equal j, leaving a j times pi. So a k is one over pi times the integral of f cosine k x, and b k the same with sine. The constant a 0 over 2 is the average of f. It is a vector projection: dot product over squared length. Nothing needs f smooth. Jumps are allowed.
- Take the square wave: minus 1 on the left half, plus 1 on the right. It is odd, so every cosine coefficient is zero. For the sines, b k equals 4 over k pi for odd k, and zero for even k. So the square wave is 4 over pi times sine x plus sine 3 x over 3, plus sine 5 x over 5, and so on. The sim finds the coefficients by quadrature, never seeing this formula: 1.273240, 0.424413 and 0.254648.
- Now add the terms. One term overshoots the target 1: its maximum is 1.2732. Three terms: 1.2004. Five terms: 1.1884. The corners sharpen, yet the maximum does not return to 1. At 39 terms the sim still reports a maximum near 1.179. That surviving bump of about 18 percent is the Gibbs phenomenon: next to a jump the overshoot gets narrower, but not shorter. Exactly at the jump every sine is zero, so the series lands on the midpoint.
- The sawtooth f equal x is odd. Integrating by parts, b k is 2 times minus 1 to the k plus 1, over k. The triangle, absolute value of x, is even, with a k equal minus 4 over pi k squared for odd k. The difference matters. The sawtooth has a jump, and its coefficients fall like 1 over k. The triangle has only a corner, and they fall like 1 over k squared. Differentiate the triangle series term by term and you get the square wave.
- Smoothness sets the decay, and integration by parts shows it. A jump in f leaves a boundary term of size 1 over k. A jump in the slope gives 1 over k squared. A smooth periodic function falls faster than any power. The root mean square error agrees. After 39 terms the square wave still has 10 percent error, the triangle 0.15 percent, and exp of cosine x nothing visible. All converge in the mean-square sense, at very different speeds.
- Write cosine and sine as complex exponentials and the series becomes a sum of c k times e to the i k x. For real f, c k is a k minus i b k, over 2. The gain is the shift theorem: slide the function by s and c k is multiplied by e to the minus i k s. Only the phase turns. For the square wave, a 1 and b 1 are 0 and 1.2732, then minus 1.071 and 0.688 at s equal 1, then minus 1.158 and minus 0.530 at s equal 2. The length of c 1 stays 0.6366. These magnitudes are the spectrum.
- Square the series and orthogonality kills every cross term. The mean of f squared equals the constant squared plus one half the sum of a k squared and b k squared: Pythagoras in infinitely many dimensions. So the energy missed by the partial sum equals the mean square of its error. For the square wave, one term holds 81.06 percent of the energy, three terms 90.06, five terms 93.31, and 39 terms 98.99. The direct error at 3 terms is 0.31523, and so is the square root of 1 minus 0.90063. Parseval also sums series: pi squared over 8.
- One catch remains. The heat problem gives f only on 0 to L, with the ends held at zero, so the eigenfunctions are sines alone. A full-period series needs f on the negative half too. Which extension? Take f equal x. The odd extension is the sawtooth, with a jump at the wall. The even extension is the triangle, with only a corner. After 39 terms the sawtooth's error is 0.225, against 0.00145 for the triangle: about 150 times worse. The extension must respect the boundary condition. That is the next lesson.
Why sines and cosines, and what “periodic” means
A function has period if for every . Give only on and repeat it forever to the left and right: that is its periodic extension. Everything below lives on that circle of length (period comes later by rescaling).
Why these functions? Consider the eigenvalue problem with the periodic conditions and . The boundary term from the previous lesson, , vanishes for any two functions obeying these conditions, because each term at equals the term at . So the operator is symmetric and the orthogonality argument applies. The solutions are with two eigenfunctions, and , for each , and with the constant. (Last lesson’s “eigenvalues are simple” assumed separated end conditions, which periodic ones are not; the multiplicity two is the cost of that.) So we are expanding in an orthogonal basis exactly as promised. The only new work is computing the inner products.
Orthogonality on a full period
For integers use the product identities , and the analogous ones for and . The integral of over is for an integer and for , which gives
The mixed integral vanishes by symmetry alone: is odd, and an odd function integrates to zero over an interval symmetric about . The squares carry the number because averages to one half over a length . That is the “length squared” of the basis vectors and appears in every coefficient formula.
The Euler–Fourier formulas
Suppose can be written
Multiply by and integrate over a period, term by term (the exchange of sum and integral is the step we are assuming; the next lessons discuss when it is legal). Orthogonality kills every term except the one with :
The sine formula is the same calculation with . The constant term is written so that the same formula serves : with the left side is , so is simply the average of over a period. Compare with a vector: the component along a unit direction is the dot product; here has squared length , so we divide by it. The series is the projection of onto each direction, added back together.
Nothing in the derivation required to be smooth. It needed only that the integrals exist, which holds for any piecewise continuous , jumps included. That is the main advantage over a Taylor series.
Worked example 1: the square wave
Let on and on . This is odd, so is odd and every . For the sine coefficients, is even, so we double the right half:
so
The sim, which computes the coefficients by quadrature on 16000 cells and never looks at this formula, gives , , , with all even and all zero to six digits. These agree with , and .
Worked example 2: the sawtooth and the triangle
For on , again odd, so . Integrate by parts, :
The coefficients are , and the sim returns .
For the function is even, so and . For , , so
The sim gives and , matching , , .
What to try. (1) Square wave, . (2) Switch to the triangle at the same and compare the error panels. (3) Select and watch the error plunge. (4) Slide the shift on the square wave: the bars change, the ticks do not. (5) Read the energy percentage against the readout of the direct error.
Reading the partial sums
Write . For the square wave , a smooth bump that overshoots the target value at its peak: the sim gives . Adding puts in a dip and lifts the plateau: and . The corners keep sharpening, yet the maximum does not return to . At the sim still reports a maximum near . That surviving 18% bump is the Gibbs phenomenon: the overshoot next to a jump shrinks in width but not in height. 8.5 Convergence & the Gibbs Phenomenon explains its size and why it is no contradiction; the next section measures what the series does get right.
At the jump itself every term vanishes at , so for all : the series assigns the midpoint of the jump, . This holds at any jump (from memory).
Smoothness decides how fast the coefficients fall
The three waves above have coefficients that fall like (square, sawtooth: a jump in ) and (triangle: a corner, a jump in ). The reason is integration by parts. For a function with a jump of size at some point, leaves a boundary term of size that does not shrink faster; if is continuous but jumps, the first boundary term cancels and the next is of size ; and so on. For a smooth periodic function (all derivatives continuous and periodic) every integration by parts gains another , so the coefficients fall faster than any power (from memory: this is the standard smoothness-decay theorem; the sim shows examples).
A second view of the same fact: differentiate the triangle’s series term by term. , and
the square wave series exactly. Differentiation multiplies the -th coefficient by , and the became . This is why spectral methods differentiate in Fourier space, and why derivatives of rough data amplify noise.
The sim puts numbers on it. The sizes of the root-mean-square error of (the square root of the average of over a period), measured directly on a 4000-point grid, are:
| square wave | triangle | ||
|---|---|---|---|
| below |
Forty terms leave the square wave with 10% error, the triangle with 0.15%, and with nothing visible. All three converge in this root-mean-square sense; they differ enormously in speed.
The complex form
Write and . The series becomes
The orthogonality is the single statement (the bar means complex conjugate; one integral instead of six). The derivation of the formula for is the same projection, and the relation to follows by substituting . One advantage is the shift theorem: moving the function, , gives
so only the phase of changes and the magnitude does not. The sim confirms it for the square wave: for every shift, while at turns into at , and at . These match and , from .
For a real the information in is the pair (amplitude, phase) of the -th wave. The collection is the spectrum of : how much of each wavenumber is present, whatever the position.
Parseval: energy is conserved in the transform
The mean of over a period is the energy. Squaring the series and using orthogonality kills every cross term:
This is Pythagoras in infinitely many dimensions: the squared length of the vector equals the sum of the squares of its components. It also tells us exactly what terms cost. The energy missed by equals the tail of the sum, and equals the mean square of the error . The sim checks this two ways. For the square wave the mean square is , and the energy in terms is : for , for , for and for . Its direct rms error at is , and (the readout prints both). For the triangle already captures of the energy.
Parseval also sums series. For the square wave, gives . For the triangle the mean square is and , so , i.e. .
Other periods
If has period , substitute so that . The basis becomes and and the formulas read
On the sines here are the Dirichlet eigenfunctions of the previous lesson and the cosines the Neumann ones.
Computing it
Now build the two pieces yourself: the projection and the sum.
The catch: we are not done with the heat equation
The heat problem of the last lesson gives only on , with at both ends, so the eigenfunctions are the sines alone. A full-period series on needs on the negative half too. Which extension should we use? Take on . Extending it as an odd function gives the sawtooth, whose series is all sines with coefficients . Extending it as an even function gives the triangle, whose series is all cosines with coefficients (odd ). Both series equal on , but at the sawtooth’s rms error is against for the triangle, about 150 times worse, because the odd extension has a jump at the wall. The jump costs a tail and the Gibbs overshoot; the corner of the even extension costs only . So the choice of extension decides convergence and must match the boundary condition. That is the subject of 8.4 Even & Odd Extensions: Sine and Cosine Series, where sine and cosine series follow from this lesson’s formulas by symmetry. What we still have not proved here is that the series converges to , and where; the sim shows mean-square convergence and a stubborn overshoot, which 8.5 Convergence & the Gibbs Phenomenon handles honestly.
Concept checks
Problems
Let . Without integrating, list and the complex coefficient . Then use Parseval to find the mean of over a period.
Show worked solution
The series is already in Fourier form: so ; ; ; . With , . Parseval: . A numerical average over a period returns .
Find the Fourier series of on . Evaluate the series at to sum , and use Parseval to sum .
Show worked solution
is even, so . . For integrate by parts twice: , so . Thus
At every , so and . (This uses that the series converges to at a point where is continuous and the periodic extension is continuous: from memory, justified in the next lessons.) Parseval: the mean square is , and , so , giving . A numerical quadrature of gives , matching .
The function on is repeated with period (). Find and evaluate .
Show worked solution
is odd, so and . With , this is . So (numerical quadrature agrees). In general : the sawtooth of the lesson stretched to length .
Take on . Extend it oddly and find the Fourier series. What do you recognise, and what would the even extension give?
Show worked solution
The odd extension is on and on : the square wave, with series , and a jump at with decay. The even extension is the constant on all of : its series is just with every other coefficient zero. So for the same data on , the cosine series is exact in one term while the sine series converges slowly.
Key Takeaways
- Sines and cosines are orthogonal on a full period: and every cross integral is . They are the eigenfunctions of with periodic ends, with doubled.
- The Euler–Fourier formulas , are projections; is the mean. For period replace by and by .
- Square wave: for odd (, , ); sawtooth ; triangle for odd , all checked by quadrature in the sim.
- Smoothness sets the decay: a jump in gives , a jump in gives , a smooth periodic function decays faster than any power; at the rms errors are , and below .
- Complex form ; shifting rotates the phase of but leaves alone.
- Parseval: mean of ; the energy missed by equals the mean square error, and the identity sums series (, ).
- Convergence is in the mean-square sense; next to a jump the partial sums overshoot by about (max at ). Convergence and Gibbs are the business of 8.5 Convergence & the Gibbs Phenomenon.
- Which extension of from to the full period we choose changes the convergence and must respect the boundary conditions: 8.4 Even & Odd Extensions: Sine and Cosine Series.