Find the Fourier series for the function with period 2π defined by
f(t)= \begin{cases}0 & -\pi<t<-\pi / 2 \\ 4 & -\pi / 2 \leqslant t \leqslant \pi / 2 \\ 0 & \pi / 2<t<\pi\end{cases}As usual we sketch the function first (Figure 23.17). Inspection of Figure 23.17 shows that the Dirichlet conditions (page 697) are satisfied. We note from the graph that the function is symmetrical about the vertical axis; that is, it is an even function. We shall see shortly that this fact has important implications for the Fourier series representation. For convenience we consider the period of integration to b \left[-\frac{T}{2}, \frac{T}{2}\right]. Hence Equation (23.4) becomes
a_n=\frac{2}{T} \int_0^T f(t) \cos \frac{2 n \pi t}{T} \mathrm{~d} t \quad \text { for } n \text { a positive integer } (23.4)
In this example the period T equals 2π. The formula for a_n then simplifies to
a_n=\frac{1}{\pi} \int_{-\pi}^\pi f(t) \cos n t \mathrm{~d} tThe interval of integration is from t=-\pi \text { to } t=\pi. However, a glance at the graph shows that the function is zero outside the interval -\frac{\pi}{2} \leqslant t \leqslant \frac{\pi}{2}, and takes the value 4 inside. The integral thus reduces to
\begin{aligned} a_n & =\frac{1}{\pi} \int_{-\pi / 2}^{\pi / 2} 4 \cos n t \mathrm{~d} t \\ & =\frac{4}{\pi} \int_{-\pi / 2}^{\pi / 2} \cos n t \mathrm{~d} t \\ & =\frac{4}{\pi}\left[\frac{\sin n t}{n}\right]_{-\pi / 2}^{\pi / 2} \\ & =\frac{4}{n \pi}\left[\sin \frac{n \pi}{2}-\sin \left(-\frac{n \pi}{2}\right)\right] \\ & =\frac{8}{n \pi} \sin \frac{n \pi}{2} \end{aligned}We obtain a_1=\frac{8}{\pi}, a_2=0, a_3=-\frac{8}{3 \pi}, etc. We find ciq using Equation (23.3), again integrating over \left[-\frac{T}{2}, \frac{T}{2}\right]:
a_0=\frac{2}{T} \int_0^T f(t) \mathrm{d} t (23.3)
Similarly, to find the Fourier coefficients, b_n, we use Equation (23.5):
b_n=\frac{2}{T} \int_0^T f(t) \sin \frac{2 n \pi t}{T} \mathrm{~d} t \quad \text { for } n \text { a positive integer } (23.5)
which reduces to
\begin{aligned} b_n & =\frac{1}{\pi} \int_{-\pi / 2}^{\pi / 2} 4 \sin n t \mathrm{~d} t \\ & =\frac{4}{\pi}\left[\frac{-\cos n t}{n}\right]_{-\pi / 2}^{\pi / 2} \\ & =\frac{4}{n \pi}\left[-\cos \frac{n \pi}{2}+\cos \frac{n \pi}{2}\right] \\ & =0 \end{aligned}that is, all the Fourier coefficients, b_n, are zero. Finally we can gather together all our results and write down the Fourier series representation of f(t):
f(t)=2+\frac{8}{\pi} \cos t-\frac{8}{3 \pi} \cos 3 t+\frac{8}{5 \pi} \cos 5 t-\cdots