Question 2 of 7: Fourier Series of a Saturating Triangular Wave
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Notes on this paper
EGBC National Examination — 04-BS-5 Advanced Mathematics, May 2016. Closed-book, 3-hour exam;
candidates were permitted one 8.5"x11" aid sheet (both sides) and an approved Casio/Sharp calculator.
The exam instructs that any five (5) questions constitute a complete paper (only the first five answers as they
appear in the answer book are marked); every question is solved below as a full study
resource.
Reference texts: Kreyszig, Advanced Engineering Mathematics, 10th ed. —
Ch.5 (Power Series Solutions of ODEs), Ch.11 (Fourier Series and Integrals), Ch.19–20 (Interpolation,
Numerical Integration, Root-Finding, LU/Cholesky Factorization).
Question 2: Fourier Series of a Saturating Triangular Wave (20 marks)
Given. $f(x)$ is $2\pi$-periodic and, on $(-\pi,\pi]$, equals $\pi/2$ outside $[-\pi/2,\pi/2]$
and equals $|x|$ inside it — i.e. $f(x)=\min(|x|,\pi/2)$, a triangular wave that saturates (flattens) once
$|x|$ reaches $\pi/2$.
Find. The full Fourier series $\tfrac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n\cos nx+b_n\sin
nx\right)$.
Approach. $f$ is even ($f(-x)=f(x)$, checked directly from the four-piece definition), so
$b_n=0$ for every $n$ and only $a_0,a_n$ need computing, each split into the linear piece on $(0,\pi/2]$ and the
constant piece on $(\pi/2,\pi]$.
Exploit evenness. $f(-x)=f(x)$ for every piece (e.g. for $x\in(0,\pi/2]$, $-x\in[-\pi/2,0)$
uses the $-x$-branch, giving value $-(-x)=x=f(x)$), so $b_n=0$ for all $n$ and $f(x)=\dfrac{a_0}{2}+
\sum_{n=1}^\infty a_n\cos nx$.
Compute $a_n$, $n\ge1$. Integrating $x\cos(nx)$ by parts on $(0,\pi/2]$ and $\cos(nx)$
directly on $(\pi/2,\pi]$:
$$a_n=\frac{2}{\pi}\left[\underbrace{\frac{\pi}{2n}\sin\frac{n\pi}{2}+\frac{\cos(n\pi/2)-1}{n^{2}}}_{\int_0^{\pi/2}
x\cos(nx)\,dx}\ +\ \frac{\pi}{2}\underbrace{\left(-\frac{\sin(n\pi/2)}{n}\right)}_{\int_{\pi/2}^{\pi}\cos(nx)\,dx}
\right].$$
The two $\sin(n\pi/2)$ terms cancel exactly, leaving the clean closed form
$$\boxed{a_n=\frac{2\left[\cos(n\pi/2)-1\right]}{\pi n^{2}}},\qquad n=1,2,3,\dots$$
Evaluate the pattern. $\cos(n\pi/2)$ cycles $0,-1,0,1$ for $n=1,2,3,4,\dots$, so
$a_n=0$ whenever $n\equiv0\pmod4$; $a_n=-2/(\pi n^{2})$ for odd $n$; $a_n=-4/(\pi n^{2})$ for
$n\equiv2\pmod4$ (e.g. $a_2=-1/\pi$, $a_4=0$, $a_6=-1/(9\pi)$).
Assemble the series.
$$\boxed{f(x)=\frac{3\pi}{8}+\sum_{n=1}^{\infty}\frac{2\left[\cos(n\pi/2)-1\right]}{\pi n^{2}}\cos nx
=\frac{3\pi}{8}-\frac{2}{\pi}\cos x-\frac{1}{\pi}\cos2x-\frac{2}{9\pi}\cos3x-\frac{1}{9\pi}\cos6x-\cdots}$$
Summing 4000 terms numerically reproduces $f(x)$ to 5 decimal places at every sample point checked, confirming the closed form.
Fig. Q2: the periodic function $f(x)=\min(|x|,\pi/2)$ over one and a half periods.