Practice / Calculus

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 cos⁡nx\cos nx or sin⁡nx\sin nx 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\sum 1/n^2 = \pi^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π2\pi. f(x)∼a02+∑n≥1(ancos⁡nx+bnsin⁡nx)f(x) \sim \frac{a_0}{2} + \sum_{n\ge1}(a_n\cos nx + b_n\sin nx) with an=1π∫−ππf(x)cos⁡nx dxa_n = \frac1\pi\int_{-\pi}^{\pi}f(x)\cos nx\,dx and bn=1π∫−ππf(x)sin⁡nx dxb_n = \frac1\pi\int_{-\pi}^{\pi}f(x)\sin nx\,dx. The constant term is a02\frac{a_0}{2}, the average of ff over a period.
  • Orthogonality. On [−π,π][-\pi, \pi], ∫sin⁡mxsin⁡nx dx\int\sin mx\sin nx\,dx and ∫cos⁡mxcos⁡nx dx\int\cos mx\cos nx\,dx are 00 for m≠nm \ne n and π\pi for m=n≥1m = n \ge 1, and ∫sin⁡mxcos⁡nx dx=0\int\sin mx\cos nx\,dx = 0 always.
  • Period 2L2L. Replace nxnx by nπxL\frac{n\pi x}{L} and 1π∫−ππ\frac1\pi\int_{-\pi}^{\pi} by 1L∫−LL\frac1L\int_{-L}^{L}.
  • Symmetry. If ff is even, every bn=0b_n = 0 and an=2π∫0πf(x)cos⁡nx dxa_n = \frac2\pi\int_0^\pi f(x)\cos nx\,dx. If ff is odd, every an=0a_n = 0 and bn=2π∫0πf(x)sin⁡nx dxb_n = \frac2\pi\int_0^\pi f(x)\sin nx\,dx. A function given only on [0,π][0, \pi] 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 π\pi. sin⁡nπ=0\sin n\pi = 0 and cos⁡nπ=(−1)n\cos n\pi = (-1)^n.
  • Convergence (Dirichlet). For a piecewise smooth ff, the series converges to f(x)f(x) where ff is continuous and to the average 12(f(x−)+f(x+))\frac12\big(f(x^-) + f(x^+)\big) at a jump, including the jump where the periodic extension wraps around. Near a jump the partial sums overshoot by about 9%9\% of the jump (the Gibbs phenomenon), however many terms are kept.
  • Parseval. 1π∫−ππf(x)2 dx=a022+∑n≥1(an2+bn2)\frac1\pi\int_{-\pi}^{\pi}f(x)^2\,dx = \frac{a_0^2}{2} + \sum_{n\ge1}(a_n^2 + b_n^2).
  • Complex form. f(x)∼∑n=−∞∞cneinxf(x) \sim \sum_{n=-\infty}^{\infty}c_ne^{inx} with cn=12π∫−ππf(x)e−inx dxc_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)e^{-inx}\,dx. For real ff, cn=12(an−ibn)c_n = \frac12(a_n - ib_n) and c−n=cn‾c_{-n} = \overline{c_n}.

Builds on: Integration: substitution and parts, Trig identities, Series convergence tests: geometric, divergence, integral, comparison and alternating

