Differential EquationsFourier Series and Boundary Value Problems2 of 6
Fourier Series and Boundary Value Problems · 2

Fourier Series

We know how to solve a differential equation when the driving force is a pure sine or cosine wave, and we need a way to turn any repeating wave, even one with flat tops, sharp corners, or jumps, into a sum of pure sines and cosines.

1

Building Periodic Waves from Sines and Cosines

Suppose we want to solve y′′+10y=f(t)\sys{y'' + 10y} = \wave{f(t)} when the driving force f(t)\wave{f(t)} is a repeating wave like a square wave or a sawtooth wave. We can rebuild f(t)\wave{f(t)} by adding a constant shift to pure cosine and sine waves that share the same period.

Building Periodic Waves from Sines and Cosines
y′′+10y=f(t)\htmlClass{lc-violet}{y'' + 10y} = \htmlClass{lc-blue}{f(t)}
f(t)\htmlClass{lc-blue}{f(t)}
y=0\htmlClass{lc-mute}{y = 0}
+1\htmlClass{lc-blue}{+1}
−1\htmlClass{lc-blue}{-1}

For a wave f(t)\wave{f(t)} that repeats every 2π2\pi on [−π,π][-\pi, \pi], only waves with whole-number frequencies n=1,2,3,…n = 1, 2, 3, \dots complete a whole number of cycles inside 2π2\pi and repeat in step with f(t)\wave{f(t)}:

f(t)=C⏟vertical shift+a1cos⁡(t)+b1sin⁡(t)⏟1 cycle in 2π+a2cos⁡(2t)+b2sin⁡(2t)⏟2 cycles in 2π+a3cos⁡(3t)+b3sin⁡(3t)⏟3 cycles in 2π+…\displaystyle \begin{aligned} \wave{f(t)} = {} & \underbrace{C}_{\text{vertical shift}} + \underbrace{a_1 \cos(t) + b_1 \sin(t)}_{\text{1 cycle in } 2\pi} \\ & + \underbrace{a_2 \cos(2t) + b_2 \sin(2t)}_{\text{2 cycles in } 2\pi} \\ & + \underbrace{a_3 \cos(3t) + b_3 \sin(3t)}_{\text{3 cycles in } 2\pi} + \dots \end{aligned}

Because pure sine waves are always zero at t=0t = 0 and pure cosine waves always start at a top or bottom peak at t=0t = 0, shifting a wave of frequency nn left or right to any other starting position requires mixing ancos⁡(nt)\cospart{a_n \cos(nt)} and bnsin⁡(nt)\sinpart{b_n \sin(nt)} together.

Because cosine always has its peak or valley at t=0t = 0 and sine always equals zero at t=0t = 0, shifting a wave sideways takes a mix of both.
2

Finding the Coefficients by Averaging

Given a repeating wave f(t)\wave{f(t)}, we want to find the constant shift CC and each wave coefficient ana_n and bnb_n in its series:

f(t)\displaystyle \wave{f(t)} =C+∑n=1∞(ancos⁡(nt)+bnsin⁡(nt))\displaystyle = C + \sum_{n=1}^{\infty} \big(a_n \cos(nt) + b_n \sin(nt)\big)
Finding the Coefficients by Averaging
f(t)=C+a1cos⁡(t)+b1sin⁡(t)+a2cos⁡(2t)+b2sin⁡(2t)+a3cos⁡(3t)+⋯\displaystyle \begin{aligned} &\wave{f(t)} = C \\ &\quad + a_1\cos(t) + b_1\sin(t) \\ &\quad + a_2\cos(2t) + b_2\sin(2t) \\ &\quad + a_3\cos(3t) + \cdots \end{aligned}
C\displaystyle C =?a3\displaystyle = {?} \qquad a_3 =?\displaystyle = {?}

To isolate a single term like cos⁡(3t)\cos(3t), we multiply f(t)\wave{f(t)} by cos⁡(3t)\probe{\cos(3t)} and average over [−π,π][-\pi, \pi].

Multiplying the fixed cosine wave by any other whole-cycle sine or cosine wave averages to zero across the interval, but when the two waves match, the average is one half.

Because every non-matching wave cancels out on average and a squared wave cos⁡2(nt)\cos^2(nt) or sin⁡2(nt)\sin^2(nt) averages to 12\mean{\frac{1}{2}}, multiplying both sides of the series by cos⁡(nt)\probe{\cos(nt)} and averaging over one period leaves half of ana_n:

Average of (f(t)cos⁡(nt))=an⋅Average of (cos⁡2(nt))=an2\displaystyle \begin{aligned} &\avg{\text{Average of }} \big(\wave{f(t)}\probe{\cos(nt)}\big) \\ &= a_n \cdot \avg{\text{Average of }} \big(\cos^2(nt)\big) \\ &= \frac{a_n}{2} \end{aligned}

Doubling that average gives the coefficient of cos⁡(nt)\cos(nt) or sin⁡(nt)\sin(nt) inside f(t)\wave{f(t)}. When a wave repeats on [−L,L][-L, L] with full period 2L2L, rescaling the angle from ntnt to nπtL\frac{n\pi t}{L} fits the waves onto [−L,L][-L, L] and averaging divides by the full width 2L2L:

