NivaarExam PrepOfficial exam papers ↗

04-BS-5 · December 2013

Question 2 of 7: Fourier Series of a Piecewise Function

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — December 2013 — 04-BS-5 Advanced Mathematics. Three-hour, closed-book exam (one double-sided 8.5"×11" aid sheet permitted; approved Casio/Sharp calculator allowed). Format: seven questions (Q1 20, Q2 20, Q3 20, Q4 20, Q5 20, Q6 20, Q7 20 marks, per the printed marking scheme); any five constitute a complete paper and only the first five appearing in the answer book are marked. All seven are solved below for completeness.

Reference texts: Kreyszig, Advanced Engineering Mathematics (10th ed., Wiley) — power-series solutions of ODEs about an ordinary point (Ch. 5), Fourier series and the Fourier transform (Ch. 11), numerics in general: interpolation, root-finding, Romberg integration (Ch. 19), numeric linear algebra: LU factorization (Ch. 20); Burden & Faires, Numerical Analysis (9th ed., Cengage) — Newton divided-difference interpolation, finite-difference derivative stencils, Newton–Raphson/bisection/fixed-point convergence theory, Romberg extrapolation, Doolittle LU factorization.

Question 2: Fourier Series of a Piecewise Function (20 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given data
IntervalDefinition
$-\pi\le x\lt0$$f(x)=-\pi$
$0\le x\le\pi$$f(x)=x$
Period$p=2\pi$

Find. The full Fourier series $f(x)\sim\dfrac{a_0}{2}+\sum_{n=1}^{\infty}\big[a_n\cos(nx)+b_n\sin(nx)\big]$.

Approach. Apply the Euler formulas over one period $[-\pi,\pi]$, splitting each integral at $x=0$ to match the piecewise definition, and simplify using $\cos(n\pi)=(-1)^n$.

  1. Constant term. $a_0=\dfrac1\pi\displaystyle\int_{-\pi}^{\pi}f(x)\,dx=\dfrac1\pi\left[\int_{-\pi}^{0}(-\pi)\,dx+\int_0^\pi x\,dx\right]=\dfrac1\pi\left[-\pi^2+\dfrac{\pi^2}{2}\right]=-\dfrac{\pi}{2}$, so $$\boxed{\dfrac{a_0}{2}=-\dfrac{\pi}{4}}$$
  2. Cosine coefficients. The constant piece contributes $\int_{-\pi}^0\cos(nx)\,dx=\dfrac{\sin(n\pi)}{n}=0$. Integrating the second piece by parts, $\int_0^\pi x\cos(nx)\,dx=\dfrac{\cos(n\pi)-1}{n^2}=\dfrac{(-1)^n-1}{n^2}$, so $$a_n=\dfrac1\pi\cdot\dfrac{(-1)^n-1}{n^2}=\begin{cases}0,& n\text{ even}\\[2pt]-\dfrac{2}{\pi n^2},& n\text{ odd}\end{cases}$$
  3. Sine coefficients. $\int_{-\pi}^0(-\pi)\sin(nx)\,dx=\pi\cdot\dfrac{1-(-1)^n}{n}$ and $\int_0^\pi x\sin(nx)\,dx=-\dfrac{\pi(-1)^n}{n}$. Summing and dividing by $\pi$, $$b_n=\dfrac{1-(-1)^n}{n}-\dfrac{(-1)^n}{n}=\dfrac{1-2(-1)^n}{n}=\begin{cases}-\dfrac1n,& n\text{ even}\\[2pt]\dfrac3n,& n\text{ odd}\end{cases}$$
  4. Assemble the series. Substituting the closed forms for $n=1,2,3,4,\dots$, $$f(x)\sim\boxed{-\dfrac{\pi}{4}+\sum_{n\text{ odd}}\left(-\dfrac{2}{\pi n^2}\cos(nx)+\dfrac{3}{n}\sin(nx)\right)+\sum_{n\text{ even}}\left(-\dfrac1n\sin(nx)\right)}$$ $$=-\dfrac\pi4+\left(-\dfrac2\pi\cos x+3\sin x\right)+\left(-\dfrac12\sin2x\right)+\left(-\dfrac{2}{9\pi}\cos3x+\sin3x\right)+\left(-\dfrac14\sin4x\right)+\cdots$$ At a continuity point such as $x=\dfrac\pi2$ the series converges to $f(\pi/2)=\pi/2$ (confirmed: the 400-term partial sum is $1.567$, within $0.4\%$ and still tightening — convergence is slow because $b_n\sim1/n$). At the jump $x=0$ it converges to the average of the one-sided limits, $\tfrac12(-\pi+0)=-\dfrac\pi2$; at $x=\pm\pi$ it converges to $\tfrac12(\pi+(-\pi))=0$ (both confirmed by a 2000-term partial sum).
QuantityResult
$a_0/2$$-\pi/4$
$a_n$$0$ ($n$ even), $-2/(\pi n^2)$ ($n$ odd)
$b_n$$-1/n$ ($n$ even), $3/n$ ($n$ odd)
Value at jump $x=0$$-\pi/2$ (average of one-sided limits)
Value at $x=\pm\pi$$0$ (average of one-sided limits)