Problems

  1. ·

    Compute ∫−ππsin⁡3xsin⁡5x dx\int_{-\pi}^{\pi}\sin3x\sin5x\,dx, ∫−ππsin⁡24x dx\int_{-\pi}^{\pi}\sin^24x\,dx and ∫−ππcos⁡2xsin⁡7x dx\int_{-\pi}^{\pi}\cos2x\sin7x\,dx, and explain why each comes out as it does.

  2. ·

    Find the Fourier series of the square wave of period 2π2\pi,

    f(x)={−1−π<x<010<x<π,f(x) = \begin{cases} -1 & -\pi < x < 0 \\ 1 & 0 < x < \pi, \end{cases}

    and write out its first three nonzero terms.

  3. ··

    Find the Fourier series of f(x)=xf(x) = x on −π<x<π-\pi < x < \pi, extended with period 2π2\pi. What does the series converge to at x=π/2x = \pi/2 and at x=πx = \pi?

  4. ··

    Find the Fourier series of f(x)=∣x∣f(x) = \lvert x\rvert on [−π,π][-\pi, \pi], and use it at x=0x = 0 to find ∑k≥11(2k−1)2\sum_{k\ge1}\frac{1}{(2k - 1)^2}.

  5. ··

    Find the Fourier series of f(x)=x2f(x) = x^2 on [−π,π][-\pi, \pi]. Evaluate it at x=πx = \pi to find ∑n≥11n2\sum_{n\ge1}\frac{1}{n^2}, and at x=0x = 0 to find ∑n≥1(−1)n+1n2\sum_{n\ge1}\frac{(-1)^{n+1}}{n^2}.

  6. ···

    Let ff have period 44, with f(x)=0f(x) = 0 for −2<x<0-2 < x < 0 and f(x)=xf(x) = x for 0<x<20 < x < 2. Find its Fourier series, and the value the series converges to at x=2x = 2.

  7. ··

    Find the half-range sine series of f(x)=x(π−x)f(x) = x(\pi - x) on [0,π][0, \pi], and evaluate it at x=π/2x = \pi/2 to find 1−133+153−173+⋯1 - \frac{1}{3^3} + \frac{1}{5^3} - \frac{1}{7^3} + \cdots.

  8. ···

    Apply Parseval's identity to the series of x2x^2 from Problem 5 to find ∑n≥11n4\sum_{n\ge1}\frac{1}{n^4}.

  9. ···

    Find the complex Fourier coefficients cnc_n of f(x)=exf(x) = e^x on −π<x<π-\pi < x < \pi, extended with period 2π2\pi. Use the series at x=0x = 0 to find ∑n≥1(−1)n1+n2\sum_{n\ge1}\frac{(-1)^n}{1 + n^2}.

  10. ···

    Find the periodic solution of y′′+4y=f(x)y'' + 4y = f(x), where ff is the square wave of Problem 2, as a Fourier series, and give its first three nonzero terms.

Worked solutions

Problem 1

Compute ∫−ππsin⁡3xsin⁡5x dx\int_{-\pi}^{\pi}\sin3x\sin5x\,dx, ∫−ππsin⁡24x dx\int_{-\pi}^{\pi}\sin^24x\,dx and ∫−ππcos⁡2xsin⁡7x dx\int_{-\pi}^{\pi}\cos2x\sin7x\,dx, and explain why each comes out as it does.

  1. sin⁡3xsin⁡5x=12(cos⁡2x−cos⁡8x)\sin3x\sin5x = \tfrac12(\cos2x - \cos8x)The product-to-sum identity sin⁡Asin⁡B=12(cos⁡(A−B)−cos⁡(A+B))\sin A\sin B = \tfrac12\big(\cos(A - B) - \cos(A + B)\big).
  2. ∫−ππcos⁡kx dx=0\int_{-\pi}^{\pi}\cos kx\,dx = 0 for k≠0k \ne 0Over a whole number of periods a cosine has as much area above the axis as below.
  3. sin⁡24x=12(1−cos⁡8x)\sin^24x = \tfrac12(1 - \cos8x)The same identity with A=BA = B: the cos⁡0=1\cos 0 = 1 term survives.
  4. ∫−ππ12 dx=π\int_{-\pi}^{\pi}\tfrac12\,dx = \piOnly the constant contributes.
  5. 00, π\pi and 00The last integrand cos⁡2xsin⁡7x\cos2x\sin7x is odd, so its integral over [−π,π][-\pi, \pi] is 00 without any work. These three facts are why integrating against sin⁡nx\sin nx picks out bnb_n alone.

Problem 2

Find the Fourier series of the square wave of period 2π2\pi,

f(x)={−1−π<x<010<x<π,f(x) = \begin{cases} -1 & -\pi < x < 0 \\ 1 & 0 < x < \pi, \end{cases}

and write out its first three nonzero terms.

  1. an=0a_n = 0 for every nnff is odd, so f(x)cos⁡nxf(x)\cos nx is odd and integrates to 00; that includes a0a_0.
  2. bn=2π∫0πsin⁡nx dxb_n = \tfrac2\pi\int_0^\pi\sin nx\,dxFor an odd function, twice the integral over [0,π][0, \pi].
  3. =2nπ(1−cos⁡nπ)=2nπ(1−(−1)n)= \tfrac{2}{n\pi}\big(1 - \cos n\pi\big) = \tfrac{2}{n\pi}\big(1 - (-1)^n\big)[−cos⁡nxn]0π\big[-\tfrac{\cos nx}{n}\big]_0^\pi.
  4. bn=4nπb_n = \tfrac{4}{n\pi} for odd nn, bn=0b_n = 0 for even nn1−(−1)n1 - (-1)^n is 22 or 00.
  5. f(x)∼4π(sin⁡x+13sin⁡3x+15sin⁡5x+⋯)f(x) \sim \tfrac4\pi\big(\sin x + \tfrac13\sin3x + \tfrac15\sin5x + \cdots\big)The coefficients shrink only like 1/n1/n, the mark of a jump. Near each jump the partial sums peak at about 1.1791.179 instead of 11: an overshoot of about 0.1790.179, or 9%9\% of the jump of 22, which moves closer to the jump but does not shrink as terms are added.

Problem 3

Find the Fourier series of f(x)=xf(x) = x on −π<x<π-\pi < x < \pi, extended with period 2π2\pi. What does the series converge to at x=π/2x = \pi/2 and at x=πx = \pi?

  1. an=0a_n = 0xx is odd.
  2. bn=2π∫0πxsin⁡nx dxb_n = \tfrac2\pi\int_0^\pi x\sin nx\,dxTwice the half-period integral.
  3. ∫0πxsin⁡nx dx=[−xcos⁡nxn]0π+1n∫0πcos⁡nx dx\int_0^\pi x\sin nx\,dx = \Big[-\tfrac{x\cos nx}{n}\Big]_0^\pi + \tfrac1n\int_0^\pi\cos nx\,dxParts with u=xu = x, dv=sin⁡nx dxdv = \sin nx\,dx. The last integral is 00.
  4. =−π(−1)nn= -\tfrac{\pi(-1)^n}{n}, so bn=2(−1)n+1nb_n = \tfrac{2(-1)^{n+1}}{n}cos⁡nπ=(−1)n\cos n\pi = (-1)^n.
  5. x∼2(sin⁡x−12sin⁡2x+13sin⁡3x−⋯)x \sim 2\big(\sin x - \tfrac12\sin2x + \tfrac13\sin3x - \cdots\big); it converges to π2\tfrac\pi2 at x=π2x = \tfrac\pi2 and to 00 at x=πx = \piAt π\pi the periodic extension jumps from π\pi down to −π-\pi, and the series takes the average, 00: every term has sin⁡nπ=0\sin n\pi = 0 (Mistake 3). At π/2\pi/2 the series reads 2(1−13+15−⋯ )=π22(1 - \tfrac13 + \tfrac15 - \cdots) = \tfrac\pi2, which is Leibniz's 1−13+15−⋯=π41 - \tfrac13 + \tfrac15 - \cdots = \tfrac\pi4.

Problem 4

Find the Fourier series of f(x)=∣x∣f(x) = \lvert x\rvert on [−π,π][-\pi, \pi], and use it at x=0x = 0 to find ∑k≥11(2k−1)2\sum_{k\ge1}\frac{1}{(2k - 1)^2}.

  1. bn=0b_n = 0 and a0=2π∫0πx dx=πa_0 = \tfrac2\pi\int_0^\pi x\,dx = \pi∣x∣\lvert x\rvert is even. The constant term is a02=π2\tfrac{a_0}{2} = \tfrac\pi2, its average.
  2. an=2π∫0πxcos⁡nx dx=2π[xsin⁡nxn+cos⁡nxn2]0πa_n = \tfrac2\pi\int_0^\pi x\cos nx\,dx = \tfrac2\pi\Big[\tfrac{x\sin nx}{n} + \tfrac{\cos nx}{n^2}\Big]_0^\piIntegration by parts.
  3. an=2((−1)n−1)πn2a_n = \tfrac{2\big((-1)^n - 1\big)}{\pi n^2}The sin⁡\sin term vanishes at both ends; cos⁡nπ=(−1)n\cos n\pi = (-1)^n and cos⁡0=1\cos0 = 1.
  4. an=−4πn2a_n = -\tfrac{4}{\pi n^2} for odd nn, 00 for even nnMistaking cos⁡nπ\cos n\pi for 00 gives −2πn2-\tfrac{2}{\pi n^2} for every nn (Mistake 4).
  5. 0=π2−4π∑k≥11(2k−1)20 = \tfrac\pi2 - \tfrac4\pi\sum_{k\ge1}\tfrac{1}{(2k - 1)^2}At x=0x = 0 the function is continuous, so the series equals ∣0∣=0\lvert0\rvert = 0.
  6. ∣x∣∼π2−4π(cos⁡x+19cos⁡3x+125cos⁡5x+⋯)\lvert x\rvert \sim \tfrac\pi2 - \tfrac4\pi\big(\cos x + \tfrac19\cos3x + \tfrac{1}{25}\cos5x + \cdots\big), and ∑1(2k−1)2=π28≈1.2337\sum\tfrac{1}{(2k - 1)^2} = \tfrac{\pi^2}{8} \approx 1.2337The coefficients fall like 1/n21/n^2, faster than the square wave's: ∣x∣\lvert x\rvert has corners but no jumps.

Problem 5

Find the Fourier series of f(x)=x2f(x) = x^2 on [−π,π][-\pi, \pi]. Evaluate it at x=πx = \pi to find ∑n≥11n2\sum_{n\ge1}\frac{1}{n^2}, and at x=0x = 0 to find ∑n≥1(−1)n+1n2\sum_{n\ge1}\frac{(-1)^{n+1}}{n^2}.

  1. a0=2π∫0πx2 dx=2π23a_0 = \tfrac2\pi\int_0^\pi x^2\,dx = \tfrac{2\pi^2}{3}Even function, so bn=0b_n = 0. The constant term is a02=π23\tfrac{a_0}{2} = \tfrac{\pi^2}{3}.
  2. an=2π∫0πx2cos⁡nx dx=4(−1)nn2a_n = \tfrac2\pi\int_0^\pi x^2\cos nx\,dx = \tfrac{4(-1)^n}{n^2}Integrate by parts twice; only the term 2xcos⁡nxn2\tfrac{2x\cos nx}{n^2} survives at the ends.
  3. x2∼π23+4∑n≥1(−1)nn2cos⁡nxx^2 \sim \tfrac{\pi^2}{3} + 4\sum_{n\ge1}\tfrac{(-1)^n}{n^2}\cos nxAssemble the series.
  4. At x=πx = \pi: π2=π23+4∑1n2\pi^2 = \tfrac{\pi^2}{3} + 4\sum\tfrac{1}{n^2}(−1)ncos⁡nπ=1(-1)^n\cos n\pi = 1. The periodic extension of x2x^2 is continuous at π\pi, so the series equals π2\pi^2 there.
  5. At x=0x = 0: 0=π23−4∑(−1)n+1n20 = \tfrac{\pi^2}{3} - 4\sum\tfrac{(-1)^{n+1}}{n^2}(−1)ncos⁡0=(−1)n(-1)^n\cos0 = (-1)^n.
  6. ∑1n2=π26≈1.6449\sum\tfrac{1}{n^2} = \tfrac{\pi^2}{6} \approx 1.6449 and ∑(−1)n+1n2=π212≈0.8225\sum\tfrac{(-1)^{n+1}}{n^2} = \tfrac{\pi^2}{12} \approx 0.8225The Basel sum. Writing a0a_0 instead of a02\tfrac{a_0}{2} as the constant term breaks both evaluations (Mistake 1).

Problem 6

Let ff have period 44, with f(x)=0f(x) = 0 for −2<x<0-2 < x < 0 and f(x)=xf(x) = x for 0<x<20 < x < 2. Find its Fourier series, and the value the series converges to at x=2x = 2.

  1. L=2L = 2, so the terms are cos⁡nπx2\cos\tfrac{n\pi x}{2} and sin⁡nπx2\sin\tfrac{n\pi x}{2}The period is 2L=42L = 4.
  2. a0=12∫02x dx=1a_0 = \tfrac12\int_0^2 x\,dx = 11L∫−LL\tfrac1L\int_{-L}^{L}, and f=0f = 0 on the left half. The constant term a02=12\tfrac{a_0}{2} = \tfrac12 is the average of ff over a period.
  3. an=12∫02xcos⁡nπx2 dx=2((−1)n−1)n2π2a_n = \tfrac12\int_0^2 x\cos\tfrac{n\pi x}{2}\,dx = \tfrac{2\big((-1)^n - 1\big)}{n^2\pi^2}Parts with k=nπ2k = \tfrac{n\pi}{2}: [xsin⁡kxk+cos⁡kxk2]02=(−1)n−1k2\big[\tfrac{x\sin kx}{k} + \tfrac{\cos kx}{k^2}\big]_0^2 = \tfrac{(-1)^n - 1}{k^2}.
  4. bn=12∫02xsin⁡nπx2 dx=2(−1)n+1nπb_n = \tfrac12\int_0^2 x\sin\tfrac{n\pi x}{2}\,dx = \tfrac{2(-1)^{n+1}}{n\pi}12[−xcos⁡kxk]02=−(−1)nk\tfrac12\big[-\tfrac{x\cos kx}{k}\big]_0^2 = -\tfrac{(-1)^n}{k}; the sin⁡kx\sin kx term vanishes.
  5. f∼12−4π2∑n odd1n2cos⁡nπx2+2π∑n≥1(−1)n+1nsin⁡nπx2f \sim \tfrac12 - \tfrac{4}{\pi^2}\sum_{n\text{ odd}}\tfrac{1}{n^2}\cos\tfrac{n\pi x}{2} + \tfrac2\pi\sum_{n\ge1}\tfrac{(-1)^{n+1}}{n}\sin\tfrac{n\pi x}{2}The cosine terms are the even part of ff, the sine terms the odd part.
  6. At x=2x = 2 the series converges to 11ff jumps from 22 down to 00 there, and 12(2+0)=1\tfrac12(2 + 0) = 1. Check: cos⁡nπ=−1\cos n\pi = -1 for odd nn gives 12+4π2⋅π28=1\tfrac12 + \tfrac{4}{\pi^2}\cdot\tfrac{\pi^2}{8} = 1, using Problem 4. Using 1π\tfrac1\pi in place of 1L\tfrac1L gives the wrong average (Mistake 2).

Problem 7

Find the half-range sine series of f(x)=x(π−x)f(x) = x(\pi - x) on [0,π][0, \pi], and evaluate it at x=π/2x = \pi/2 to find 1−133+153−173+⋯1 - \frac{1}{3^3} + \frac{1}{5^3} - \frac{1}{7^3} + \cdots.

  1. Extend ff to [−π,0][-\pi, 0] as an odd functionThen the series has sines only, and on [0,π][0, \pi] it represents ff itself.
  2. bn=2π∫0πx(π−x)sin⁡nx dxb_n = \tfrac2\pi\int_0^\pi x(\pi - x)\sin nx\,dxThe odd-function formula.
  3. bn=4(1−(−1)n)πn3b_n = \tfrac{4\big(1 - (-1)^n\big)}{\pi n^3}Parts three times, or split as πx−x2\pi x - x^2 and reuse the integrals of Problems 3 and 5.
  4. bn=8πn3b_n = \tfrac{8}{\pi n^3} for odd nn, 00 for even nnThe odd extension is smooth enough that its coefficients fall like 1/n31/n^3.
  5. π24=8π(1−133+153−⋯)\tfrac{\pi^2}{4} = \tfrac8\pi\big(1 - \tfrac{1}{3^3} + \tfrac{1}{5^3} - \cdots\big)At x=π2x = \tfrac\pi2, f=π24f = \tfrac{\pi^2}{4}, and sin⁡nπ2\sin\tfrac{n\pi}{2} is 1,−1,1,…1, -1, 1, \dots for n=1,3,5,…n = 1, 3, 5, \dots
  6. x(π−x)∼8π(sin⁡x+127sin⁡3x+1125sin⁡5x+⋯)x(\pi - x) \sim \tfrac8\pi\big(\sin x + \tfrac{1}{27}\sin3x + \tfrac{1}{125}\sin5x + \cdots\big), and the sum is π332≈0.9689\tfrac{\pi^3}{32} \approx 0.9689The first term alone already has nearly the right height: its peak 8π≈2.546\tfrac8\pi \approx 2.546 is close to the true peak π24≈2.467\tfrac{\pi^2}{4} \approx 2.467.

Problem 8

Apply Parseval's identity to the series of x2x^2 from Problem 5 to find ∑n≥11n4\sum_{n\ge1}\frac{1}{n^4}.

  1. 1π∫−ππx4 dx=2π45\tfrac1\pi\int_{-\pi}^{\pi}x^4\,dx = \tfrac{2\pi^4}{5}The left side of Parseval: 1π⋅2π55\tfrac1\pi\cdot\tfrac{2\pi^5}{5}.
  2. a022=12(2π23)2=2π49\tfrac{a_0^2}{2} = \tfrac12\Big(\tfrac{2\pi^2}{3}\Big)^2 = \tfrac{2\pi^4}{9}The constant term's share, with a0=2π23a_0 = \tfrac{2\pi^2}{3}.
  3. ∑an2=∑16n4\sum a_n^2 = \sum\tfrac{16}{n^4}an=4(−1)nn2a_n = \tfrac{4(-1)^n}{n^2} and bn=0b_n = 0.
  4. 16∑1n4=2π45−2π49=8π44516\sum\tfrac{1}{n^4} = \tfrac{2\pi^4}{5} - \tfrac{2\pi^4}{9} = \tfrac{8\pi^4}{45}Solve for the sum.
  5. ∑1n4=π490≈1.0823\sum\tfrac{1}{n^4} = \tfrac{\pi^4}{90} \approx 1.0823Leaving out the a022\tfrac{a_0^2}{2} term gives π440≈2.435\tfrac{\pi^4}{40} \approx 2.435 (Mistake 5).

Problem 9

Find the complex Fourier coefficients cnc_n of f(x)=exf(x) = e^x on −π<x<π-\pi < x < \pi, extended with period 2π2\pi. Use the series at x=0x = 0 to find ∑n≥1(−1)n1+n2\sum_{n\ge1}\frac{(-1)^n}{1 + n^2}.

  1. cn=12π∫−ππe(1−in)x dxc_n = \tfrac{1}{2\pi}\int_{-\pi}^{\pi}e^{(1 - in)x}\,dxCombine exe^x and e−inxe^{-inx}.
  2. =e(1−in)π−e−(1−in)π2π(1−in)= \tfrac{e^{(1 - in)\pi} - e^{-(1 - in)\pi}}{2\pi(1 - in)}The exponential rule with a complex constant.
  3. e∓inπ=(−1)ne^{\mp in\pi} = (-1)^nSo the numerator is (−1)n(eπ−e−π)=2(−1)nsinh⁡π(-1)^n(e^\pi - e^{-\pi}) = 2(-1)^n\sinh\pi.
  4. cn=(−1)nsinh⁡ππ(1−in)c_n = \tfrac{(-1)^n\sinh\pi}{\pi(1 - in)}For every integer nn, including n=0n = 0, where c0=sinh⁡ππc_0 = \tfrac{\sinh\pi}{\pi} is the average of exe^x.
  5. cn+c−n=(−1)nsinh⁡ππ⋅21+n2c_n + c_{-n} = \tfrac{(-1)^n\sinh\pi}{\pi}\cdot\tfrac{2}{1 + n^2}At x=0x = 0 every einx=1e^{inx} = 1; pair nn with −n-n, since 11−in+11+in=21+n2\tfrac{1}{1 - in} + \tfrac{1}{1 + in} = \tfrac{2}{1 + n^2}.
  6. 1=sinh⁡ππ(1+2∑n≥1(−1)n1+n2)1 = \tfrac{\sinh\pi}{\pi}\Big(1 + 2\sum_{n\ge1}\tfrac{(-1)^n}{1 + n^2}\Big)exe^x is continuous at 00, so the series equals e0=1e^0 = 1.
  7. cn=(−1)nsinh⁡ππ(1−in)c_n = \tfrac{(-1)^n\sinh\pi}{\pi(1 - in)}, and ∑(−1)n1+n2=12(πsinh⁡π−1)≈−0.3640\sum\tfrac{(-1)^n}{1 + n^2} = \tfrac12\big(\tfrac{\pi}{\sinh\pi} - 1\big) \approx -0.3640At x=πx = \pi the series converges instead to cosh⁡π\cosh\pi, the average of e−πe^{-\pi} and eπe^\pi.

Problem 10

Find the periodic solution of y′′+4y=f(x)y'' + 4y = f(x), where ff is the square wave of Problem 2, as a Fourier series, and give its first three nonzero terms.

  1. Try y=∑n oddBnsin⁡nxy = \sum_{n\text{ odd}}B_n\sin nxThe forcing has only odd sine terms, and the equation maps sin⁡nx\sin nx to a multiple of itself.
  2. (sin⁡nx)′′+4sin⁡nx=(4−n2)sin⁡nx(\sin nx)'' + 4\sin nx = (4 - n^2)\sin nxDifferentiate twice.
  3. (4−n2)Bn=4nπ(4 - n^2)B_n = \tfrac{4}{n\pi} for odd nnMatch the coefficients of sin⁡nx\sin nx on both sides.
  4. Bn=4nπ(4−n2)B_n = \tfrac{4}{n\pi(4 - n^2)}No odd nn makes 4−n2=04 - n^2 = 0: the forcing has no sin⁡2x\sin2x term, so there is no resonance with the natural frequency 22.
  5. B1=43π≈0.4244B_1 = \tfrac{4}{3\pi} \approx 0.4244, B3=−415π≈−0.0849B_3 = -\tfrac{4}{15\pi} \approx -0.0849, B5=−4105π≈−0.0121B_5 = -\tfrac{4}{105\pi} \approx -0.01214−n24 - n^2 is 33, −5-5, −21-21.
  6. y=43πsin⁡x−415πsin⁡3x−4105πsin⁡5x−⋯y = \tfrac{4}{3\pi}\sin x - \tfrac{4}{15\pi}\sin3x - \tfrac{4}{105\pi}\sin5x - \cdotsThe BnB_n fall like 1/n31/n^3, 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.

  1. a0=1π∫−ππx2 dx=2π23a_0 = \tfrac1\pi\int_{-\pi}^{\pi}x^2\,dx = \tfrac{2\pi^2}{3}Right so far: Problem 5.
  2. “x2∼2π23+4∑(−1)nn2cos⁡nxx^2 \sim \tfrac{2\pi^2}{3} + 4\sum\tfrac{(-1)^n}{n^2}\cos nx.”The formula for ana_n with n=0n = 0 has a 1π\tfrac1\pi where the average needs 12π\tfrac{1}{2\pi}, which is why the series starts with a02\tfrac{a_0}{2}.
  3. At x=0x = 0: 0=2π23−4⋅π2120 = \tfrac{2\pi^2}{3} - 4\cdot\tfrac{\pi^2}{12}The right side is π23\tfrac{\pi^2}{3}, not 00: the series is shifted up by π23\tfrac{\pi^2}{3} everywhere. With the correct constant π23\tfrac{\pi^2}{3} it gives 00, and at x=πx = \pi the shifted series gives 4π23\tfrac{4\pi^2}{3} instead of π2\pi^2.

2. Dividing by π when the period is 2L

The coefficient formulas for period 2π2\pi are used on a function of period 44.

  1. f=xf = x on (0,2)(0, 2), 00 on (−2,0)(-2, 0), period 44Right so far: Problem 6.
  2. “a0=1π∫02x dx=2πa_0 = \tfrac1\pi\int_0^2 x\,dx = \tfrac2\pi.”For period 2L2L the factor is 1L=12\tfrac1L = \tfrac12, and the arguments are nπxL\tfrac{n\pi x}{L}: the π\pi belongs inside the sines and cosines, not in front.
  3. The constant term is a02=1π≈0.318\tfrac{a_0}{2} = \tfrac1\pi \approx 0.318The average of ff over a period is 14∫02x dx=12\tfrac14\int_0^2 x\,dx = \tfrac12, so the right a0a_0 is 11. Even with the right arguments nπx2\tfrac{n\pi x}{2}, every other coefficient is off by the same factor 2π\tfrac2\pi.

3. The series taken to equal f at a jump

The series of xx on (−π,π)(-\pi, \pi) is evaluated at x=πx = \pi by plugging π\pi into xx.

  1. x∼2∑(−1)n+1nsin⁡nxx \sim 2\sum\tfrac{(-1)^{n+1}}{n}\sin nx on (−π,π)(-\pi, \pi)Right so far: Problem 3.
  2. “At x=πx = \pi the function is π\pi.”The series represents the periodic extension, which jumps from π\pi to −π-\pi at x=πx = \pi.
  3. The series converges to π\pi at x=πx = \piEvery term is sin⁡nπ=0\sin n\pi = 0, so the series is 00 there: the average 12(π+(−π))\tfrac12(\pi + (-\pi)), as Dirichlet's theorem says. It equals xx only strictly inside (−π,π)(-\pi, \pi).

4. cos nπ taken as 0

In the coefficients of ∣x∣\lvert x\rvert, the endpoint terms are evaluated with cos⁡nπ\cos n\pi confused with sin⁡nπ\sin n\pi.

  1. an=2π[xsin⁡nxn+cos⁡nxn2]0πa_n = \tfrac2\pi\Big[\tfrac{x\sin nx}{n} + \tfrac{\cos nx}{n^2}\Big]_0^\piRight so far: Problem 4.
  2. “cos⁡nπ=0\cos n\pi = 0, so the bracket is 0−1n20 - \tfrac{1}{n^2}.”sin⁡nπ=0\sin n\pi = 0, but cos⁡nπ=(−1)n\cos n\pi = (-1)^n, so the bracket is (−1)n−1n2\tfrac{(-1)^n - 1}{n^2}.
  3. an=−2πn2a_n = -\tfrac{2}{\pi n^2} for every nnThen at x=0x = 0 the series gives π2−2π⋅π26=π6≈0.524\tfrac\pi2 - \tfrac2\pi\cdot\tfrac{\pi^2}{6} = \tfrac\pi6 \approx 0.524 instead of ∣0∣=0\lvert0\rvert = 0. The right ana_n is −4πn2-\tfrac{4}{\pi n^2} for odd nn and 00 for even nn.

5. The a₀ term left out of Parseval's identity

Parseval is remembered as "the integral of f2f^2 is the sum of the squared coefficients", for n≥1n \ge 1.

  1. 1π∫−ππx4 dx=2π45\tfrac1\pi\int_{-\pi}^{\pi}x^4\,dx = \tfrac{2\pi^4}{5} and an=4(−1)nn2a_n = \tfrac{4(-1)^n}{n^2}Right so far: Problem 8.
  2. “2π45=∑16n4\tfrac{2\pi^4}{5} = \sum\tfrac{16}{n^4}.”The constant term carries part of the energy: the identity has a022=2π49\tfrac{a_0^2}{2} = \tfrac{2\pi^4}{9} on the right as well.
  3. ∑1n4=π440≈2.435\sum\tfrac{1}{n^4} = \tfrac{\pi^4}{40} \approx 2.435That cannot be right, since 1+∑n≥21n4<1+∑n≥21n2≈1.6451 + \sum_{n\ge2}\tfrac{1}{n^4} < 1 + \sum_{n\ge2}\tfrac{1}{n^2} \approx 1.645. With the a022\tfrac{a_0^2}{2} term the sum is π490≈1.0823\tfrac{\pi^4}{90} \approx 1.0823.

Print this set: fourier-series.pdf (problems, answers, and worked solutions on separate pages).

Read the guide: Fourier series: integrate against each sine and cosine, halve the constant term, and let symmetry do half the work