f(t)=a02⏟average height C+∑n=1∞(ancos⁡ ⁣(nπtL)+bnsin⁡ ⁣(nπtL))C=a02=12L∫−LLf(t) dtan=1L∫−LLf(t)cos⁡ ⁣(nπtL)dtbn=1L∫−LLf(t)sin⁡ ⁣(nπtL)dt\displaystyle \begin{aligned} \wave{f(t)} &= \underbrace{\frac{a_0}{2}}_{\text{average height } C} \\ &\quad + \sum_{n=1}^{\infty} \Bigg( a_n \cos\!\left(\frac{n\pi t}{L}\right) \\ &\qquad\qquad + b_n \sin\!\left(\frac{n\pi t}{L}\right) \Bigg) \\[8pt] C = \frac{a_0}{2} &= \avg{\frac{1}{2L} \int_{-L}^{L}} \wave{f(t)}\,\avg{dt} \\[6pt] a_n &= \avg{\frac{1}{L} \int_{-L}^{L}} \wave{f(t)} \probe{\cos\!\left(\frac{n\pi t}{L}\right)} \avg{dt} \\[6pt] b_n &= \avg{\frac{1}{L} \int_{-L}^{L}} \wave{f(t)} \probe{\sin\!\left(\frac{n\pi t}{L}\right)} \avg{dt} \end{aligned}

On [−π,π][-\pi, \pi], the half-period is L=πL = \pi, so nπtL\frac{n\pi t}{L} simplifies to ntnt and 1L\avg{\frac{1}{L}} becomes 1π\avg{\frac{1}{\pi}}. We write the constant term at the front as a02\frac{a_0}{2} so the formula for a0a_0 uses the same 1L\avg{\frac{1}{L}} factor as ana_n when n=0n = 0. Dividing by 22 in a02\frac{a_0}{2} gives back the true average height CC.

3

Symmetry and the Square Wave Series

Now let's find the Fourier series for the 2π2\pi-periodic square wave that jumps between −1\wave{-1} and +1\wave{+1} on [−π,π][-\pi, \pi]:

