#set document(title: "4.2 The Trigonometric Series", author: "Jiří Lebl") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 4.2#h(0.6em)The Trigonometric Series === Periodic Functions and Motivation As motivation for studying Fourier series, suppose we have the problem #math.equation(block: true, alt: "x double prime plus ω 0 2 x equals f open parenthesis t close parenthesis ,")[$x^(″) + ω_(0)^(2) x = f ( t ) ,$] for some periodic function #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$]. We have already solved #math.equation(block: true, alt: "x double prime plus ω 0 2 x equals F sub 0 cos open parenthesis ω t close parenthesis .")[$x^(″) + ω_(0)^(2) x = F_(0) cos ( ω t ) .$] One way to solve (4.2.1) is to decompose #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] as a sum of cosines (and sines) and then solve many problems of the form (4.2.2). We then use the principle of superposition, to sum up all the solutions we got to get a solution to (4.2.1). Before we proceed, let us talk a little bit more in detail about periodic functions. A function is said to be #emph[periodic]with period #math.equation(block: false, alt: "P")[$P$] if #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] for all #math.equation(block: false, alt: "t")[$t$]. For brevity we will say #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] is #math.equation(block: false, alt: "P minus")[$P −$]periodic. Note that a #math.equation(block: false, alt: "P minus")[$P −$]periodic function is also #math.equation(block: false, alt: "2 P minus")[$2 P −$]periodic, #math.equation(block: false, alt: "3 P minus")[$3 P −$]periodic and so on. For example, #math.equation(block: false, alt: "cos open parenthesis t close parenthesis")[$cos ( t )$] and #math.equation(block: false, alt: "sin open parenthesis t close parenthesis")[$sin ( t )$] are #math.equation(block: false, alt: "2 π minus")[$2 π −$]periodic. So are #math.equation(block: false, alt: "cos open parenthesis k t close parenthesis")[$cos ( k t )$] and #math.equation(block: false, alt: "sin open parenthesis k t close parenthesis")[$sin ( k t )$] for all integers #math.equation(block: false, alt: "k")[$k$]. The constant functions are an extreme example. They are periodic for any period (exercise). Normally we will start with a function #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] defined on some interval #math.equation(block: false, alt: "[ minus L , L ]")[$[ − L , L ]$] and we will want to #emph[extend]#math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] #emph[periodically]to make it a #math.equation(block: false, alt: "2 L minus")[$2 L −$]periodic function. We do this extension by defining a new function #math.equation(block: false, alt: "F open parenthesis t close parenthesis")[$F ( t )$] such that for #math.equation(block: false, alt: "t")[$t$] in#math.equation(block: false, alt: "[ minus L , L ]")[$[ − L , L ]$], #math.equation(block: false, alt: "F open parenthesis t close parenthesis equals f open parenthesis t close parenthesis")[$F ( t ) = f ( t )$]. For #math.equation(block: false, alt: "t")[$t$] in #math.equation(block: false, alt: "[ L , 3 L ]")[$[ L , 3 L ]$], we define #math.equation(block: false, alt: "F open parenthesis t close parenthesis equals f open parenthesis t minus 2 L close parenthesis")[$F ( t ) = f ( t − 2 L )$], for #math.equation(block: false, alt: "t")[$t$] in #math.equation(block: false, alt: "[ minus 3 L , minus L ]")[$[ − 3 L , − L ]$], #math.equation(block: false, alt: "F open parenthesis t close parenthesis equals f open parenthesis t plus 2 L close parenthesis")[$F ( t ) = f ( t + 2 L )$], and so on. We assumed that #math.equation(block: false, alt: "f open parenthesis minus L close parenthesis equals f open parenthesis L close parenthesis")[$f ( − L ) = f ( L )$]. We could have also started with #math.equation(block: false, alt: "f")[$f$] defined only on the half-open interval #math.equation(block: false, alt: "open parenthesis minus L , L ]")[$( − L , L ]$] and then define #math.equation(block: false, alt: "f open parenthesis minus L close parenthesis equals f open parenthesis L close parenthesis")[$f ( − L ) = f ( L )$]. #examplebox("Example 1")[][ Define #math.equation(block: false, alt: "f open parenthesis t close parenthesis equals 1 minus t squared")[$f ( t ) = 1 − t^(2)$] on #math.equation(block: false, alt: "[ minus 1 , 1 ]")[$[ − 1 , 1 ]$]. Now extend #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] periodically to a #math.equation(block: false, alt: "2")[$2$]-periodic function. See Figure #math.equation(block: false, alt: "1")[$1$] on the facing page. #figure(figph[Plot of a periodic extension over t from -3 to 3: identical smooth arches repeat every 2 units, peaking at 1.0 at the even integers and falling to 0 at the odd ones, where neighbouring arches meet in a sharp corner.], alt: "Plot of a periodic extension over t from -3 to 3: identical smooth arches repeat every 2 units, peaking at 1.0 at the even integers and falling to 0 at the odd ones, where neighbouring arches meet in a sharp corner.", caption: [Figure #math.equation(block: false, alt: "1")[$1$]: Periodic extension of the function #math.equation(block: false, alt: "1 minus t squared")[$1 − t^(2)$].]) ] You should be careful to distinguish between #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] and its extension. A common mistake is to assume that a formula for #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] holds for its extension. It can be confusing when the formula for #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] is periodic, but with perhaps a different period. #notebox("Your Turn", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Define #math.equation(block: false, alt: "f open parenthesis t close parenthesis equals cos t")[$f ( t ) = cos t$] on #math.equation(block: false, alt: "[ the fraction minus π over 2 , the fraction π over 2 ]")[$[ frac(− π, 2) , frac(π, 2) ]$]. Take the #math.equation(block: false, alt: "π minus")[$π −$]periodic extension and sketch its graph. How does it compare to the graph of #math.equation(block: false, alt: "cos t")[$cos t$]? ] === Inner Product and Eigenvector Decomposition Suppose we have a #emph[symmetric matrix], that is #math.equation(block: false, alt: "A to the power T equals A")[$A^(T) = A$]. We have said before that the eigenvectors of #math.equation(block: false, alt: "A")[$A$] are then orthogonal. Here the word #emph[orthogonal]means that if #math.equation(block: false, alt: "v →")[$arrow(v)$] and #math.equation(block: false, alt: "w →")[$arrow(w)$] are two distinct (and not multiples of each other) eigenvectors of #math.equation(block: false, alt: "A")[$A$], then #math.equation(block: false, alt: "⟨ v → , w → ⟩ equals 0")[$⟨ arrow(v) , arrow(w) ⟩ = 0$]. In this case the inner product #math.equation(block: false, alt: "⟨ v → , w → ⟩")[$⟨ arrow(v) , arrow(w) ⟩$] is the dot product, which can be computed as #math.equation(block: false, alt: "v → to the power T w →")[$arrow(v)^(T) arrow(w)$]. To decompose a vector #math.equation(block: false, alt: "v →")[$arrow(v)$] in terms of mutually orthogonal vectors #math.equation(block: false, alt: "w → sub 1")[$arrow(w)_(1)$] and #math.equation(block: false, alt: "w → sub 2")[$arrow(w)_(2)$] we write #math.equation(block: true, alt: "v → equals a sub 1 w → sub 1 plus a sub 2 w → sub 2 .")[$arrow(v) = a_(1) arrow(w)_(1) + a_(2) arrow(w)_(2) .$] Let us find the formula for #math.equation(block: false, alt: "a sub 1")[$a_(1)$] and #math.equation(block: false, alt: "a sub 2")[$a_(2)$]. First let us compute #math.equation(block: true, alt: "⟨ v → , w sub 1 → ⟩ equals ⟨ a sub 1 w → sub 1 plus a sub 2 w → sub 2 , w sub 1 → ⟩ equals a sub 1 ⟨ w → sub 1 , w sub 1 → ⟩ plus a sub 2 ⟨ w → sub 2 , w sub 1 → ⟩ ⏟ equals 0 equals a sub 1 ⟨ w → sub 1 , w sub 1 → ⟩ .")[$⟨ arrow(v) , arrow(w_(1)) ⟩ = ⟨ a_(1) arrow(w)_(1) + a_(2) arrow(w)_(2) , arrow(w_(1)) ⟩ = a_(1) ⟨ arrow(w)_(1) , arrow(w_(1)) ⟩ + a_(2) limits(underbrace(⟨ arrow(w)_(2) "," arrow(w_(1)) ⟩))_(= 0) = a_(1) ⟨ arrow(w)_(1) , arrow(w_(1)) ⟩ .$] Therefore, #math.equation(block: true, alt: "a sub 1 equals the fraction ⟨ v → , w → sub 1 ⟩ over ⟨ w → sub 1 , w → sub 1 ⟩ .")[$a_(1) = frac(⟨ arrow(v) "," arrow(w)_(1) ⟩, ⟨ arrow(w)_(1) "," arrow(w)_(1) ⟩) .$] Similarly #math.equation(block: true, alt: "a sub 2 equals the fraction ⟨ v → , w → sub 2 ⟩ over ⟨ w → sub 2 , w → sub 2 ⟩ .")[$a_(2) = frac(⟨ arrow(v) "," arrow(w)_(2) ⟩, ⟨ arrow(w)_(2) "," arrow(w)_(2) ⟩) .$] You probably remember this formula from vector calculus. #examplebox("Example 2")[][ Write #math.equation(block: false, alt: "2; 3")[$2 \ 3$] as a linear combination of #math.equation(block: false, alt: "1; minus 1")[$1 \ − 1$] and #math.equation(block: false, alt: "1; 1")[$1 \ 1$]. First note that #math.equation(block: false, alt: "w → sub 1")[$arrow(w)_(1)$] and #math.equation(block: false, alt: "w → sub 2")[$arrow(w)_(2)$] are orthogonal as #math.equation(block: false, alt: "⟨ w → sub 1 , w → sub 2 ⟩ equals 1 open parenthesis 1 close parenthesis plus open parenthesis minus 1 close parenthesis 1 equals 0")[$⟨ arrow(w)_(1) , arrow(w)_(2) ⟩ = 1 ( 1 ) + ( − 1 ) 1 = 0$]. Then #math.equation(block: true, alt: "a sub 1 equals the fraction ⟨ v → , w → sub 1 ⟩ over ⟨ w → sub 1 , w → sub 1 ⟩ equals the fraction 2 open parenthesis 1 close parenthesis plus 3 open parenthesis minus 1 close parenthesis over 1 open parenthesis 1 close parenthesis plus open parenthesis minus 1 close parenthesis open parenthesis minus 1 close parenthesis equals the fraction minus 1 over 2 ,; a sub 2 equals the fraction ⟨ v → , w → sub 2 ⟩ over ⟨ w → sub 2 , w → sub 2 ⟩ equals the fraction 2 plus 3 over 1 plus 1 equals the fraction 5 over 2 .")[$a_(1) = frac(⟨ arrow(v) "," arrow(w)_(1) ⟩, ⟨ arrow(w)_(1) "," arrow(w)_(1) ⟩) = frac(2 ( 1 ) + 3 ( − 1 ), 1 ( 1 ) + ( − 1 ) ( − 1 )) = frac(− 1, 2) , \ a_(2) = frac(⟨ arrow(v) "," arrow(w)_(2) ⟩, ⟨ arrow(w)_(2) "," arrow(w)_(2) ⟩) = frac(2 + 3, 1 + 1) = frac(5, 2) .$] Hence #math.equation(block: true, alt: "2; 3")[$2 \ 3$] ] === Trigonometric Series Instead of decomposing a vector in terms of eigenvectors of a matrix, we will decompose a function in terms of eigenfunctions of a certain eigenvalue problem. The eigenvalue problem we will use for the Fourier series is #math.equation(block: true, alt: "x double prime plus λ x equals 0 , x open parenthesis minus π close parenthesis equals x open parenthesis π close parenthesis x prime open parenthesis minus π close parenthesis equals x prime open parenthesis π close parenthesis .")[$x^(″) + λ x = 0 , " " " " " " " " x ( − π ) = x ( π ) " " " " " " " " x^(′) ( − π ) = x^(′) ( π ) .$] We have previously computed that the eigenfunctions are #math.equation(block: false, alt: "1 , cos open parenthesis k t close parenthesis , sin open parenthesis k t close parenthesis")[$1 , cos ( k t ) , sin ( k t )$]. That is, we will want to find a representation of a #math.equation(block: false, alt: "2 π minus")[$2 π −$]periodic function #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] as #math.equation(block: true, alt: "f open parenthesis t close parenthesis equals the fraction a sub 0 over 2 plus ∑ n equals 1 infinity a sub n cos open parenthesis n t close parenthesis plus b sub n sin open parenthesis n t close parenthesis .")[$f ( t ) = frac(a_(0), 2) + ∑_(n = 1)^(∞) a_(n) cos ( n t ) + b_(n) sin ( n t ) .$] This series is called the #emph[Fourier series]#math.equation(block: false, alt: "to the power 1")[$1$] or the #emph[trigonometric series] for #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$]. We write the coefficient of the eigenfunction #math.equation(block: false, alt: "1")[$1$] as #math.equation(block: false, alt: "the fraction a sub 0 over 2")[$frac(a_(0), 2)$] for convenience. We could also think of #math.equation(block: false, alt: "1 equals cos open parenthesis 0 t close parenthesis")[$1 = cos ( 0 t )$], so that we only need to look at #math.equation(block: false, alt: "cos open parenthesis k t close parenthesis")[$cos ( k t )$] and #math.equation(block: false, alt: "sin open parenthesis k t close parenthesis")[$sin ( k t )$]. As for matrices we want to find a #emph[projection]of #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] onto the subspace generated by the eigenfunctions. So we will want to define an #emph[inner product of functions]. For example, to find #math.equation(block: false, alt: "a sub n")[$a_(n)$] we want to compute #math.equation(block: false, alt: "⟨ f open parenthesis t close parenthesis , cos open parenthesis n t close parenthesis ⟩")[$⟨ f ( t ) , cos ( n t ) ⟩$]. We define the inner product as #math.equation(block: true, alt: "⟨ f open parenthesis t close parenthesis , g open parenthesis t close parenthesis ⟩ equals ∫ minus π π f open parenthesis t close parenthesis g open parenthesis t close parenthesis d t .")[$⟨ f ( t ) , g ( t ) ⟩ = ∫_(− π)^(π) f ( t ) g ( t ) d t .$] With this definition of the inner product, we have seen in the previous section that the eigenfunctions #math.equation(block: false, alt: "cos open parenthesis k t close parenthesis")[$cos ( k t )$] (including the constant eigenfunction), and #math.equation(block: false, alt: "sin open parenthesis k t close parenthesis")[$sin ( k t )$] are #emph[orthogonal]in the sense that #math.equation(block: true, alt: "⟨ cos open parenthesis m t close parenthesis , cos open parenthesis n t close parenthesis ⟩ equals 0 for m ⧸ equals n ,; ⟨ sin open parenthesis m t close parenthesis , sin open parenthesis n t close parenthesis ⟩ equals 0 for m ⧸ equals n ,; ⟨ sin open parenthesis m t close parenthesis , cos open parenthesis n t close parenthesis ⟩ equals 0 for all m and n .")[$⟨ cos ( m t ) , cos ( n t ) ⟩ = 0 #h(2em) "for " m "⧸" = n , \ ⟨ sin ( m t ) , sin ( n t ) ⟩ = 0 #h(2em) "for " m "⧸" = n , \ ⟨ sin ( m t ) , cos ( n t ) ⟩ = 0 #h(2em) "for all " m " and " n .$] By elementary calculus for #math.equation(block: false, alt: "n equals 1 , 2 , 3 , … .")[$n = 1 , 2 , 3 , … .$] we have #math.equation(block: false, alt: "⟨ cos open parenthesis n t close parenthesis , cos open parenthesis n t close parenthesis ⟩ equals π")[$⟨ cos ( n t ) , cos ( n t ) ⟩ = π$] and #math.equation(block: false, alt: "⟨ sin open parenthesis n t close parenthesis , sin open parenthesis n t close parenthesis ⟩ equals π")[$⟨ sin ( n t ) , sin ( n t ) ⟩ = π$]. For the constant we get #math.equation(block: true, alt: "⟨ 1 , 1 ⟩ equals ∫ π π 1 times 1 d t equals 2 π .")[$⟨ 1 , 1 ⟩ = ∫_(π)^(π) 1 · 1 #h(0.222em) d t = 2 π .$] The coefficients are given by #math.equation(block: true, alt: "a sub n equals the fraction ⟨ f open parenthesis t close parenthesis , cos open parenthesis n t close parenthesis ⟩ over ⟨ cos open parenthesis n t close parenthesis , cos open parenthesis n t close parenthesis ⟩ equals the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis cos open parenthesis n t close parenthesis d t ,; b sub n equals the fraction ⟨ f open parenthesis t close parenthesis , sin open parenthesis n t close parenthesis ⟩ over ⟨ sin open parenthesis n t close parenthesis , sin open parenthesis n t close parenthesis ⟩ equals the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis sin open parenthesis n t close parenthesis d t .")[$a_(n) = frac(⟨ f ( t ) "," cos ( n t ) ⟩, ⟨ cos ( n t ) "," cos ( n t ) ⟩) = frac(1, π) ∫_(− π)^(π) f ( t ) cos ( n t ) d t , \ b_(n) = frac(⟨ f ( t ) "," sin ( n t ) ⟩, ⟨ sin ( n t ) "," sin ( n t ) ⟩) = frac(1, π) ∫_(− π)^(π) f ( t ) sin ( n t ) d t .$] Compare these expressions with the finite-dimensional example. For #math.equation(block: false, alt: "a sub 0")[$a_(0)$] we get a similar formula #math.equation(block: true, alt: "a sub 0 equals 2 the fraction ⟨ f open parenthesis t close parenthesis , 1 ⟩ over ⟨ 1 , 1 ⟩ the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis d t .")[$a_(0) = 2 frac(⟨ f ( t ) "," 1 ⟩, ⟨ 1 "," 1 ⟩) frac(1, π) ∫_(− π)^(π) f ( t ) d t .$] Let us check the formulas using the orthogonality properties. Suppose for a moment that #math.equation(block: true, alt: "f open parenthesis t close parenthesis equals the fraction a sub 0 over 2 plus ∑ n equals 1 infinity a sub n cos open parenthesis n t close parenthesis plus b sub n sin open parenthesis n t close parenthesis .")[$f ( t ) = frac(a_(0), 2) + ∑_(n = 1)^(∞) a_(n) cos ( n t ) + b_(n) sin ( n t ) .$] Then for #math.equation(block: false, alt: "m greater than or equal to 1")[$m ≥ 1$] we have #math.equation(block: true, alt: "⟨ f open parenthesis t close parenthesis , cos open parenthesis m t close parenthesis ⟩ equals ⟨ the fraction a sub 0 over 2 plus ∑ n equals 1 infinity a sub n cos open parenthesis n t close parenthesis plus b sub n sin open parenthesis n t close parenthesis , cos open parenthesis m t close parenthesis ⟩; equals the fraction a sub 0 over 2 ⟨ 1 , cos open parenthesis m t close parenthesis ⟩ plus ∑ n equals 1 infinity a sub n ⟨ cos open parenthesis n t close parenthesis , cos open parenthesis m t close parenthesis ⟩ plus b sub n ⟨ sin open parenthesis n t close parenthesis , sin open parenthesis m t close parenthesis ⟩; equals a sub m ⟨ cos open parenthesis m t close parenthesis , cos open parenthesis m t close parenthesis ⟩ .")[$⟨ f ( t ) , cos ( m t ) ⟩ = ⟨ frac(a_(0), 2) + ∑_(n = 1)^(∞) a_(n) cos ( n t ) + b_(n) sin ( n t ) , cos ( m t ) ⟩ \ = frac(a_(0), 2) ⟨ 1 , cos ( m t ) ⟩ + ∑_(n = 1)^(∞) a_(n) ⟨ cos ( n t ) , cos ( m t ) ⟩ + b_(n) ⟨ sin ( n t ) , sin ( m t ) ⟩ \ = a_(m) ⟨ cos ( m t ) , cos ( m t ) ⟩ .$] And hence #math.equation(block: false, alt: "a sub m equals the fraction ⟨ f open parenthesis t close parenthesis , cos open parenthesis m t close parenthesis ⟩ over ⟨ cos open parenthesis m t close parenthesis , cos open parenthesis m t close parenthesis ⟩ .")[$a_(m) = frac(⟨ f ( t ) "," cos ( m t ) ⟩, ⟨ cos ( m t ) "," cos ( m t ) ⟩) .$] #notebox("Your Turn", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Carry out the calculation for #math.equation(block: false, alt: "a sub 0")[$a_(0)$] and #math.equation(block: false, alt: "b sub m")[$b_(m)$]. ] #examplebox("Example 3")[][ Take the function #math.equation(block: true, alt: "f open parenthesis t close parenthesis equals t")[$f ( t ) = t$] for #math.equation(block: false, alt: "t")[$t$] in #math.equation(block: false, alt: "open parenthesis minus π , π ]")[$( − π , π ]$]. Extend #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] periodically and write it as a Fourier series. This function is called the #emph[sawtooth]. The plot of the extended periodic function is given in Figure #math.equation(block: false, alt: "2")[$2$]. Let us compute the coefficients. #figure(figph[Plot of the sawtooth function, t from about -6.3 to 6.3: green segments of slope 1 climb from about -3.14 to 3.14 over each period of 2 pi, then the graph jumps straight back to the bottom.], alt: "Plot of the sawtooth function, t from about -6.3 to 6.3: green segments of slope 1 climb from about -3.14 to 3.14 over each period of 2 pi, then the graph jumps straight back to the bottom.", caption: [Figure #math.equation(block: false, alt: "2")[$2$]: The graph of the sawtooth function.]) #solutionbox[ We start with #math.equation(block: false, alt: "a sub 0")[$a_(0)$], #math.equation(block: true, alt: "a sub 0 equals the fraction 1 over π ∫ minus π π t d t equals 0 .")[$a_(0) = frac(1, π) ∫_(− π)^(π) t d t = 0 .$] We will often use the result from calculus that says that the integral of an odd function over a symmetric interval is zero. Recall that an odd function is a function #math.equation(block: false, alt: "φ open parenthesis t close parenthesis")[$φ ( t )$] such that #math.equation(block: false, alt: "φ open parenthesis minus t close parenthesis equals minus φ open parenthesis t close parenthesis")[$φ ( − t ) = − φ ( t )$]. For example the functions #math.equation(block: false, alt: "t , sin t")[$t , sin t$], or (importantly for us) #math.equation(block: false, alt: "t cos open parenthesis n t close parenthesis")[$t cos ( n t )$] are all odd functions. Thus #math.equation(block: true, alt: "a sub n equals the fraction 1 over π ∫ minus π π t cos open parenthesis n t close parenthesis d t equals 0 .")[$a_(n) = frac(1, π) ∫_(− π)^(π) t cos ( n t ) d t = 0 .$] Let us move to #math.equation(block: false, alt: "b sub n")[$b_(n)$]. Another useful fact from calculus is that the integral of an even function over a symmetric interval is twice the integral of the same function over half the interval. Recall an #emph[even function] is a function #math.equation(block: false, alt: "φ open parenthesis t close parenthesis")[$φ ( t )$] such that #math.equation(block: false, alt: "φ open parenthesis minus t close parenthesis equals φ open parenthesis t close parenthesis")[$φ ( − t ) = φ ( t )$]. For example #math.equation(block: false, alt: "t sin open parenthesis n t close parenthesis")[$t sin ( n t )$] is even. #math.equation(block: true, alt: "b sub n equals the fraction 1 over π ∫ minus π π t sin open parenthesis n t close parenthesis d t; equals the fraction 2 over π ∫ 0 π t sin open parenthesis n t close parenthesis d t; equals the fraction 2 over π open parenthesis [ the fraction minus t cos open parenthesis n t close parenthesis over n ] t equals 0 π plus the fraction 1 over n ∫ 0 π cos open parenthesis n t close parenthesis d t close parenthesis; equals the fraction 2 over π open parenthesis the fraction minus π cos open parenthesis n π close parenthesis over n plus 0 close parenthesis; equals the fraction minus 2 cos open parenthesis n π close parenthesis over n equals the fraction 2 open parenthesis minus 1 close parenthesis to the power n plus 1 over n .")[$b_(n) = frac(1, π) ∫_(− π)^(π) t sin ( n t ) d t \ = frac(2, π) ∫_(0)^(π) t sin ( n t ) d t \ = frac(2, π) ( attach([ frac(− t cos ( n t ), n) ], t: π, b: t = 0) + frac(1, n) ∫_(0)^(π) cos ( n t ) d t ) \ = frac(2, π) ( frac(− π cos ( n π ), n) + 0 ) \ = frac(− 2 cos ( n π ), n) = frac(2 ( − 1 )^(n + 1), n) .$] We have used the fact that #math.equation(block: true, alt: "1 i f n e v e n ,; minus 1 i f n o d d .")[$1 " " " " " " " " " " upright(i) upright(f) " " n " " upright(e) upright(v) upright(e) upright(n) , " " \ − 1 " " " " " " " " " " upright(i) upright(f) " " n " " upright(o) upright(d) upright(d) . " "$] The series, therefore, is #math.equation(block: true, alt: "∑ n equals 1 infinity the fraction 2 open parenthesis minus 1 close parenthesis to the power n plus 1 over n sin open parenthesis n t close parenthesis .")[$∑_(n = 1)^(∞) frac(2 ( − 1 )^(n + 1), n) sin ( n t ) .$] Let us write out the first #math.equation(block: false, alt: "3")[$3$] harmonics of the series for #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$]. #math.equation(block: true, alt: "2 sin open parenthesis t close parenthesis minus sin open parenthesis 2 t close parenthesis plus the fraction 2 over 3 sin open parenthesis 3 t close parenthesis plus ⋯")[$2 sin ( t ) − sin ( 2 t ) + frac(2, 3) sin ( 3 t ) + ⋯$] The plot of these first three terms of the series, along with a plot of the first #math.equation(block: false, alt: "20")[$20$] terms is given in Figure #math.equation(block: false, alt: "3")[$3$]. #figure(figph[Two plots of blue Fourier partial sums over the green sawtooth ramps. The three-term sum wobbles and tops out near 2.9; the twenty-term sum nearly matches but overshoots to about 3.4 at each jump.], alt: "Two plots of blue Fourier partial sums over the green sawtooth ramps. The three-term sum wobbles and tops out near 2.9; the twenty-term sum nearly matches but overshoots to about 3.4 at each jump.", caption: [Figure #math.equation(block: false, alt: "3")[$3$]: First 3 (left graph) and 20 (right graph) harmonics of the sawtooth function.]) ] ] #examplebox("Example 4")[][ Take the function #math.equation(block: true, alt: "0 i f minus π less than t less than or equal to 0 ,; π i f 0 less than t less than or equal to π .")[$0 " " " " " " " " " " upright(i) upright(f) " " − π < t ≤ 0 , \ π " " upright(i) upright(f) " " 0 < t ≤ π .$] Extend #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] periodically and write it as a Fourier series. This function or its variants appear often in applications and the function is called the square wave. #figure(figph[Plot of the square wave function over t from about -6.3 to 6.3: green segments sit at about 3.14 for an interval of length pi, then drop to 0 for the next, repeating with period 2 pi.], alt: "Plot of the square wave function over t from about -6.3 to 6.3: green segments sit at about 3.14 for an interval of length pi, then drop to 0 for the next, repeating with period 2 pi.", caption: [Figure #math.equation(block: false, alt: "4")[$4$]: The graph of the square wave function.]) The plot of the extended periodic function is given in Figure #math.equation(block: false, alt: "4")[$4$]. Now we compute the coefficients. Let us start with #math.equation(block: false, alt: "a sub 0")[$a_(0)$] #math.equation(block: true, alt: "a sub 0 equals the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis d t equals the fraction 1 over π ∫ 0 π π d t equals π .")[$a_(0) = frac(1, π) ∫_(− π)^(π) f ( t ) d t = frac(1, π) ∫_(0)^(π) π d t = π .$] Next, #math.equation(block: true, alt: "a sub n equals the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis cos open parenthesis n t close parenthesis d t equals the fraction 1 over π ∫ 0 π π cos open parenthesis n t close parenthesis d t equals 0 .")[$a_(n) = frac(1, π) ∫_(− π)^(π) f ( t ) cos ( n t ) d t = frac(1, π) ∫_(0)^(π) π cos ( n t ) d t = 0 .$] And finally #math.equation(block: true, alt: "b sub n equals the fraction 1 over π ∫ minus π π f open parenthesis t close parenthesis sin open parenthesis n t close parenthesis d t; equals the fraction 1 over π ∫ 0 π π sin open parenthesis n t close parenthesis d t; equals [ the fraction minus cos open parenthesis n t close parenthesis over n ] t equals 0 π; equals the fraction 1 minus cos open parenthesis π n close parenthesis over n equals the fraction 1 minus open parenthesis minus 1 close parenthesis to the power n over n equals { the fraction 2 over n i f n i s o d d ,; 0 i f n i s e v e n .")[$b_(n) = frac(1, π) ∫_(− π)^(π) f ( t ) sin ( n t ) d t \ = frac(1, π) ∫_(0)^(π) π sin ( n t ) d t \ = attach([ frac(− cos ( n t ), n) ], t: π, b: t = 0) \ = frac(1 − cos ( π n ), n) = frac(1 − ( − 1 )^(n), n) = \{ frac(2, n) " " " " " " " " " " upright(i) upright(f) " " n " " upright(i) upright(s) " " upright(o) upright(d) upright(d) , " " \ 0 " " " " " " " " " " upright(i) upright(f) " " n " " upright(i) upright(s) " " upright(e) upright(v) upright(e) upright(n) . " "$] The Fourier series is #math.equation(block: true, alt: "the fraction π over 2 plus ∑ n equals 1 n o d d infinity the fraction 2 over n sin open parenthesis n t close parenthesis plus ∑ k equals 1 infinity the fraction 2 over 2 k minus 1 sin open parenthesis open parenthesis 2 k minus 1 close parenthesis t close parenthesis .")[$frac(π, 2) + ∑_(n = 1 " " n " " upright(o) upright(d) upright(d))^(∞) frac(2, n) sin ( n t ) + ∑_(k = 1)^(∞) frac(2, 2 k − 1) sin ( ( 2 k − 1 ) t ) .$] Let us write out the first 3 harmonics of the series for #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$]. #math.equation(block: true, alt: "the fraction π over 2 plus 2 sin open parenthesis t close parenthesis plus the fraction 2 over 3 sin open parenthesis 3 t close parenthesis plus ⋯")[$frac(π, 2) + 2 sin ( t ) + frac(2, 3) sin ( 3 t ) + ⋯$] The plot of these first three and also of the first 20 terms of the series is given in Figure #math.equation(block: false, alt: "5")[$5$]. #figure(figph[Two plots of blue partial sums over the green square wave levels of about 3.14 and 0. The three-term sum only crudely suggests the steps; the twenty-term sum tracks them but ripples, overshooting to about 3.4.], alt: "Two plots of blue partial sums over the green square wave levels of about 3.14 and 0. The three-term sum only crudely suggests the steps; the twenty-term sum tracks them but ripples, overshooting to about 3.4.", caption: [Figure #math.equation(block: false, alt: "5")[$5$]: First 3 (left graph) and 20 (right graph) harmonics of the square wave function.]) ] We have so far skirted the issue of convergence. For example, if #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] is the square wave function, the equation #math.equation(block: true, alt: "f open parenthesis t close parenthesis equals the fraction π over 2 plus ∑ k equals 1 infinity the fraction 2 over 2 k minus 1 sin open parenthesis open parenthesis 2 k minus 1 close parenthesis t close parenthesis .")[$f ( t ) = frac(π, 2) + ∑_(k = 1)^(∞) frac(2, 2 k − 1) sin ( ( 2 k − 1 ) t ) .$] is only an equality for such #math.equation(block: false, alt: "t")[$t$] where #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] is continuous. That is, we do not get an equality for #math.equation(block: false, alt: "t equals minus π , 0 , π")[$t = − π , 0 , π$] and all the other discontinuities of #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$]. It is not hard to see that when #math.equation(block: false, alt: "t")[$t$] is an integer multiple of #math.equation(block: false, alt: "π")[$π$] (which includes all the discontinuities), then #math.equation(block: true, alt: "the fraction π over 2 plus ∑ k equals 1 infinity the fraction 2 over 2 k minus 1 sin open parenthesis open parenthesis 2 k minus 1 close parenthesis t close parenthesis equals the fraction π over 2 .")[$frac(π, 2) + ∑_(k = 1)^(∞) frac(2, 2 k − 1) sin ( ( 2 k − 1 ) t ) = frac(π, 2) .$] We redefine #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] on #math.equation(block: false, alt: "[ minus π , π ]")[$[ − π , π ]$] as #math.equation(block: true, alt: "0 i f minus π less than t less than 0 ,; π i f 0 less than t less than π ,; π / 2 i f t equals minus π , t equals 0 , o r t equals π ,")[$0 " " " " " " " " " " upright(i) upright(f) " " − π < t < 0 , \ π " " upright(i) upright(f) " " 0 < t < π , \ π / 2 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " upright(i) upright(f) " " t = − π , t = 0 , " " upright(o) upright(r) " " t = π ,$] and extend periodically. The series equals this extended #math.equation(block: false, alt: "f open parenthesis t close parenthesis")[$f ( t )$] everywhere, including the discontinuities. We will generally not worry about changing the function values at several (finitely many) points. We will say more about convergence in the next section. Let us however mention briefly an effect of the discontinuity. Let us zoom in near the discontinuity in the square wave. Further, let us plot the first 100 harmonics, see Figure #math.equation(block: false, alt: "6")[$6$]. You will notice that while the series is a very good approximation away from the discontinuities, the error (the overshoot) near the discontinuity at #math.equation(block: false, alt: "t equals π")[$t = π$] does not seem to be getting any smaller. This behavior is known as the #emph[Gibbs phenomenon]. The region where the error is large does get smaller, however, the more terms in the series we take. Lebl's Figure 5 freezes this at two settings, 3 harmonics and 20; here you can sweep between them and past them. The dashed trace is the square wave itself; the solid curve is the partial sum of his own series pi/2 + 2 sin t + (2/3) sin 3t + (2/5) sin 5t + .... At the default 3 you are looking at his left-hand panel exactly, and at 20 at his right-hand one. Drag between them and the ripples multiply and crowd in toward the jumps at t = 0 and t = +/- pi, but the tall spike beside each jump refuses to come down: its peak falls only from 3.456 to 3.424 across that whole drag, and never drops below 3.4227 = 1.0895\*pi -- a permanent overshoot of 8.95 % of the jump height pi. Even-numbered settings look identical to the odd one below them, because a square wave has no even harmonics at all: this section computes b\_n = 0 for every even n. {"functions":\[{"color":"\#b8442a","domain":null,"expression":"(pi/2)\*(1+sign(sin(t)))","expression2":"","id":"square","inequality":"lt","lineDash":\[6,4\],"lineWidth":1.5,"mode":"cartesian","tMax":10,"tMin":-10,"variable":"t","visible":true},{"color":"\#1f4e79","domain":null,"expression":"pi/2 + (1+sign(n-0.5))/1\*sin(1\*t) + (1+sign(n-2.5))/3\*sin(3\*t) + (1+sign(n-4.5))/5\*sin(5\*t) + (1+sign(n-6.5))/7\*sin(7\*t) + (1+sign(n-8.5))/9\*sin(9\*t) + (1+sign(n-10.5))/11\*sin(11\*t) + (1+sign(n-12.5))/13\*sin(13\*t) + (1+sign(n-14.5))/15\*sin(15\*t) + (1+sign(n-16.5))/17\*sin(17\*t) + (1+sign(n-18.5))/19\*sin(19\*t) + (1+sign(n-20.5))/21\*sin(21\*t) + (1+sign(n-22.5))/23\*sin(23\*t) + (1+sign(n-24.5))/25\*sin(25\*t) + (1+sign(n-26.5))/27\*sin(27\*t) + (1+sign(n-28.5))/29\*sin(29\*t) + (1+sign(n-30.5))/31\*sin(31\*t) + (1+sign(n-32.5))/33\*sin(33\*t) + (1+sign(n-34.5))/35\*sin(35\*t) + (1+sign(n-36.5))/37\*sin(37\*t) + (1+sign(n-38.5))/39\*sin(39\*t)","expression2":"","id":"partial","inequality":"lt","lineDash":\[\],"lineWidth":2.5,"mode":"cartesian","tMax":10,"tMin":-10,"variable":"t","visible":true}\],"grid":{"axisColor":"\#333333","gridColor":"\#cccccc","majorSpacing":1,"minorGridColor":"\#eeeeee","showAxes":true,"showLabels":true},"parameters":\[{"id":"n","label":"Highest harmonic kept","max":39,"min":1,"name":"n","step":1,"unit":"","value":3}\],"title":"Gibbs phenomenon in the square-wave Fourier series","version":1,"viewport":{"centerX":0,"centerY":1.5708,"scale":100}} #figure(figph[Close-up of the Gibbs phenomenon: the blue partial sum ripples about a flat green line at the true value of about 3.14, the wiggles growing toward the jump until the tallest reaches roughly 3.42.], alt: "Close-up of the Gibbs phenomenon: the blue partial sum ripples about a flat green line at the true value of about 3.14, the wiggles growing toward the jump until the tallest reaches roughly 3.42.", caption: [Figure #math.equation(block: false, alt: "6")[$6$]: Gibbs phenomenon in action.]) We can think of a periodic function as a “signal” being a superposition of many signals of pure frequency. For example, we could think of the square wave as a tone of certain base frequency. This base frequency is called the #emph[fundamental frequency]. The square wave will be a superposition of many different pure tones of frequencies that are multiples of the fundamental frequency. In music, the higher frequencies are called the #emph[overtones]. All the frequencies that appear are called the #emph[spectrum]of the signal. On the other hand a simple sine wave is only the pure tone (no overtones). The simplest way to make sound using a computer is the square wave, and the sound is very different from a pure tone. If you ever played video games from the 1980s or so, then you heard what square waves sound like. === Footnotes \[1\] Named after the French mathematician #link("http://en.Wikipedia.org/wiki/Joseph_Fourier")[Jean Baptiste Joseph Fourier] (1768 – 1830).