Fourier series: coefficients, even and odd extensions, convergence and Parseval
Ten problems on Fourier series: the orthogonality integrals of sines and cosines on [−π, π], the square wave with its Gibbs overshoot, the sawtooth f(x) = x and its value at the jump, the cosine series of |x| and the sum of 1/(2k − 1)², the series of x² and the Basel sum π²/6, a function of period 4 with the coefficients over L, the half-range sine series of x(π − x) and a sum of alternating cubes, Parseval's identity for the sum of 1/n⁴, the complex form of e^x and the alternating sum of 1/(1 + n²), and the periodic response of y″ + 4y to a square wave, solved term by term, with worked solutions and the mistakes of writing a₀ instead of a₀/2, dividing by π when the period is 2L, taking the series to equal f at a jump, treating cos nπ as 0 and leaving the a₀ term out of Parseval's identity.
Before you start
A Fourier series writes a periodic function as a sum of sines and cosines whose frequencies are whole multiples of one base frequency. Where a Taylor series matches a function at one point, a Fourier series matches it over a whole period, and it works even for functions with corners and jumps, such as a square wave, that have no Taylor series at all. The coefficients come from one fact: on a full period, the sines and cosines are orthogonal, so integrating the function against cosnx or sinnx picks out exactly one coefficient, the way a dot product with a unit vector picks out one coordinate. Symmetry halves the work, since an even function has only cosines and an odd one only sines. At a jump the series lands on the average of the two sides, and Parseval's identity turns the energy of the function into a sum of squared coefficients, which is how series such as ∑1/n2=π2/6 get evaluated. The same expansion, in complex form, is the discrete Fourier transform behind signal processing and spectral methods. These ten problems compute coefficients, use symmetry and general periods, decide what the series converges to and solve a forced oscillator one frequency at a time.
Period .2π.f(x)∼2a0+∑n≥1(ancosnx+bnsinnx) with an=π1∫−ππf(x)cosnxdx and .bn=π1∫−ππf(x)sinnxdx. The constant term is ,2a0, the average of f over a period.
Orthogonality. On ,[−π,π],∫sinmxsinnxdx and ∫cosmxcosnxdx are 0 for m=n and π for ,m=n≥1, and ∫sinmxcosnxdx=0 always.
Period .2L. Replace nx by Lnπx and π1∫−ππ by .L1∫−LL.
Symmetry. If f is even, every bn=0 and .an=π2∫0πf(x)cosnxdx. If f is odd, every an=0 and .bn=π2∫0πf(x)sinnxdx. A function given only on [0,π] can be extended either way: the odd extension gives the half-range sine series, the even one the half-range cosine series.
Values at multiples of .π.sinnπ=0 and .cosnπ=(−1)n.
Convergence (Dirichlet). For a piecewise smooth ,f, the series converges to f(x) where f is continuous and to the average 21(f(x−)+f(x+)) at a jump, including the jump where the periodic extension wraps around. Near a jump the partial sums overshoot by about 9% of the jump (the Gibbs phenomenon), however many terms are kept.
∫−ππcoskxdx=0 for k=0Over a whole number of periods a cosine has as much area above the axis as below.
sin24x=21(1−cos8x)The same identity with :A=B: the cos0=1 term survives.
∫−ππ21dx=πOnly the constant contributes.
,0,π and 0The last integrand cos2xsin7x is odd, so its integral over [−π,π] is 0 without any work. These three facts are why integrating against sinnx picks out bn alone.
Problem 2
Find the Fourier series of the square wave of period ,2π,
f(x)={−11−π<x<00<x<π,
and write out its first three nonzero terms.
an=0 for every nf is odd, so f(x)cosnx is odd and integrates to ;0; that includes .a0.
bn=π2∫0πsinnxdxFor an odd function, twice the integral over .[0,π].
=nπ2(1−cosnπ)=nπ2(1−(−1)n).[−ncosnx]0π.
bn=nπ4 for odd ,n,bn=0 for even n1−(−1)n is 2 or .0.
f(x)∼π4(sinx+31sin3x+51sin5x+⋯)The coefficients shrink only like ,1/n, the mark of a jump. Near each jump the partial sums peak at about 1.179 instead of :1: an overshoot of about ,0.179, or 9% of the jump of ,2, which moves closer to the jump but does not shrink as terms are added.
Problem 3
Find the Fourier series of f(x)=x on ,−π<x<π, extended with period .2π. What does the series converge to at x=π/2 and at ?x=π?
an=0x is odd.
bn=π2∫0πxsinnxdxTwice the half-period integral.
∫0πxsinnxdx=[−nxcosnx]0π+n1∫0πcosnxdxParts with ,u=x,.dv=sinnxdx. The last integral is .0.
,=−nπ(−1)n, so bn=n2(−1)n+1.cosnπ=(−1)n.
;x∼2(sinx−21sin2x+31sin3x−⋯); it converges to 2π at x=2π and to 0 at x=πAt π the periodic extension jumps from π down to ,−π, and the series takes the average, :0: every term has sinnπ=0 (Mistake 3). At π/2 the series reads ,2(1−31+51−⋯)=2π, which is Leibniz's .1−31+51−⋯=4π.
Problem 4
Find the Fourier series of f(x)=∣x∣ on ,[−π,π], and use it at x=0 to find .∑k≥1(2k−1)21.
bn=0 and a0=π2∫0πxdx=π∣x∣ is even. The constant term is ,2a0=2π, its average.
an=π2∫0πxcosnxdx=π2[nxsinnx+n2cosnx]0πIntegration by parts.
an=πn22((−1)n−1)The sin term vanishes at both ends; cosnπ=(−1)n and .cos0=1.
an=−πn24 for odd ,n,0 for even nMistaking cosnπ for 0 gives −πn22 for every n (Mistake 4).
0=2π−π4∑k≥1(2k−1)21At x=0 the function is continuous, so the series equals .∣0∣=0.
,∣x∣∼2π−π4(cosx+91cos3x+251cos5x+⋯), and ∑(2k−1)21=8π2≈1.2337The coefficients fall like ,1/n2, faster than the square wave's: ∣x∣ has corners but no jumps.
Problem 5
Find the Fourier series of f(x)=x2 on .[−π,π]. Evaluate it at x=π to find ,∑n≥1n21, and at x=0 to find .∑n≥1n2(−1)n+1.
a0=π2∫0πx2dx=32π2Even function, so .bn=0. The constant term is .2a0=3π2.
an=π2∫0πx2cosnxdx=n24(−1)nIntegrate by parts twice; only the term n22xcosnx survives at the ends.
x2∼3π2+4∑n≥1n2(−1)ncosnxAssemble the series.
At :x=π:π2=3π2+4∑n21.(−1)ncosnπ=1. The periodic extension of x2 is continuous at ,π, so the series equals π2 there.
At :x=0:0=3π2−4∑n2(−1)n+1.(−1)ncos0=(−1)n.
∑n21=6π2≈1.6449 and ∑n2(−1)n+1=12π2≈0.8225The Basel sum. Writing a0 instead of 2a0 as the constant term breaks both evaluations (Mistake 1).
Problem 6
Let f have period ,4, with f(x)=0 for −2<x<0 and f(x)=x for .0<x<2. Find its Fourier series, and the value the series converges to at .x=2.
,L=2, so the terms are cos2nπx and sin2nπxThe period is .2L=4.
a0=21∫02xdx=1,L1∫−LL, and f=0 on the left half. The constant term 2a0=21 is the average of f over a period.
an=21∫02xcos2nπxdx=n2π22((−1)n−1)Parts with :k=2nπ:.[kxsinkx+k2coskx]02=k2(−1)n−1.
bn=21∫02xsin2nπxdx=nπ2(−1)n+1;21[−kxcoskx]02=−k(−1)n; the sinkx term vanishes.
f∼21−π24∑n oddn21cos2nπx+π2∑n≥1n(−1)n+1sin2nπxThe cosine terms are the even part of ,f, the sine terms the odd part.
At x=2 the series converges to 1f jumps from 2 down to 0 there, and .21(2+0)=1. Check: cosnπ=−1 for odd n gives ,21+π24⋅8π2=1, using Problem 4. Using π1 in place of L1 gives the wrong average (Mistake 2).
Problem 7
Find the half-range sine series of f(x)=x(π−x) on ,[0,π], and evaluate it at x=π/2 to find .1−331+531−731+⋯.
Extend f to [−π,0] as an odd functionThen the series has sines only, and on [0,π] it represents f itself.
bn=π2∫0πx(π−x)sinnxdxThe odd-function formula.
bn=πn34(1−(−1)n)Parts three times, or split as πx−x2 and reuse the integrals of Problems 3 and 5.
bn=πn38 for odd ,n,0 for even nThe odd extension is smooth enough that its coefficients fall like .1/n3.
4π2=π8(1−331+531−⋯)At ,x=2π,,f=4π2, and sin2nπ is 1,−1,1,… for n=1,3,5,…
,x(π−x)∼π8(sinx+271sin3x+1251sin5x+⋯), and the sum is 32π3≈0.9689The first term alone already has nearly the right height: its peak π8≈2.546 is close to the true peak .4π2≈2.467.
Problem 8
Apply Parseval's identity to the series of x2 from Problem 5 to find .∑n≥1n41.
π1∫−ππx4dx=52π4The left side of Parseval: .π1⋅52π5.
2a02=21(32π2)2=92π4The constant term's share, with .a0=32π2.
∑an2=∑n416an=n24(−1)n and .bn=0.
16∑n41=52π4−92π4=458π4Solve for the sum.
∑n41=90π4≈1.0823Leaving out the 2a02 term gives 40π4≈2.435 (Mistake 5).
Problem 9
Find the complex Fourier coefficients cn of f(x)=ex on ,−π<x<π, extended with period .2π. Use the series at x=0 to find .∑n≥11+n2(−1)n.
cn=2π1∫−ππe(1−in)xdxCombine ex and .e−inx.
=2π(1−in)e(1−in)π−e−(1−in)πThe exponential rule with a complex constant.
e∓inπ=(−1)nSo the numerator is .(−1)n(eπ−e−π)=2(−1)nsinhπ.
cn=π(1−in)(−1)nsinhπFor every integer ,n, including ,n=0, where c0=πsinhπ is the average of .ex.
cn+c−n=π(−1)nsinhπ⋅1+n22At x=0 every ;einx=1; pair n with ,−n, since .1−in1+1+in1=1+n22.
1=πsinhπ(1+2∑n≥11+n2(−1)n)ex is continuous at ,0, so the series equals .e0=1.
,cn=π(1−in)(−1)nsinhπ, and ∑1+n2(−1)n=21(sinhππ−1)≈−0.3640At x=π the series converges instead to ,coshπ, the average of e−π and .eπ.
Problem 10
Find the periodic solution of ,y′′+4y=f(x), where f is the square wave of Problem 2, as a Fourier series, and give its first three nonzero terms.
Try y=∑n oddBnsinnxThe forcing has only odd sine terms, and the equation maps sinnx to a multiple of itself.
(sinnx)′′+4sinnx=(4−n2)sinnxDifferentiate twice.
(4−n2)Bn=nπ4 for odd nMatch the coefficients of sinnx on both sides.
Bn=nπ(4−n2)4No odd n makes :4−n2=0: the forcing has no sin2x term, so there is no resonance with the natural frequency .2.
,B1=3π4≈0.4244,,B3=−15π4≈−0.0849,B5=−105π4≈−0.01214−n2 is ,3,,−5,.−21.
y=3π4sinx−15π4sin3x−105π4sin5x−⋯The Bn fall like ,1/n3, so the response is far smoother than the square wave that drives it. Terms below the natural frequency stay in phase with the forcing; those above it come out with the opposite sign.
Where this goes wrong
1. a₀ written as the constant term instead of a₀/2
The constant term is taken straight from the coefficient formula.
a0=π1∫−ππx2dx=32π2Right so far: Problem 5.
“.x2∼32π2+4∑n2(−1)ncosnx.”The formula for an with n=0 has a π1 where the average needs ,2π1, which is why the series starts with .2a0.
At :x=0:0=32π2−4⋅12π2The right side is ,3π2, not :0: the series is shifted up by 3π2 everywhere. With the correct constant 3π2 it gives ,0, and at x=π the shifted series gives 34π2 instead of .π2.
2. Dividing by π when the period is 2L
The coefficient formulas for period 2π are used on a function of period .4.
f=x on ,(0,2),0 on ,(−2,0), period 4Right so far: Problem 6.
“.a0=π1∫02xdx=π2.”For period 2L the factor is ,L1=21, and the arguments are :Lnπx: the π belongs inside the sines and cosines, not in front.
The constant term is 2a0=π1≈0.318The average of f over a period is ,41∫02xdx=21, so the right a0 is .1. Even with the right arguments ,2nπx, every other coefficient is off by the same factor .π2.
3. The series taken to equal f at a jump
The series of x on (−π,π) is evaluated at x=π by plugging π into .x.
x∼2∑n(−1)n+1sinnx on (−π,π)Right so far: Problem 3.
“At x=π the function is .π.”The series represents the periodic extension, which jumps from π to −π at .x=π.
The series converges to π at x=πEvery term is ,sinnπ=0, so the series is 0 there: the average ,21(π+(−π)), as Dirichlet's theorem says. It equals x only strictly inside .(−π,π).
4. cos nπ taken as 0
In the coefficients of ,∣x∣, the endpoint terms are evaluated with cosnπ confused with .sinnπ.
an=π2[nxsinnx+n2cosnx]0πRight so far: Problem 4.
“,cosnπ=0, so the bracket is .0−n21.”,sinnπ=0, but ,cosnπ=(−1)n, so the bracket is .n2(−1)n−1.
an=−πn22 for every nThen at x=0 the series gives 2π−π2⋅6π2=6π≈0.524 instead of .∣0∣=0. The right an is −πn24 for odd n and 0 for even .n.
5. The a₀ term left out of Parseval's identity
Parseval is remembered as "the integral of f2 is the sum of the squared coefficients", for .n≥1.
π1∫−ππx4dx=52π4 and an=n24(−1)nRight so far: Problem 8.
“.52π4=∑n416.”The constant term carries part of the energy: the identity has 2a02=92π4 on the right as well.
∑n41=40π4≈2.435That cannot be right, since .1+∑n≥2n41<1+∑n≥2n21≈1.645. With the 2a02 term the sum is .90π4≈1.0823.
Print this set: fourier-series.pdf (problems, answers, and worked solutions on separate pages).