7.7 Practice Problems

These are the tutorial questions for this section, worked in full.

Problem 7.7.1. Find the Fourier series of the \(2\pi \)-periodic function \[f(x) = \begin {cases} 0, & -\pi <x<0\\ \frac {\pi }{2}, & 0<x<\frac {\pi }{2}\\ 0, & \frac {\pi }{2}<x<\pi \end {cases}\]

Show solution

Solution. The function is neither even nor odd, so all three coefficient families are needed. Only the interval \(\Big (0,\dfrac {\pi }{2}\Big )\) contributes.

\[a_0 = \frac 1\pi \int _0^{\pi /2}\frac {\pi }{2}dx = \frac {\pi }{4}, \qquad \text {so the constant term is } \frac {a_0}{2} = \frac {\pi }{8}.\] \[a_n = \frac 1\pi \int _0^{\pi /2}\frac {\pi }{2}\cos nx\,dx = \frac {1}{2n}\sin \frac {n\pi }{2},\] \[b_n = \frac 1\pi \int _0^{\pi /2}\frac {\pi }{2}\sin nx\,dx = \frac {1-\cos \frac {n\pi }{2}}{2n}.\] Hence \[f(x) \sim \frac {\pi }{8} + \sum _{n=1}^{\infty }\left [\frac {\sin \frac {n\pi }{2}}{2n}\cos nx + \frac {1-\cos \frac {n\pi }{2}}{2n}\sin nx\right ].\] Note \(\sin \frac {n\pi }{2}\) vanishes for even \(n\), so only odd harmonics carry cosine terms.

Problem 7.7.2. Find the Fourier series of the \(2L\)-periodic function \[(i)\ f(x) = \begin {cases}1, & -1<x<1\\ 0, & 1<x<3\end {cases} \qquad (ii)\ f(x) = \begin {cases}\frac 12+x, & -\frac 12<x<0\\ \frac 12-x, & 0<x<\frac 12\end {cases}\]

Show solution

Solution.

(i)

The period is \(4\), so \(L = 2\). The function is even about the origin on \((-2,2)\), so all \(b_n\) vanish. \[\frac {a_0}{2} = \frac {1}{2L}\int _{-1}^{1}1\,dx = \frac {2}{4} = \frac 12 ,\] \[a_n = \frac 1L\int _{-1}^{1}\cos \frac {n\pi x}{2}dx = \frac {2}{n\pi }\sin \frac {n\pi }{2}.\] Hence \[f(x)\sim \frac 12 + \frac {2}{\pi }\sum _{n=1}^{\infty } \frac {\sin \frac {n\pi }{2}}{n}\cos \frac {n\pi x}{2} = \frac 12 + \frac {2}{\pi }\Big (\cos \frac {\pi x}{2} - \frac 13\cos \frac {3\pi x}{2} + \frac 15\cos \frac {5\pi x}{2} - \cdots \Big ).\]

(ii)

This is the triangular wave \(\dfrac 12-\left |x\right |\) on \(\Big (-\dfrac 12,\dfrac 12\Big )\), of period \(1\), so \(L = \dfrac 12\). It is even, so again \(b_n = 0\). \[\frac {a_0}{2} = \frac {1}{2L}\int _{-1/2}^{1/2}\Big (\frac 12-\left |x\right |\Big )dx = \frac 14 ,\] \[a_n = \frac {2}{L}\int _0^{1/2}\Big (\frac 12-x\Big )\cos 2n\pi x\,dx = \frac {1-(-1)^n}{n^2\pi ^2},\] which is \(\dfrac {2}{n^2\pi ^2}\) for odd \(n\) and zero for even \(n\). Hence \[f(x)\sim \frac 14 + \frac {2}{\pi ^2}\sum _{n\ \text {odd}} \frac {\cos 2n\pi x}{n^2}.\] The \(n^{-2}\) decay is characteristic: a continuous function with corners has coefficients falling like \(n^{-2}\), while the discontinuous square wave of part (i) manages only \(n^{-1}\).

Problem 7.7.3. Use the series obtained above to show that \[(i)\ 1+\frac 14+\frac 19+\frac {1}{16}+\cdots = \frac {\pi ^2}{6}, \qquad (ii)\ 1-\frac 13+\frac 15-\frac 17+\cdots = \frac {\pi }{4}.\]

Show solution

Solution.

(i)

Take the Fourier series of \(f(x) = x^2\) on \((-\pi ,\pi )\), extended with period \(2\pi \). It is even, so \[\frac {a_0}{2} = \frac {\pi ^2}{3},\qquad a_n = \frac {2}{\pi }\int _0^{\pi }x^2\cos nx\,dx = \frac {4(-1)^n}{n^2},\] giving \[x^2 \sim \frac {\pi ^2}{3} + 4\sum _{n=1}^{\infty }\frac {(-1)^n}{n^2}\cos nx .\] Setting \(x = \pi \), where the extension is continuous, \(\cos n\pi = (-1)^n\) and \[\pi ^2 = \frac {\pi ^2}{3} + 4\sum _{n=1}^{\infty }\frac {1}{n^2} \implies \sum _{n=1}^{\infty }\frac {1}{n^2} = \frac {\pi ^2}{6}.\]

