# Trigonometric Fourier Series

While studying heat flow, Fourier discovered that a non-sinusoidal periodic function can be expressed as an infinite sum of sinusoidal functions. Recall that a periodic function is one that repeats every $T$ seconds. In other words, a periodic function $f(t)$ satisfies
$$\bbox[10px,border:1px solid grey]{f(t)=f(t+n T)} \tag{1}$$
where $n$ is an integer and $T$ is the period of the function. According to the Fourier theorem, any practical periodic function of frequency $\omega_{0}$ can be expressed as an infinite sum of sine or cosine functions that are integral multiples of $\omega_{0}$. Thus, $f(t)$ can be expressed as
\begin{aligned}f(t)=& a_{0}+a_{1} \cos \omega_{0} t+b_{1} \sin \omega_{0} t+a_{2} \cos 2 \omega_{0} t \\&+b_{2} \sin 2 \omega_{0} t+a_{3} \cos 3 \omega_{0} t+b_{3} \sin 3 \omega_{0} t+\cdots\end{aligned} \tag{2}
or
$$f(t)=\underbrace{a_{0}}_{\mathrm{dc}}+\underbrace{\sum_{n=1}^{\infty}\left(a_{n} \cos n \omega_{0} t+b_{n} \sin n \omega_{0} t\right)}_{\mathrm{ac}} \tag{3}$$
where $\omega_{0}=2 \pi / T$ is called the fundamental frequency in radians per second. The sinusoid $\sin n \omega_{0} t$ or $\cos n \omega_{0} t$ is called the $n$th harmonic of $f(t)$; it is an odd harmonic if $n$ is odd and an even harmonic if $n$ is even. Equation $3$ is called the trigonometric Fourier series of $f(t)$.
The constants $a_{n}$ and $b_{n}$ are the Fourier coefficients. The coefficient $a_{0}$ is the dc component or the average value of $f(t)$ (Recall that sinusoids have zero average values.) The coefficients $a_{n}$ and $b_{n}$ (for $n \neq 0$ ) are the amplitudes of the sinusoids in the ac component. Thus,
The Fourier series of a periodic function f (t) is a representation that resolves f (t) into a dc component and an ac component comprising an infinite series of harmonic sinusoids.
A function that can be represented by a Fourier series as in Eq. (3) must meet certain requirements, because the infinite series in Eq. (3) may or may not converge. These conditions on $f(t)$ to yield a convergent.
Fourier series are as follows:
• $f(t)$ is single-valued everywhere.
• $f(t)$ has a finite number of finite discontinuities in any one period.
• $f(t)$ has a finite number of maxima and minima in any one period.
• The integral $\int_{t_{0}}^{t_{0}+T}|f(t)| d t<\infty$ for any $t_{0}$.
These conditions are called Dirichlet conditions. Although they are not necessary conditions, they are sufficient conditions for a Fourier series to exist.
A major task in Fourier series is the determination of the Fourier the coefficients $a_{0}, a_{n}$, and $b_{n}$. The process of determining the coefficients is called Fourier analysis. The following trigonometric integrals are very helpful in Fourier analysis. For any integers $m$ and $n$,
$$\begin{array}{c} \int_{0}^{T} \sin n \omega_{0} t d t=0 \quad (4.a) \\ \int_{0}^{T} \cos n \omega_{0} t d t=0 \quad (4.b) \\ \int_{0}^{T} \sin n \omega_{0} t \cos m \omega_{0} t d t=0 \quad (4.c) \\ \int_{0}^{T} \sin n \omega_{0} t \sin m \omega_{0} t d t=0, \quad(m \neq n) \quad (4.d)\\ \int_{0}^{T} \cos n \omega_{0} t \cos m \omega_{0} t d t=0, \quad(m \neq n) \quad (4.e)\\ \int_{0}^{T} \sin ^{2} n \omega_{0} t d t=\frac{T}{2} \quad (4.f)\\ \int_{0}^{T} \cos ^{2} n \omega_{0} t d t=\frac{T}{2} \quad (4.g) \end{array}$$
Let us use these identities to evaluate the Fourier coefficients.
We begin by finding $a_{0}$. We integrate both sides of Eq. (3) over one period and obtain
\begin{aligned}\int_{0}^{T} f(t) d t=& \int_{0}^{T}\left[a_{0}+\sum_{n=1}^{\infty}\left(a_{n} \cos n \omega_{0} t+b_{n} \sin n \omega_{0} t\right)\right] d t \\=\int_{0}^{T} a_{0} d t+\sum_{n=1}^{\infty} & {\left[\int_{0}^{T} a_{n} \cos n \omega_{0} t d t\right.} \\&\left.+\int_{0}^{T} b_{n} \sin n \omega_{0} t d t\right] d t\end{aligned} \tag{5}
Invoking the identities of Eqs. (4.a) and (4.b), the two integrals involving the ac terms vanish. Hence,
$$\int_{0}^{T} f(t) d t=\int_{0}^{T} a_{0} d t=a_{0} T$$
or
$$a_{0}=\frac{1}{T} \int_{0}^{T} f(t) d t \tag{6}$$
showing that $a_{0}$ is the average value of $f(t)$.To evaluate $a_{n}$, we multiply both sides of Eq. (3) by $\cos m \omega_{0} t$ and integrate over one period:
\begin{aligned} & \int_{0}^{T} f(t) \cos m \omega_{0} t d t \\ =& \int_{0}^{T}\left[a_{0}+\sum_{n=1}^{\infty}\left(a_{n} \cos n \omega_{0} t+b_{n} \sin n \omega_{0} t\right)\right] \cos m \omega_{0} t d t \\=& \int_{0}^{T} a_{0} \cos m \omega_{0} t d t+\sum_{n=1}^{\infty}\left[\int_{0}^{T} a_{n} \cos n \omega_{0} t \cos m \omega_{0} t d t\right.\\&\left.+\int_{0}^{T} b_{n} \sin n \omega_{0} t \cos m \omega_{0} t d t\right] d t\end{aligned} \tag{7}
The integral containing $a_{0}$ is zero in view of Eq. (4.b), while the integral containing $b_{n}$ vanishes according to Eq. (4.c). The integral containing $a_{n}$ will be zero except when $m=n$, in which case it is $T / 2$, according to Eqs. (4.e) and (4.g). Thus,
$$\int_{0}^{T} f(t) \cos m \omega_{0} t d t=a_{n} \frac{T}{2}, \quad \text { for } m=n$$
or
$$a_{n}=\frac{2}{T} \int_{0}^{T} f(t) \cos n \omega_{0} t d t \tag{8}$$
In a similar vein, we obtain $b_{n}$ by multiplying both sides of Eq. (3) by $\sin m \omega_{0} t$ and integrating over the period. The result is
$$b_{n}=\frac{2}{T} \int_{0}^{T} f(t) \sin n \omega_{0} t d t \tag{9}$$
Be aware that since $f(t)$ is periodic, it may be more convenient to carry the integrations above from $-T / 2$ to $T / 2$ or generally from $t_{0}$ to $t_{0}+T$ instead of 0 to $T$. The result will be the same.
An alternative form of Eq. (3) is the amplitude-phase form
$$f(t)=a_{0}+\sum_{n=1}^{\infty} A_{n} \cos \left(n \omega_{0} t+\phi_{n}\right) \tag{10}$$
we can apply the trigonometric identity
$$\cos (\alpha+\beta)=\cos \alpha \cos \beta-\sin \alpha \sin \beta \tag{11}$$
to the ac terms in Eq. (10) so that
\begin{aligned}a_{0}+\sum_{n=1}^{\infty} A_{n} \cos \left(n \omega_{0} t+\phi_{n}\right)=& a_{0}+\sum_{n=1}^{\infty}\left(A_{n} \cos \phi_{n}\right) \cos n \omega_{0} t \\&-\left(A_{n} \sin \phi_{n}\right) \sin n \omega_{0} t\end{aligned} \tag{12}
Equating the coefficients of the series expansions in Eqs. (3) and (12) shows that
$$a_{n}=A_{n} \cos \phi_{n}, \quad b_{n}=-A_{n} \sin \phi_{n} \tag{13.a}$$
or
$$A_{n}=\sqrt{a_{n}^{2}+b_{n}^{2}}, \quad \phi_{n}=-\tan ^{-1} \frac{b_{n}}{a_{n}} \tag{13.b}$$
To avoid any confusion in determining $\phi_{n}$, it may be better to relate the terms in complex form as
$$A_{n} \angle \phi_{n}=a_{n}-j b_{n} \tag{14}$$
The plot of the amplitude $A_{n}$ of the harmonics versus $n \omega_{0}$ is called the amplitude spectrum of $f(t)$; the plot of the phase $\phi_{n}$ versus $n \omega_{0}$ is the phase spectrum of $f(t)$. Both the amplitude and phase spectra form the frequency spectrum of $f(t)$.
The frequency spectrum of a signal consists of the plots of the amplitudes and phases of the harmonics versus frequency.
The frequency spectrum is also known as the line spectrum in view of the discrete frequency components.
Thus, the Fourier analysis is also a mathematical tool for finding the spectrum of a periodic signal. To evaluate the Fourier coefficients $a_{0}, a_{n}$, and $b_{n}$, we often need to apply the following integrals:
$$\begin{array}{l}\int \cos a t d t=\frac{1}{a} \sin a t \quad (15.a) \\ \int \sin a t d t=-\frac{1}{a} \cos a t\quad (15.b) \end{array}$$
\begin{aligned}\int t \cos a t d t &=\frac{1}{a^{2}} \cos a t+\frac{1}{a} t \sin a t \quad (15.c)\\ \int t \sin a t d t &=\frac{1}{a^{2}} \sin a t-\frac{1}{a} t \cos a t \quad (15.d) \end{aligned}
It is also useful to know the values of the cosine, sine, and exponential functions for integral multiples of $\pi$. These are given in Table $1$, where $n$ is an integer.
 Table 1: Values of cosine, sine, and exponential functions for integral multiples of π. Function Value $cos 2nπ$ 1 $sin 2nπ$ 0 $cos nπ$ $(-1)^n$ $sin nπ$ 0 $cos {nπ \over 2}$ $\left\{\begin{array}{ll} (-1)^{n/2}, & n= even \\0, & n=odd \end{array}\right.$ $sin {nπ \over 2}$ $\left\{\begin{array}{ll} (-1)^{(n-1)/2}, & n= odd \\0, & n=even \end{array}\right.$ $e^{j2n\pi}$ 1 $e^{jn\pi}$ $(-1)^n$ $e^{jn\pi /2}$ $\left\{\begin{array}{ll} (-1)^{n/2}, & n= even \\j(-1)^{(n-1)/2}, & n=odd \end{array}\right.$
Example 1: Determine the Fourier series of the waveform shown in Fig. 1. Obtain the amplitude and phase spectra.
Fig. 1: For Example 1; a square wave.
Solution: The Fourier series is given by Eq. (3), namely,
$$f(t)=a_{0}+\sum_{n=1}^{\infty}\left(a_{n} \cos n \omega_{0} t+b_{n} \sin n \omega_{0} t\right) \tag{1.1}$$
Our goal is to obtain the Fourier coefficients $a_{0}, a_{n}$, and $b_{n}$ using Eqs. (6), (8), and (9). First, we describe the waveform as
$$f(t)=\left\{\begin{array}{ll}1, & 0 < t < 1 \\0, & 1< t < 2\end{array}\right. \tag{1.2}$$
and $f(t)=f(t+T)$. Since $T=2, \omega_{0}=2 \pi / T=\pi$. Thus,
$$a_{0}=\frac{1}{T} \int_{0}^{T} f(t) d t=\frac{1}{2}\left[\int_{0}^{1} 1 d t+\int_{1}^{2} 0 d t\right]=\left.\frac{1}{2} t\right|_{0} ^{1}=\frac{1}{2} \tag{1.3}$$
Using Eq. (8) along with Eq. (15a),
\begin{aligned}a_{n} &=\frac{2}{T} \int_{0}^{T} f(t) \cos n \omega_{0} t d t \\&=\frac{2}{2}\left[\int_{0}^{1} 1 \cos n \pi t d t+\int_{1}^{2} 0 \cos n \pi t d t\right] \\&=\left.\frac{1}{n \pi} \sin n \pi t\right|_{0} ^{1}=\frac{1}{n \pi} \sin n \pi=0\end{aligned} \tag{1.4}
From Eq. (9) with the aid of Eq. (15b),
\begin{aligned}b_{n} &=\frac{2}{T} \int_{0}^{T} f(t) \sin n \omega_{0} t d t \\&=\frac{2}{2}\left[\int_{0}^{1} 1 \sin n \pi t d t+\int_{1}^{2} 0 \sin n \pi t d t\right] \\&=-\left.\frac{1}{n \pi} \cos n \pi t\right|_{0} ^{1} \\&=-\frac{1}{n \pi}(\cos n \pi-1), \quad \cos n \pi=(-1)^{n} \\&=\frac{1}{n \pi}\left[1-(-1)^{n}\right]=\left\{\begin{array}{ll}\frac{2}{n \pi}, & n=\text { odd } \\0, & n=\text { even }\end{array}\right.\end{aligned} \tag{1.5}
Substituting the Fourier coefficients in Eqs. (1.3) to (1.5) into Eq. (1.1) gives the Fourier series as
$$f(t)=\frac{1}{2}+\frac{2}{\pi} \sin \pi t+\frac{2}{3 \pi} \sin 3 \pi t+\frac{2}{5 \pi} \sin 5 \pi t+\cdots \tag{1.6}$$
Since $f(t)$ contains only the dc component and the sine terms with the fundamental component and odd harmonics, it may be written as
$$f(t)=\frac{1}{2}+\frac{2}{\pi} \sum_{k=1}^{\infty} \frac{1}{n} \sin n \pi t, \quad n=2 k-1 \tag{1.7}$$
Fig. 2: Evolution of a square wave from its Fourier components.
By summing the terms one by one as demonstrated in Fig. 2, we notice how superposition of the terms can evolve into the original square. As more and more Fourier components are added, the sum gets closer and closer to the square wave. However, it is not possible in practice to sum the series in Eq. (1.6) or (1.7) to infinity. Only a partial sum $(n=1,2,3, \ldots, N$, where $N$ is finite) is possible.
Fig. 3: Truncating the Fourier series at N = 11; Gibbs phenomenon.
If we plot the partial sum (or truncated series) over one period for a large $N$ as in Fig. 3, we notice that the partial sum oscillates above and below the actual value of $f(t)$. At the neighborhood of the points of discontinuity $(x=0,1,2, \ldots)$, there is overshoot and damped oscillation. In fact, an overshoot of about 9 percent of the peak value is always present, regardless of the number of terms used to approximate $f(t)$. This is called the Gibbs phenomenon.
Finally, let us obtain the amplitude and phase spectra for the signal in Fig. 16.1. Since $a_{n}=0$
$$A_{n}=\sqrt{a_{n}^{2}+b_{n}^{2}}=\left|b_{n}\right|=\left\{\begin{array}{ll}\frac{2}{n \pi}, & n=\text { odd } \\0, & n=\text { even }\end{array}\right.$$
and
$$\phi_{n}=-\tan ^{-1} \frac{b_{n}}{a_{n}}=\left\{\begin{array}{cl}-90^{\circ}, & n=\text { odd } \\0, & n=\text { even }\end{array}\right.$$
Fig. 4: For Example 1: (a) amplitude and (b) phase spectrum of the function shown in Fig. 1
The plots of $A_{n}$ and $\phi_{n}$ for different values of $n \omega_{0}=n \pi$ provide the amplitude and phase spectra in Fig. 4. Notice that the amplitudes of the harmonics decay very fast with frequency.