f(t)={−1,−π<t<0+1,0<t<π\displaystyle \wave{f(t)} = \begin{cases} \wave{-1}, & -\pi < t < 0 \\ \wave{+1}, & 0 < t < \pi \end{cases}
cos⁡(t): Even (mirror across vertical axis)\cos(t)\text{: Even (mirror across vertical axis)}
sin⁡(t): Odd (flipped across origin)\sin(t)\text{: Odd (flipped across origin)}
f(t): the square wave\htmlClass{lc-blue}{f(t)}\text{: the square wave}
+1\htmlClass{lc-blue}{+1}
−1\htmlClass{lc-blue}{-1}
−π-\pi
π\pi
t\htmlClass{lc-mute}{t}
Symmetry and the Square Wave Series
f(t)\htmlClass{lc-blue}{f(t)}
+1\htmlClass{lc-blue}{+1}
−1\htmlClass{lc-blue}{-1}
−π-\pi
π\pi
t\htmlClass{lc-mute}{t}
C=?an=?bn=?C = {?} \qquad a_n = {?} \qquad b_n = {?}
Text solution
Drop the constant and cosine terms by odd symmetryBecause the square wave is flipped upside-down across the origin, it cannot contain a constant shift or any cosine waves, which are mirror images across the vertical axis:
C=a02=0,an=0for all n\displaystyle \begin{aligned} C = \frac{a_0}{2} &= 0, \\ a_n &= 0 \quad \text{for all } n \end{aligned}
Double the sine integral on the right half [0,π][0, \pi]Since f(t)\wave{f(t)} and sin⁡(nt)\probe{\sin(nt)} are both odd, each one changes sign when tt is replaced by −t-t, so their product f(t)sin⁡(nt)\wave{f(t)}\probe{\sin(nt)} has the same value at −t-t as at tt. The two halves have the same average, so the average over [−π,π][-\pi, \pi] equals the average over [0,π][0, \pi] where f(t)=1\wave{f(t)} = \wave{1}:
bn=1π∫−ππf(t)sin⁡(nt) dt=2π∫0π1⋅sin⁡(nt) dt\displaystyle \begin{aligned} b_n &= \avg{\frac{1}{\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\probe{\sin(nt)}\,\avg{dt} \\ &= \avg{\frac{2}{\pi} \int_{0}^{\pi}} \wave{1} \cdot \probe{\sin(nt)}\,\avg{dt} \end{aligned}
Count the sine arches on [0,π][0, \pi] for even and odd nnOn [0,π][0, \pi], sin⁡(nt)\probe{\sin(nt)} makes nn arches of area 2n\mean{\frac{2}{n}} each. Even values of nn give an equal number of positive and negative arches that cancel to 00, while odd values of nn leave one extra positive arch of area 2n\mean{\frac{2}{n}}:
bn={0,n=2,4,6,…2π⋅2n=4nπ,n=1,3,5,…\displaystyle b_n = \begin{cases} 0, & n = 2, 4, 6, \dots \\[4pt] \dfrac{2}{\pi} \cdot \mean{\dfrac{2}{n}} = \dfrac{4}{n\pi}, & n = 1, 3, 5, \dots \end{cases}
Write out the odd sine seriesPutting together the odd frequencies gives the Fourier series for the square wave:
f(t)=4πsin⁡(t)+43πsin⁡(3t)+45πsin⁡(5t)+47πsin⁡(7t)+…\displaystyle \begin{aligned} \wave{f(t)} &= \frac{4}{\pi}\sin(t) + \frac{4}{3\pi}\sin(3t) \\ &\quad + \frac{4}{5\pi}\sin(5t) \\ &\quad + \frac{4}{7\pi}\sin(7t) + \dots \end{aligned}

Let's see how adding more odd sine terms flattens the top and sharpens the corners into a square wave.

Each odd harmonic pushes out the sides and moves the middle back toward the flat top, flattening the round sine wave into a square wave.
4

The Triangle Wave and Integration by Parts

Next, let's find the Fourier series for a 44-periodic triangle wave on [−2,2][-2, 2] with half-period L=2L = 2:

f(t)\displaystyle \wave{f(t)} =∣t∣on [−2,2]\displaystyle = \wave{|t|} \quad \text{on } [-2, 2]
f(t)=−t\htmlClass{lc-blue}{f(t)} = \htmlClass{lc-blue}{-t}
f(t)=t\htmlClass{lc-blue}{f(t)} = \htmlClass{lc-blue}{t}
C=1\htmlClass{lc-green}{C = 1}
22
−2-2
00
22
t\htmlClass{lc-mute}{t}
L=2L = 2

Because the wave is the sloped line t\wave{t} on [0,2][0, 2] rather than a flat constant, finding ana_n requires integrating the product tcos⁡ ⁣(nπt2)\wave{t} \probe{\cos\!\left(\frac{n\pi t}{2}\right)}. We integrate a power of t\wave{t} times a wave using integration by parts, choosing u=t\wave{u} = \wave{t} so taking the derivative turns it into du=dt\wave{du} = dt:

∫u dv\displaystyle \int \wave{u}\,\probe{dv} =uv−∫v du\displaystyle = \wave{u}\probe{v} - \int \probe{v}\,\wave{du}
The Triangle Wave and Integration by Parts
f(t)=∣t∣\htmlClass{lc-blue}{f(t)} = \htmlClass{lc-blue}{|t|}
L=2L = 2
−2-2
22
t\htmlClass{lc-mute}{t}
2L=42L = 4
an=?a_n = {?}
Text solution
Drop the sine terms by even symmetry and read off the average heightBecause f(t)=∣t∣\wave{f(t)} = \wave{|t|} is a mirror image across the vertical axis, every sine coefficient is zero, and the line climbing straight from 00 to 22 has average height 11:
bn=0for all n,C=a02=1(a0=2)\displaystyle \begin{aligned} b_n &= 0 \quad \text{for all } n, \\ C = \frac{a_0}{2} &= 1 \quad (a_0 = 2) \end{aligned}
Double the cosine integral on [0,2][0, 2] where ∣t∣=t\wave{|t|} = \wave{t}Because both ∣t∣\wave{|t|} and cos⁡ ⁣(nπt2)\probe{\cos\!\left(\frac{n\pi t}{2}\right)} are even, their product has the same integral on [−2,0][-2, 0] and [0,2][0, 2]:
an=12∫−22∣t∣cos⁡ ⁣(nπt2)dt=2⋅12∫02tcos⁡ ⁣(nπt2)dt=∫02tcos⁡ ⁣(nπt2)dt\displaystyle \begin{aligned} a_n &= \avg{\frac{1}{2} \int_{-2}^{2}} \wave{|t|} \probe{\cos\!\left(\frac{n\pi t}{2}\right)} \avg{dt} \\ &= 2 \cdot \avg{\frac{1}{2} \int_{0}^{2}} \wave{t} \probe{\cos\!\left(\frac{n\pi t}{2}\right)} \avg{dt} \\ &= \avg{\int_{0}^{2}} \wave{t} \probe{\cos\!\left(\frac{n\pi t}{2}\right)} \avg{dt} \end{aligned}
Integrate by parts and drop the sine boundary termChoosing u=t\wave{u} = \wave{t} and dv=cos⁡ ⁣(nπt2)dt\probe{dv} = \probe{\cos\!\left(\frac{n\pi t}{2}\right) dt} gives v=2nπsin⁡ ⁣(nπt2)\probe{v} = \probe{\frac{2}{n\pi}\sin\!\left(\frac{n\pi t}{2}\right)}, and the uv\wave{u}\probe{v} term is zero at t=2t = 2 (since sin⁡(nπ)=0\sin(n\pi) = 0) and at t=0t = 0:
an=[t⋅2nπsin⁡ ⁣(nπt2)]02⏟0−∫022nπsin⁡ ⁣(nπt2)dt=−∫022nπsin⁡ ⁣(nπt2)dt\displaystyle \begin{aligned} a_n &= \underbrace{\left[ \wave{t} \cdot \probe{\frac{2}{n\pi} \sin\!\left(\frac{n\pi t}{2}\right)} \right]_{0}^{2}}_{0} \\ &\quad - \int_{0}^{2} \probe{\frac{2}{n\pi} \sin\!\left(\frac{n\pi t}{2}\right)} dt \\ &= -\int_{0}^{2} \probe{\frac{2}{n\pi} \sin\!\left(\frac{n\pi t}{2}\right)} dt \end{aligned}
Integrate the remaining sine wave and substitute cos⁡(nπ)=(−1)n\cos(n\pi) = (-1)^nIntegrating −sin⁡ ⁣(nπt2)\probe{-\sin\!\left(\frac{n\pi t}{2}\right)} brings out a second factor of 2nπ\frac{2}{n\pi}:
an=[4n2π2cos⁡ ⁣(nπt2)]02=4n2π2(cos⁡(nπ)−cos⁡(0))=4n2π2((−1)n−1)\displaystyle \begin{aligned} a_n &= \left[ \frac{4}{n^2\pi^2} \cos\!\left(\frac{n\pi t}{2}\right) \right]_{0}^{2} \\ &= \frac{4}{n^2\pi^2}\big(\cos(n\pi) - \cos(0)\big) \\ &= \frac{4}{n^2\pi^2}\big((-1)^n - 1\big) \end{aligned}
Separate even and odd nn to write the seriesSince (−1)n−1(-1)^n - 1 equals 00 for even nn and −2-2 for odd nn, only the odd cosine terms remain, with an=−8n2π2a_n = -\frac{8}{n^2\pi^2}:
∣t∣=1−8π2cos⁡ ⁣(πt2)−89π2cos⁡ ⁣(3πt2)−825π2cos⁡ ⁣(5πt2)−…\displaystyle \begin{aligned} \wave{|t|} &= 1 - \frac{8}{\pi^2}\cos\!\left(\frac{\pi t}{2}\right) \\ &\quad - \frac{8}{9\pi^2}\cos\!\left(\frac{3\pi t}{2}\right) \\ &\quad - \frac{8}{25\pi^2}\cos\!\left(\frac{5\pi t}{2}\right) - \dots \end{aligned}

On a graph of a straight line like ∣t∣\wave{|t|} from 00 to 22, you can see the average height C=1\mean{C = 1} right away, which is the actual number that goes at the front of the series. If you are asked separately for the coefficient a0a_0, remember that a0=2C=2a_0 = 2C = 2.

5

Driven Oscillators and Hidden Resonance

Now we can solve the differential equation y′′+10y=f(t)\sys{y'' + 10y} = \wave{f(t)} for a mass on a spring driven by the 2π2\pi-periodic square wave f(t)\wave{f(t)}:

y′′+10y\displaystyle \sys{y'' + 10y} =f(t)\displaystyle = \wave{f(t)}
Driven Oscillators and Hidden Resonance
y′′+10y=f(t)\htmlClass{lc-violet}{y'' + 10y} = \htmlClass{lc-blue}{f(t)}
f(t)\htmlClass{lc-blue}{f(t)}
y=0\htmlClass{lc-mute}{y = 0}
f(t)\htmlClass{lc-blue}{f(t)}
+1\htmlClass{lc-blue}{+1}
−1\htmlClass{lc-blue}{-1}
π\pi
2π2\pi
t\htmlClass{lc-mute}{t}
y(t)=?\htmlClass{lc-green}{y(t)} = {?}
Text solution
Replace the square wave f(t)\wave{f(t)} with its Fourier seriesWriting the square wave as its sum of odd sine waves turns the right side into pure sine terms:
y′′+10y\displaystyle \sys{y'' + 10y} =4πsin⁡(t)+43πsin⁡(3t)+45πsin⁡(5t)+…\displaystyle = \wave{\frac{4}{\pi}}\sin(t) + \wave{\frac{4}{3\pi}}\sin(3t) + \wave{\frac{4}{5\pi}}\sin(5t) + \dots
Solve for the response to a single term bnsin⁡(nt)\wave{b_n} \sin(nt)Guessing yn(t)=Ansin⁡(nt)\resp{y_n(t)} = \resp{A_n} \sin(nt) brings out −n2\curv{-n^2} from the second derivative:
(−n2An+10An)sin⁡(nt)=bnsin⁡(nt)  ⟹  An=bn10−n2\displaystyle \begin{aligned} &(\curv{-n^2} \resp{A_n} + \sys{10} \resp{A_n})\sin(nt) \\ &= \wave{b_n} \sin(nt) \\ \implies \resp{A_n} &= \frac{\wave{b_n}}{\sys{10 - n^2}} \end{aligned}
Add the individual responses togetherDividing each square-wave coefficient bn=4nπ\wave{b_n} = \wave{\frac{4}{n\pi}} by 10−n2\sys{10 - n^2} gives the steady-state motion of the spring:
y(t)=4π(10−12)sin⁡(t)+43π(10−32)sin⁡(3t)+45π(10−52)sin⁡(5t)+…=49πsin⁡(t)+43πsin⁡(3t)−475πsin⁡(5t)−…\displaystyle \begin{aligned} \resp{y(t)} &= \frac{\wave{4}}{\wave{\pi}\sys{(10 - 1^2)}}\sin(t) \\ &\quad + \frac{\wave{4}}{\wave{3\pi}\sys{(10 - 3^2)}}\sin(3t) \\ &\quad + \frac{\wave{4}}{\wave{5\pi}\sys{(10 - 5^2)}}\sin(5t) + \dots \\ &= \resp{\frac{4}{9\pi}}\sin(t) + \resp{\frac{4}{3\pi}}\sin(3t) \\ &\quad - \resp{\frac{4}{75\pi}}\sin(5t) - \dots \end{aligned}

Even though the square wave flips slowly at the base frequency n=1n = 1, the sin⁡(3t)\sin(3t) term in the spring's motion (43π\resp{\frac{4}{3\pi}}) is three times as large as the sin⁡(t)\sin(t) term (49π\resp{\frac{4}{9\pi}}). That happens because the n=3n = 3 frequency inside the square wave is right next to the spring's natural frequency 10≈3.16\sys{\sqrt{10}} \approx 3.16.

Watch how different terms in the square wave take turns dominating the motion as we change the spring's natural frequency.

Whenever the spring’s natural frequency gets close to one of the square wave’s odd harmonics, that tiny sine wave inside the square wave grows huge and takes over the spring’s motion.

Key concepts

To write the Fourier series of a 2L2L-periodic wave f(t)\wave{f(t)} on [−L,L][-L, L], we write it as its average height C=a02C = \frac{a_0}{2} plus rescaled cosine and sine waves:

f(t)=a02+∑n=1∞(ancos⁡ ⁣(nπtL)+bnsin⁡ ⁣(nπtL))\displaystyle \begin{aligned} \wave{f(t)} &= \frac{a_0}{2} \\ &\quad + \sum_{n=1}^{\infty} \Bigg( a_n \cos\!\left(\frac{n\pi t}{L}\right) \\ &\qquad\qquad + b_n \sin\!\left(\frac{n\pi t}{L}\right) \Bigg) \end{aligned}
When not to integrate

If f(t)\wave{f(t)} is already given as a finite sum of sines and cosines, such as f(t)=5−2cos⁡(t)+4sin⁡(3t)\wave{f(t)} = 5 - 2\cos(t) + 4\sin(3t), do not set up any integrals. You can read its coefficients right off the equation (C=a02=5C = \frac{a_0}{2} = 5 so a0=10a_0 = 10, a1=−2a_1 = -2, b3=4b_3 = 4, and all other an,bn=0a_n, b_n = 0), and the average of f(t)\wave{f(t)} times any wave cos⁡(nt)\probe{\cos(nt)} or sin⁡(nt)\probe{\sin(nt)} over one period is half that wave's coefficient.

Check symmetry before integrating

  • Even wave (mirror image across the vertical axis, like ∣t∣\wave{|t|} or t2\wave{t^2}): bn=0b_n = 0 for all nn, and we double the remaining integrals on [0,L][0, L]:
    C=a02=1L∫0Lf(t) dt,an=2L∫0Lf(t)cos⁡ ⁣(nπtL)dt\displaystyle \begin{aligned} C &= \frac{a_0}{2} \\ &= \avg{\frac{1}{L}\int_0^L} \wave{f(t)}\,\avg{dt}, \\ a_n &= \avg{\frac{2}{L}\int_0^L} \wave{f(t)}\probe{\cos\!\left(\tfrac{n\pi t}{L}\right)}\avg{dt} \end{aligned}
  • Odd wave (flipped upside-down across the origin, like the ±1\wave{\pm 1} square wave or t\wave{t}): a0=0a_0 = 0 and an=0a_n = 0 for all nn, leaving only sines doubled on [0,L][0, L]:
    bn\displaystyle b_n =2L∫0Lf(t)sin⁡ ⁣(nπtL)dt\displaystyle = \avg{\frac{2}{L}\int_0^L} \wave{f(t)}\probe{\sin\!\left(\tfrac{n\pi t}{L}\right)}\avg{dt}
  • Shifted wave: If a wave becomes odd or even after removing its vertical shift (like a step wave between 0\wave{0} and 2\wave{2} with average height C=1C = 1), subtract CC first and find the series for the centered wave.
Evaluating the integral on [0,L][0, L]

A flat constant step integrates directly, while a power like t\wave{t} or t2\wave{t^2} times a wave uses integration by parts (∫u dv=uv−∫v du\int \wave{u}\,\probe{dv} = \wave{u}\probe{v} - \int \probe{v}\,\wave{du}) with u=t\wave{u} = \wave{t} or t2\wave{t^2}. At t=Lt = L, simplify using sin⁡(nπ)=0\sin(n\pi) = 0 and cos⁡(nπ)=(−1)n\cos(n\pi) = (-1)^n.

Driven oscillators (y′′+ω02y=f(t)\sys{y'' + \omega_0^2 y} = \wave{f(t)})

Replace f(t)\wave{f(t)} with its Fourier series and solve term by term. Taking two derivatives of cos⁡ ⁣(nπtL)\cos\!\left(\frac{n\pi t}{L}\right) or sin⁡ ⁣(nπtL)\sin\!\left(\frac{n\pi t}{L}\right) brings out −(nπL)2\curv{-\left(\frac{n\pi}{L}\right)^2}, dividing each coefficient by ω02−(nπL)2\sys{\omega_0^2 - \left(\frac{n\pi}{L}\right)^2}. The term whose frequency nπL\frac{n\pi}{L} is closest to the natural frequency ω0\sys{\omega_0} is amplified the most.

6

Practice

1

A 2π2\pi-periodic wave is already written as a finite sum of pure sines and cosines:

f(t)\displaystyle \wave{f(t)} =3−4cos⁡(t)+6sin⁡(3t)+2cos⁡(5t)\displaystyle = 3 - 4\cos(t) + 6\sin(3t) + 2\cos(5t)

Without finding any antiderivatives, use the averaging method to find the exact values of: (a) 12π∫−ππf(t) dt\avg{\dfrac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\,\avg{dt} (b) 12π∫−ππf(t)cos⁡(3t) dt\avg{\dfrac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\probe{\cos(3t)}\,\avg{dt} (c) 12π∫−ππf(t)sin⁡(3t) dt\avg{\dfrac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\probe{\sin(3t)}\,\avg{dt} (d) the constant coefficient a0a_0 in the standard formula f(t)=a02+∑n=1∞(ancos⁡(nt)+bnsin⁡(nt))\wave{f(t)} = \dfrac{a_0}{2} + \sum_{n=1}^{\infty} \big(a_n \cos(nt) + b_n \sin(nt)\big).

Each integral with 12π\avg{\frac{1}{2\pi}} out front is the average over one period. Which term in f(t)\wave{f(t)} doesn't average to zero when multiplied by the wave inside the integral, and what is the average of that squared wave?

(a)Over a full period [−π,π][-\pi, \pi], every sine and cosine wave in f(t)\wave{f(t)} averages to 0\mean{0}, leaving only the constant shift:
12π∫−ππf(t) dt\displaystyle \avg{\frac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\,\avg{dt} =3\displaystyle = 3
(b)Multiplying f(t)\wave{f(t)} by cos⁡(3t)\probe{\cos(3t)} gives only products of different waves (including 6sin⁡(3t)cos⁡(3t)6\sin(3t)\probe{\cos(3t)}) because f(t)\wave{f(t)} has no cos⁡(3t)\cos(3t) term, and every product of two different waves averages to 0\mean{0}:
12π∫−ππf(t)cos⁡(3t) dt\displaystyle \avg{\frac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\probe{\cos(3t)}\,\avg{dt} =0\displaystyle = 0
(c)Multiplying f(t)\wave{f(t)} by sin⁡(3t)\probe{\sin(3t)} makes every non-matching term average to 0\mean{0} while the matching term 6sin⁡2(3t)6\sin^2(3t) averages to 6⋅126 \cdot \mean{\frac{1}{2}}. (Be careful not to answer b3=6b_3 = 6: the coefficient formula b3=1π∫−ππf(t)sin⁡(3t) dtb_3 = \avg{\frac{1}{\pi}\int_{-\pi}^{\pi}} \wave{f(t)}\probe{\sin(3t)}\,\avg{dt} has 1π\avg{\frac{1}{\pi}} out front, whereas this integral has 12π\avg{\frac{1}{2\pi}} and asks for the average itself, b32\frac{b_3}{2}.)
12π∫−ππf(t)sin⁡(3t) dt\displaystyle \avg{\frac{1}{2\pi} \int_{-\pi}^{\pi}} \wave{f(t)}\probe{\sin(3t)}\,\avg{dt} =6⋅12\displaystyle = 6 \cdot \mean{\frac{1}{2}} =3\displaystyle = 3
(d)Because the constant term at the front of the standard series is a02=C=3\frac{a_0}{2} = C = 3 (don't write a0=3a_0 = 3 without doubling CC):
a0\displaystyle a_0 =6\displaystyle = 6
2

A periodic voltage switch repeats every 66 seconds on [−3,3][-3, 3]:

f(t)={0,−3<t<02,0<t<3\displaystyle \wave{f(t)} = \begin{cases} \wave{0}, & -3 < t < 0 \\ \wave{2}, & 0 < t < 3 \end{cases}

Find its Fourier series and write out the constant term and the first three non-zero wave terms.

Find the average height CC over [−3,3][-3, 3] first. If you subtract CC from f(t)\wave{f(t)}, what familiar wave is left on [−3,3][-3, 3], and what is its half-period LL?

Average height and centered waveOn [−3,3][-3, 3], the wave spends half the period at 0\wave{0} and half at 2\wave{2}, so its average height is C=a02=1C = \frac{a_0}{2} = 1 (with a0=2a_0 = 2). Subtracting 11 leaves f(t)−1\wave{f(t)} - 1, which jumps between −1\wave{-1} on (−3,0)(-3, 0) and +1\wave{+1} on (0,3)(0, 3). That is our odd square wave with an=0a_n = 0 for all n≥1n \ge 1 and bn=4nπb_n = \frac{4}{n\pi} for odd nn.
Rescale the frequencies for L=3L = 3Because the full period is 2L=62L = 6, the half-period is L=3L = 3, so each angle rescales to nπt3\frac{n\pi t}{3}. (A common mistake is plugging the full period 66 in for LL, which gives nπt6\frac{n\pi t}{6}, or forgetting to rescale ntnt altogether.)
f(t)=1+4πsin⁡ ⁣(πt3)+43πsin⁡(πt)+45πsin⁡ ⁣(5πt3)+…\displaystyle \begin{aligned} \wave{f(t)} &= 1 + \frac{4}{\pi}\sin\!\left(\frac{\pi t}{3}\right) + \frac{4}{3\pi}\sin(\pi t) \\ &\quad + \frac{4}{5\pi}\sin\!\left(\frac{5\pi t}{3}\right) + \dots \end{aligned}
3

Find the Fourier series for the 2π2\pi-periodic sawtooth wave f(t)=t\wave{f(t)} = \wave{t} on [−π,π][-\pi, \pi], and write out the first three non-zero terms.

Check whether f(t)=t\wave{f(t)} = \wave{t} is even or odd to see whether the cosine or sine terms are zero, then double the remaining integral on [0,π][0, \pi] and choose uu and dvdv for integration by parts.

Use odd symmetryBecause f(t)=t\wave{f(t)} = \wave{t} is odd on [−π,π][-\pi, \pi], a0=0a_0 = 0 and an=0a_n = 0 for all nn, and the sine integral doubles on [0,π][0, \pi]:
bn\displaystyle b_n =2π∫0πtsin⁡(nt) dt\displaystyle = \avg{\frac{2}{\pi} \int_{0}^{\pi}} \wave{t}\probe{\sin(nt)}\,\avg{dt}
Integrate by partsWith u=t\wave{u} = \wave{t} and dv=sin⁡(nt) dt\probe{dv} = \probe{\sin(nt)\,dt}, we have du=dt\wave{du} = dt and v=−1ncos⁡(nt)\probe{v} = \probe{-\frac{1}{n}\cos(nt)}. (Be careful not to drop the minus sign when integrating sin⁡(nt)\probe{\sin(nt)} to −1ncos⁡(nt)\probe{-\frac{1}{n}\cos(nt)}, which would flip every sign in the series to −2sin⁡(t)+sin⁡(2t)−23sin⁡(3t)+…-2\sin(t) + \sin(2t) - \frac{2}{3}\sin(3t) + \dots.)
bn\displaystyle b_n =2π([−tcos⁡(nt)n]0π+∫0πcos⁡(nt)n dt)\displaystyle = \frac{2}{\pi}\left(\left[-\frac{\wave{t}\probe{\cos(nt)}}{n}\right]_{0}^{\pi} + \int_{0}^{\pi} \probe{\frac{\cos(nt)}{n}}\,dt\right)
Evaluate at the boundsThe remaining integral [sin⁡(nt)n2]0π\left[\frac{\sin(nt)}{n^2}\right]_0^\pi is zero because sin⁡(nπ)=0\sin(n\pi) = 0, while the uv\wave{u}\probe{v} term at t=πt = \pi uses cos⁡(nπ)=(−1)n\cos(n\pi) = (-1)^n:
bn=2π(−πcos⁡(nπ)n)=−2(−1)nn=2(−1)n+1n\displaystyle \begin{aligned} b_n &= \frac{2}{\pi}\left(-\frac{\pi\cos(n\pi)}{n}\right) \\ &= -\frac{2(-1)^n}{n} \\ &= \frac{2(-1)^{n+1}}{n} \end{aligned}
Write out the series for n=1,2,3,…n = 1, 2, 3, \dots
f(t)\displaystyle \wave{f(t)} =2sin⁡(t)−sin⁡(2t)+23sin⁡(3t)−…\displaystyle = 2\sin(t) - \sin(2t) + \frac{2}{3}\sin(3t) - \dots
4

Find the Fourier series for the 2π2\pi-periodic parabolic wave f(t)=t2\wave{f(t)} = \wave{t^2} on [−π,π][-\pi, \pi], and write out the constant term and the first three wave terms.

Use the symmetry of t2\wave{t^2} to see which coefficients are zero, find the average height C=a02C = \frac{a_0}{2} separately from ana_n, and use integration by parts twice on ∫0πt2cos⁡(nt) dt\avg{\int_0^\pi} \wave{t^2} \probe{\cos(nt)}\,\avg{dt} so taking derivatives turns t2\wave{t^2} into 2t\wave{2t} and then 2\wave{2}.

Use even symmetry and find the constant termBecause f(t)=t2\wave{f(t)} = \wave{t^2} is even on [−π,π][-\pi, \pi], bn=0b_n = 0 for all nn. Doubling the average height integral on [0,π][0, \pi] gives C=a02C = \frac{a_0}{2}:
C=a02=1π∫0πt2 dt=1π[t33]0π=π23(a0=2π23)\displaystyle \begin{aligned} C = \frac{a_0}{2} &= \avg{\frac{1}{\pi}\int_{0}^{\pi}} \wave{t^2}\,\avg{dt} \\ &= \frac{1}{\pi}\left[\frac{t^3}{3}\right]_{0}^{\pi} \\ &= \frac{\pi^2}{3} \quad \left(a_0 = \frac{2\pi^2}{3}\right) \end{aligned}
(Be careful not to put a0=2π23a_0 = \frac{2\pi^2}{3} directly at the front of the series instead of a02=π23\frac{a_0}{2} = \frac{\pi^2}{3}.)
Integrate by parts twice for ana_nDoubling the cosine integral on [0,π][0, \pi] and integrating by parts twice turns t2\wave{t^2} into 2t\wave{2t} and then 2\wave{2}:
an=2π∫0πt2cos⁡(nt) dt=2π[t2sin⁡(nt)n+2tcos⁡(nt)n2−2sin⁡(nt)n3]0π\displaystyle \begin{aligned} a_n &= \avg{\frac{2}{\pi}\int_{0}^{\pi}} \wave{t^2}\probe{\cos(nt)}\,\avg{dt} \\ &= \frac{2}{\pi}\Bigg[\frac{\wave{t^2}\probe{\sin(nt)}}{n} + \frac{\wave{2t}\probe{\cos(nt)}}{n^2} \\ &\qquad\quad - \frac{\wave{2}\probe{\sin(nt)}}{n^3}\Bigg]_{0}^{\pi} \end{aligned}
Evaluate at t=πt = \pi and t=0t = 0Since sin⁡(nπ)=0\sin(n\pi) = 0 and cos⁡(nπ)=(−1)n\cos(n\pi) = (-1)^n, both sine terms are zero at 00 and π\pi and the middle term is zero at t=0t = 0:
an=2π(2π(−1)nn2)=4(−1)nn2\displaystyle \begin{aligned} a_n &= \frac{2}{\pi}\left(\frac{2\pi(-1)^n}{n^2}\right) \\ &= \frac{4(-1)^n}{n^2} \end{aligned}
Write out the series
f(t)\displaystyle \wave{f(t)} =π23−4cos⁡(t)+cos⁡(2t)−49cos⁡(3t)+…\displaystyle = \frac{\pi^2}{3} - 4\cos(t) + \cos(2t) - \frac{4}{9}\cos(3t) + \dots
5

A mass on a spring obeys y′′+20y=f(t)\sys{y'' + 20y} = \wave{f(t)}, where f(t)\wave{f(t)} is the 44-periodic triangle wave f(t)=∣t∣\wave{f(t)} = \wave{|t|} on [−2,2][-2, 2] with Fourier series

f(t)=1−8π2cos⁡ ⁣(πt2)−89π2cos⁡ ⁣(3πt2)−825π2cos⁡ ⁣(5πt2)−…\displaystyle \begin{aligned} \wave{f(t)} &= 1 - \frac{8}{\pi^2}\cos\!\left(\frac{\pi t}{2}\right) \\ &- \frac{8}{9\pi^2}\cos\!\left(\frac{3\pi t}{2}\right) \\ &- \frac{8}{25\pi^2}\cos\!\left(\frac{5\pi t}{2}\right) \\ &- \dots \end{aligned}

Find the steady-state periodic response y(t)\resp{y(t)} out to the first three wave terms, and identify which term nn in the triangle wave is amplified the most by near-resonance.

Solve for the constant term and each cosine term separately. When you take two derivatives of cos⁡ ⁣(nπt2)\cos\!\left(\frac{n\pi t}{2}\right), what constant factor comes out in front?

Constant term responseGuessing y0=A0\resp{y_0} = \resp{A_0} for the constant driving term 1\wave{1} gives 20A0=1\sys{20}\resp{A_0} = \wave{1}, so A0=120\resp{A_0} = \frac{1}{20}.
Cosine response termsFor each term ancos⁡ ⁣(nπt2)\wave{a_n} \cos\!\left(\frac{n\pi t}{2}\right), guessing yn(t)=Ancos⁡ ⁣(nπt2)\resp{y_n(t)} = \resp{A_n} \cos\!\left(\frac{n\pi t}{2}\right) brings out −(nπ2)2=−n2π24\curv{-\left(\frac{n\pi}{2}\right)^2} = \curv{-\frac{n^2\pi^2}{4}} from yn′′\curv{y_n''}:
(20−n2π24)An=an  ⟹  An=an20−n2π24\displaystyle \begin{aligned} \sys{\left(20 - \frac{n^2\pi^2}{4}\right)}\resp{A_n} &= \wave{a_n} \\ \implies \resp{A_n} &= \frac{\wave{a_n}}{\sys{20 - \dfrac{n^2\pi^2}{4}}} \end{aligned}
(Don't divide by 20−n2\sys{20 - n^2} by forgetting the chain-rule factor π2\frac{\pi}{2} inside cos⁡ ⁣(nπt2)\cos\!\left(\frac{n\pi t}{2}\right); using 20−n2\sys{20 - n^2} would give the wrong denominators and wrongly pick n=5n = 5 since 52=255^2 = 25 is close to 2020.)
Combine the terms and compare denominatorsBecause the driving frequency 3π2≈4.71\frac{3\pi}{2} \approx 4.71 for n=3n = 3 is closest to the spring's natural frequency 20≈4.47\sys{\sqrt{20}} \approx 4.47 (making the denominator 20−9π24≈−2.21\sys{20 - \frac{9\pi^2}{4}} \approx -2.21 closest to zero), the n=3n = 3 term is amplified the most:
y(t)=120−8π2(20−π24)cos⁡ ⁣(πt2)−89π2(20−9π24)cos⁡ ⁣(3πt2)−825π2(20−25π24)cos⁡ ⁣(5πt2)−…\displaystyle \begin{aligned} \resp{y(t)} &= \frac{1}{20} \\ &- \frac{\wave{8}}{\wave{\pi^2}\sys{\left(20 - \dfrac{\pi^2}{4}\right)}}\cos\!\left(\frac{\pi t}{2}\right) \\ &- \frac{\wave{8}}{\wave{9\pi^2}\sys{\left(20 - \dfrac{9\pi^2}{4}\right)}}\cos\!\left(\frac{3\pi t}{2}\right) \\ &- \frac{\wave{8}}{\wave{25\pi^2}\sys{\left(20 - \dfrac{25\pi^2}{4}\right)}}\cos\!\left(\frac{5\pi t}{2}\right) \\ &- \dots \end{aligned}