Tutorials on Fourier series are presented. In the first part an example is used to show how Fourier coefficients are calculated and in a second part you may use an app to further explore Fourier series of the same function.
\[f(t) = \frac{a_0}{2} + \sum_{n=1}^\infty [a_n \cos \frac{2n\pi t}{T} + b_n \sin \frac{2n\pi t}{T}]\]
where n = 1 , 2 , 3 , ... and T is the period of function f(t). an and bn are called Fourier coefficients and are given by
\[a_0 = \frac{2}{T} \int_0^T f(t) dt\] \[a_n = \frac{2}{T} \int_0^T f(t) \cos\left(\frac{2n\pi t}{T}\right) dt\] \[b_n = \frac{2}{T} \int_0^T f(t) \sin\left(\frac{2n\pi t}{T}\right) dt\]
Example 1
Find the Fourier series of the periodic function f(t) defined by
\[f(t) =
\begin{cases}
1, & \text{for } 0 \leq t < T/2 \\
-1, & \text{for } T/2 \leq t < T
\end{cases}\]
Solution to Example 1
Coefficient a0 is given by
\[a_0 = \frac{2}{T} \int_0^{T/2} (1) \, dt + \frac{2}{T} \int_{T/2}^T (-1) \, dt\]
Coefficients \( a_n \) is given by
\[a_n = \frac{2}{T} \int_0^{T/2} 1 \cdot \cos\left(\frac{2n\pi t}{T}\right) \, dt + \frac{2}{T} \int_{T/2}^T (-1) \cdot \cos\left(\frac{2n\pi t}{T}\right) \, dt\]
and coefficients \( b_n \) is given by
\[b_n = \frac{2}{T} \int_0^{T/2} 1 \cdot \sin\left(\frac{2n\pi t}{T}\right) \, dt + \frac{2}{T} \int_{T/2}^T (-1) \cdot \sin\left(\frac{2n\pi t}{T}\right) \, dt\]
A computation of the above coefficients gives
\[ a_0 = 0 , \; a_n = 0 \text{ and } b_n = \dfrac{2}{n\pi} (1 - \cos (n \pi)) \]
Note that
\[ cos (n \pi) = (-1)^n \]
and that \( b_n = 0 \) whenever \(n \) is even.
The given function f(t) has the following Fourier series
\[f(t) = \sum_{n=1}^\infty \frac{2}{n\pi} (1 - (-1)^n) \sin\left(\frac{2n\pi t}{T}\right)\]
For numerical calculations purposes we cannot include an infinite number of terms in the series above, we therefore define function \( f_N(t) \) with a limited number of terms \( N \) as follows
\[ f_N(t) = \sum_{n=1}^{N} \dfrac{2}{n\pi} (1-(-1)^n) \sin(\dfrac{2 n \pi t}{T}) \]
The app below may be used to explore the Fourier series of f(t) solved in example 1 above including a limited number of terms \( N \) in the series and see how the graph of function \( f_N(t) \) defined above becomes close to the graph of function f(t) as \( N \) increases.
The default values are \( N = 5 \) and \( T = 4 \) and the series have one term which is a sinusoidal function of period T. Incease \( N \) and compare the graph of the function obtained (in blue) to that of \( f(t) \) (in red) defined in example.