(ii)

Use the square wave of question 2(i) and evaluate at \(x=0\), where the function is continuous with value \(1\): \[1 = \frac 12 + \frac {2}{\pi }\Big (1-\frac 13+\frac 15-\cdots \Big ) \implies 1-\frac 13+\frac 15-\cdots = \frac {\pi }{4}.\] This is Leibniz’s series, and obtaining it from a Fourier expansion is the standard illustration that these series carry arithmetic information as well as analytic.

Problem 7.7.4. Represent \(f(x) = \begin {cases}0, & 0<x<\frac L2\\ 1, & \frac L2<x<L\end {cases}\) by a Fourier cosine series and by a Fourier sine series.

Show solution

Solution. On \((0,L)\) a function may be extended either evenly, giving a cosine series, or oddly, giving a sine series. Both represent \(f\) on the original interval.

Cosine series (even extension)

\[\frac {a_0}{2} = \frac 1L\int _{L/2}^{L}dx = \frac 12 ,\] \[a_n = \frac 2L\int _{L/2}^{L}\cos \frac {n\pi x}{L}dx = \frac {2}{n\pi }\Big (\sin n\pi - \sin \frac {n\pi }{2}\Big ) = -\frac {2}{n\pi }\sin \frac {n\pi }{2},\] so \[f(x)\sim \frac 12 - \frac {2}{\pi }\sum _{n=1}^{\infty } \frac {\sin \frac {n\pi }{2}}{n}\cos \frac {n\pi x}{L}.\]

Sine series (odd extension)

\[b_n = \frac 2L\int _{L/2}^{L}\sin \frac {n\pi x}{L}dx = \frac {2}{n\pi }\Big (\cos \frac {n\pi }{2} - \cos n\pi \Big ) = \frac {2}{n\pi }\Big (\cos \frac {n\pi }{2} - (-1)^n\Big ),\] so \[f(x)\sim \frac {2}{\pi }\sum _{n=1}^{\infty } \frac {\cos \frac {n\pi }{2}-(-1)^n}{n}\sin \frac {n\pi x}{L}.\] The two series agree on \((0,L)\) and differ everywhere else, which is the point: the extension is a choice, not a property of \(f\).

Problem 7.7.5. Represent \(f(x) = \begin {cases}x, & 0<x<\frac L2\\ L-x, & \frac L2<x<L\end {cases}\) by a Fourier sine series.

Show solution

Solution. This is the triangular pulse, zero at both ends and peaking at \(\dfrac L2\). Extending oddly, \[b_n = \frac 2L\left [\int _0^{L/2}x\sin \frac {n\pi x}{L}dx + \int _{L/2}^{L}(L-x)\sin \frac {n\pi x}{L}dx\right ].\] Each part is integrated by parts. The boundary terms cancel between the two pieces, since \(f\) is continuous at \(\dfrac L2\), and what survives is \[b_n = \frac {4L}{n^2\pi ^2}\sin \frac {n\pi }{2}.\] Hence \[f(x)\sim \frac {4L}{\pi ^2}\sum _{n=1}^{\infty } \frac {\sin \frac {n\pi }{2}}{n^2}\sin \frac {n\pi x}{L} = \frac {4L}{\pi ^2}\left (\sin \frac {\pi x}{L} - \frac 19\sin \frac {3\pi x}{L} + \frac {1}{25}\sin \frac {5\pi x}{L}-\cdots \right ),\] only odd harmonics appearing, and again with \(n^{-2}\) decay because the function is continuous with a corner.

Problem 7.7.6. Represent \(f(x) = \sin \pi x\) on \((0,1)\) by a Fourier cosine series.

Show solution

Solution. The sine series is trivial — the function is already one term of it — so the cosine series is the substantive question. Extending evenly, \[\frac {a_0}{2} = \int _0^1\sin \pi x\,dx = \frac {2}{\pi },\] and for \(n\geq 1\), \[a_n = 2\int _0^1\sin \pi x\cos n\pi x\,dx = \int _0^1\Big [\sin (1+n)\pi x + \sin (1-n)\pi x\Big ]dx .\] For \(n=1\) the second term vanishes identically and the first integrates to zero, so \(a_1 = 0\). For \(n\geq 2\), \[a_n = -\frac {2\big [(-1)^n+1\big ]}{\pi \big (n^2-1\big )},\] which is zero for odd \(n\) and \(-\dfrac {4}{\pi \big (n^2-1\big )}\) for even \(n\). Hence \[\sin \pi x \sim \frac {2}{\pi } - \frac {4}{\pi }\sum _{k=1}^{\infty }\frac {\cos 2k\pi x}{4k^2-1}, \qquad 0<x<1 .\] Both extensions represent the same function on \((0,1)\); the even one is continuous everywhere, which is why its coefficients decay like \(n^{-2}\).

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.