Title: Default for 23.2 Representing Periodic Functions by Fourier Series
Course: HELM Workbooks 2023-2024

Introduction

In this Section we show how a periodic function can be expressed as a series of sines and cosines. We begin by obtaining some standard integrals involving sinusoids. We then assume that if \(f(t)\) is a periodic function, of period \(2\pi\), then the Fourier series expansion takes the form: \[ f(t) = \dfrac{a_0}{2} + \sum _{n=1}^\infty \left( a_n \cos nt + b_n \sin nt \right) .\] Our main purpose here is to show how the constants in this expansion, \(a_n\) (for \(n = 0, 1, 2, 3 \dots \) ) and \(b_n\) (for \(n = 1, 2, 3, \dots\) ), may be determined for any given function \(f(t)\).

Introduction

We recall first a simple trigonometric identity: \[ \cos 2t = -1 + 2\cos^2 t \hspace{1cm} \text{or equivalently} \hspace{1cm} \cos^2 t = \dfrac{1}{2} + \dfrac{1}{2} \cos 2t \hspace{2cm} (1) \] Equation 1 can be interpreted as a simple finite Fourier series representation of the periodic function \(f(t) = \cos^2 t\) which has period \(\pi\). We note that the Fourier series representation contains a constant term and a period \(\pi\) term.

A more complicated trigonometric identity is \[ \sin^4 t = \dfrac{3}{8} - \dfrac{1}{2}\cos 2t + \dfrac{1}{8} \cos 4t \hspace{3cm} (2)\] which again can be considered as a finite Fourier series representation. (Do not worry if you are unfamiliar with the result (2).) Note that the function \(f(t) = \sin^4 t\) (which has period \(\pi\)) is being written in terms of a constant function, a function of period \(\pi\) or frequency \(\dfrac{1}{\pi}\) (the "first harmonic") and a function of period \(\dfrac{\pi}{2}\) or frequency \( \dfrac{2}{\pi}\) (the "second harmonic").

The reason for the constant term in both \((1)\) and \((2)\) is that each of the functions \(\cos^2 t\) and \(\sin^4 t\) is non-negative and hence each must have a positive average value. Any sinusoid of the form \(\cos nt\) or \(\sin nt\) has, by symmetry, zero average value. Therefore, so would a Fourier series containing only such terms. A constant term can therefore be expected to arise in the Fourier series of a function which has a non-zero average value.

Functions of period \(2\pi\)

We now discuss how to represent periodic non-sinusoidal functions \(f(t)\) of period \(2\pi\) in terms of sinusoids, i.e. how to obtain Fourier series representations. As already discussed we expect such Fourier series to contain harmonics of frequency \( \dfrac{n}{2\pi}\) (\(n = 1, 2, 3, \dots \) ) and, if the periodic function has a non-zero average value, a constant term.

Thus we seek a Fourier series representation of the general form \[ f(t) = \dfrac{a0}{2} + a_1 \cos t + a_2 \cos 2t + \dots + b_1 \sin t + b_2 \sin 2t + \dots \] The reason for labelling the constant term as \( \dfrac{a0}{2}\) will be discussed later. The amplitudes \(a_1, a_2, \dots , b_1, b_2, \dots \) of the sinusoids are called Fourier coefficients

Obtaining the Fourier coefficients for a given periodic function \(f(t)\) is our main task and is referred to as Fourier Analysis. Before embarking on such an analysis it is instructive to establish, at least qualitatively, the plausibility of approximating a function by a few terms of its Fourier series.

Example

Consider the square wave of period \(2\pi\) one period of which is shown in the Figure below.

[Image: square-pulse]

1. Write down the analytic description of this function,
2. State whether you expect the Fourier series of this function to contain a constant term,
3. List any other possible features of the Fourier series that you might expect from the graph of the square-wave function.

Solution

1. We have \[ \begin{equation} f(t) = \begin{cases} 4 \hspace{1cm} -\dfrac{\pi}{2} < t < \dfrac{\pi}{2} \\ 0  \hspace{1cm} -\pi < t < -\dfrac{\pi}{2}, \dfrac{\pi}{2} < t < \pi \end{cases} \end{equation} \] \[f(t + 2\pi) = f(t)\]
2. The Fourier series will contain a constant term since the square wave here is non-negative and cannot therefore have a zero average value. This constant term is often referred to as the d.c. (direct current) term by engineers.
3. Since the square wave is an even function (i.e. the graph has symmetry about the \(y\) axis) then its Fourier series will contain cosine terms but not sine terms because only the cosines are even functions. (Well done if you spotted this at this early stage!)

It is possible to show, and we will do so later, that the Fourier series representation of this square wave is \[ 2 + \dfrac{8}{\pi} \left\{ \cos t - \dfrac{1}{3}\cos 3t + \dfrac{1}{5}\cos 5t - \dfrac{1}{7}\cos 7t + \dots \right\} \] i.e the Fourier coefficients are \[ \dfrac{a_0}{2} = 2, \hspace{0.5cm} a_1 = \dfrac{8}{\pi}, \hspace{0.5cm} a_2 = 0, \hspace{0.5cm} a_3 = -\dfrac{8}{3\pi}, \hspace{0.5cm} a_4 = 0, \hspace{0.5cm} a_5 = \dfrac{8}{5\pi}, \dots \] Note, as well as the presence of the constant term and of the cosine (but not sine) terms, that only odd harmonics are present i.e. sinusoids of period \(2\pi\), \( \dfrac{2\pi}{3}\), \( \dfrac{2\pi}{5}\), \( \dfrac{2\pi}{7}\), \(\dots\), or of frequency \(1,3,5,7, \dots\), times the fundamental frequency \(\dfrac{1}{2\pi}\). We now show in the Figure below graphs of

\( (i)\) the square wave

\( (ii)\)  the first two terms of the Fourier series representing the square wave

\( (iii)\) the first three terms of the Fourier series representing the square wave

\( (iv)\) the first four terms of the Fourier series representing the square wave

\( (v)\)  the first five terms of the Fourier series representing the square wave

Note: We show the graphs for \(0 < t < \pi\) only since the square wave and its Fourier series are even.

[Image: square-wave-formation]

We can clearly see from the Figure above that as the number of terms is increased the graph of the Fourier series gradually approaches that of the original square wave - the ripples increase in number but decrease in amplitude. (The behaviour near the discontinuity, at \(t = \dfrac{\pi}{2}\), is slightly more complicated and it is possible to show that however many terms are taken in the Fourier series, some "overshoot" will always occur. This effect, which we do not discuss further, is known as the Gibbs Phenomenon.)

Exercise

Find the following integrals.
1. \( \displaystyle{\int_{-\pi}^\pi }\sin nt \hspace{0.15cm}dt = \)
2. \( \displaystyle{\int_{-\pi}^\pi } \cos nt \hspace{0.15cm} dt = \)
where \(n\) is an integer.
Feedback: In fact both integrals are zero for \[ \displaystyle{\int_{-\pi}^\pi }\sin nt \hspace{0.15cm}dt = \left[ -\dfrac{1}{n}\cos nt \right]_{-\pi}^\pi = \dfrac{1}{n}(-\cos n\pi + \cos n\pi ) = 0, \hspace{0.5cm} n \neq 0\] \[ \displaystyle{\int_{-\pi}^\pi }\cos nt \hspace{0.15cm}dt = \left[ \dfrac{1}{n}\sin nt \right]_{-\pi}^\pi = 0, \hspace{0.5cm} n \neq 0\] As special cases, if \(n = 0\) the first integral is zero and the second integral has value \(2\pi\).

The results of the integrals in the previous exercise are \[ \displaystyle{ \int _{-\pi}^\pi }\sin nt \hspace{0.15cm} dt = 0 \] and \[ \displaystyle{ \int _{-\pi}^\pi }\cos nt \hspace{0.15cm} dt = 0 \] where \(n\) is an integer.

Note that any integration range \(\alpha\), \(\alpha + 2\pi\), would give these same (zero) answers.

These integrals enable enable us to calculate the constant term in the Fourier series given previously as \[ f(t) = \dfrac{a_0}{2} + \sum _{n=1}^{\infty} \left( a_n \cos nt + b_n \sin nt \right)\] Integrating both sides of the Fourier series from \( -\pi\) to \(\pi\) gives the left hand side as \[ \displaystyle{ \int _{-\pi}^\pi } f(t) \hspace{0.15cm} dt \] (whose value clearly depends on the function \(f(t)\)). Integrating the right-hand side term by term we get \[ \dfrac{1}{2} \displaystyle{ \int _{-\pi}^\pi } a_0 \hspace{0.15cm} dt + \sum _{n=1}^\infty \left\{ \int _{-\pi}^\pi a_n \cos nt \hspace{0.15cm} dt + \int _{-\pi}^\pi b_n \sin nt \hspace{0.15cm} dt \right\} = \dfrac{1}{2} \Big[ a_0 t \Big] _{-\pi}^\pi + \sum_{n=1}^\infty \left\{ 0 + 0 \right\} \] Thus we get \[ \displaystyle{ \int _{-\pi}^\pi } f(t) \hspace{0.15cm} dt = \dfrac{1}{2} (2 a_0 \pi ) \] or \[ a_0 = \dfrac{1}{\pi}\displaystyle{ \int _{-\pi}^\pi } f(t) \hspace{0.15cm} dt \]

Key Point

The constant term in a trigonometric Fourier series for a function of period \(2\pi\) is \[ \dfrac{a_0}{2} = \dfrac{1}{2\pi} \displaystyle{ \int _{-\pi}^\pi } f(t) \hspace{0.15cm} dt \] which is the average value of \(f(t)\) over 1 period.

This result ties in with our earlier discussion on the significance of the constant term. Clearly a signal whose average value is zero will have no constant term in its Fourier series. The following square wave shown in the Figure below is an example.

[Image: square-pulse]

We now obtain further integrals, known as orthogonality properties, which enable us to find the remaining Fourier coefficients i.e. the amplitudes \(a_n\) and \(b_n\) \( (n = 1, 2, 3, \dots ) \) of the sinusoids.

Exercise

Using the standard trigonometric identity that \[ \sin nt \cos mt \equiv \dfrac{1}{2} \left\{ \sin (n + m)t + \sin (n - m)t \right\} \] evaluate the following integral:

\( \displaystyle{ \int _{-\pi} ^\pi } \sin nt \cos mt \hspace{0.15cm} dt =\)

where \(m\) and \(n\) are integers.
Feedback: We get \[ \displaystyle{\int_{-\pi}^\pi } \sin nt \cos mt \hspace{0.15cm} dt = \dfrac{1}{2} \left\{ \displaystyle{\int_{-\pi}^\pi } \sin (n + m)t \hspace{0.15cm} dt + \displaystyle{\int_{-\pi}^\pi } \sin (n - m)t \hspace{0.15cm} dt \right\} = \dfrac{1}{2} \left\{0 + 0\right\} = 0 \] since \( n + m\) and \(n - m\) are also integers. This result holds for any interval of \(2\pi\).

Key Point

Orthogonality Relation

For any integers \(m\), \(n\), including the case \(m = n\), \[ \displaystyle{ \int _{-\pi}^\pi } \sin nt \cos mt \hspace{0.15cm} dt = 0 \]

We shall use this result shortly but need a few more integrals first.

Consider next \[ \displaystyle{ \int _{-\pi}^\pi} \cos nt \cos mt \hspace{0.15cm} dt \] where \(m\) and \(n\) are integers.

Using another trigonometric identity we have, for the case \( n \neq m \), \[ \begin{align} \displaystyle{ \int _{-\pi}^\pi} \cos nt \cos mt \hspace{0.15cm} dt &= \dfrac{1}{2} \displaystyle{ \int _{-\pi}^\pi} \left\{ \cos(n+m)t + \cos(n - m)t \right\}dt \\ &= \dfrac{1}{2} \left\{ 0 + 0 \right\} = 0 \end{align} \] For the case \(n = m\) we must get a non-zero answer since \(\cos^2 nt\) is non-negative. In this case: \[ \begin{align} \displaystyle{ \int _{-\pi}^\pi} \cos^2 nt \hspace{0.15cm} dt &= \dfrac{1}{2} \displaystyle{ \int _{-\pi}^\pi} ( 1 + \cos 2nt ) dt \\ &= \dfrac{1}{2} \Big[ t + \dfrac{1}{2n} \sin 2nt \Big]_{-\pi}^\pi = \pi \hspace{1cm} \text{provided n} \neq 0 \end{align} \] For the case \(n = m = 0\) we have \[\displaystyle{ \int _{-\pi}^\pi} \cos nt \cos mt \hspace{0.15cm} dt = 2\pi\]

Exercise

Proceeding in a similar way to the above, evaluate \[ I = \displaystyle{ \int _{-\pi}^\pi } \sin nt \sin mt \hspace{0.15cm} dt \] for integers \(m\) and \(n\).

1. \( n \neq m \)
\( I = \)
2. \( n = m \neq 0 \)
\( I = \)
3. \( n = m = 0 \)
\( I = \)

We summarise these results in the following Key Point:

Key Point

For any integers \(m\), \(n\), \[ \displaystyle{ \int _{-\pi}^\pi } \sin nt \cos mt \hspace{0.15cm} dt = 0 \]

\[ \displaystyle{ \int _{-\pi}^\pi } \cos nt \cos mt \hspace{0.15cm} dt = \begin{cases} 0 \hspace{1cm} n \neq m \\ \pi \hspace{1cm} n = m \neq 0 \\ 2\pi \hspace{0.8cm} n = m = 0 \end{cases} \]

\[ \displaystyle{ \int _{-\pi}^\pi } \sin nt \sin mt \hspace{0.15cm} dt = \begin{cases} 0 \hspace{1cm} n \neq m, \hspace{0.2cm} n = m = 0 \\ \pi \hspace{1cm} n = m \neq 0 \end{cases} \] All these results hold for any integration range of width \(2\pi\).

Calculation of Fourier coefficients

Consider the Fourier series for a function \(f(t)\) of period \(2\pi\): \[ f(t) = \dfrac{a_0}{2} + \sum_{n = 1}^\infty ( a_n \cos nt + b_n \sin nt). \] To obtain the coefficients \( a_n\) \( (n = 1, 2, 3, \dots ) \), we multiply both sides by \( \cos mt\) where \(m\) is some positive integer and integrate both sides from \( -\pi\) to \( \pi \).

For the left-hand side we obtain \[ \displaystyle{ \int _{-\pi}^\pi }f(t)\cos mt \hspace{0.15cm}dt. \] For the right-hand side we obtain \[ \dfrac{a_0}{2} \displaystyle{ \int _{-\pi}^\pi } \cos mt \hspace{0.15cm}dt + \sum_{n=1}^\infty \left\{ a_n \displaystyle{ \int _{-\pi}^\pi } \cos nt \cos mt \hspace{0.15cm}dt + \displaystyle{ \int _{-\pi}^\pi } \sin nt \cos mt \hspace{0.15cm}dt \right\} \] The first integral is zero.

Using the orthogonality relations all the integrals in the summation give zero except for the case \(n = m\) when \[ \displaystyle{ \int _{-\pi}^\pi } \cos^2 mt \hspace{0.15cm}dt = \pi. \] Hence \[ \displaystyle{ \int _{-\pi}^\pi }f(t)\cos mt \hspace{0.15cm}dt = a_m \pi\] from which the coefficient \(a_m\) can be obtained.

Rewriting \(m\) as \(n\) we get \[ a_n = \dfrac{1}{\pi} \displaystyle{ \int _{-\pi}^\pi }f(t)\cos nt \hspace{0.15cm}dt \hspace{1cm} \text{for } n = 1, 2, 3, \dots \]

Note that this formula works for \(n = 0\) (but we must remember that the constant term is \( \dfrac{a_0}{2}\).)

Thus \(a_n = 2 \times \text{ average value of } f(t) \cos nt\) over one period.

A similar calculation can be performed to find the \(b_n\) coefficients.Instead of multiplying the Fourier series by \( \cos mt\) and integrating as above, we multiply by \(\sin mt\) and integrate. Indeed, we have \[ \displaystyle{ \int _{-\pi}^\pi }f(t)\sin mt \hspace{0.15cm}dt = \dfrac{a_0}{2} \displaystyle{ \int _{-\pi}^\pi } \sin mt \hspace{0.15cm}dt + \sum_{n=1}^\infty \left\{ a_n \displaystyle{ \int _{-\pi}^\pi } \cos nt \sin mt \hspace{0.15cm}dt + \displaystyle{ \int _{-\pi}^\pi } \sin nt \sin mt \hspace{0.15cm}dt \right\} . \] All terms on the right-hand side integrate to zero except for the case \(n = m\) where \[ \displaystyle{ \int _{-\pi}^\pi } b_m \sin^2 mt \hspace{0.15cm}dt = b_m \pi \] Relabelling \(m\) as \(n\) gives \[b_n = \dfrac{1}{\pi} \displaystyle{ \int _{-\pi}^\pi } f(t) \sin nt \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, 3, \dots \] (There is no Fourier coefficient \(b_0\).)

Clearly \(b_n = 2 \times \text{ average value of } f(t)\sin nt\) over one period.

We summarise these results in the following Key Point:

Key Point

A function \(f(t)\) with period \(2\pi\) has a Fourier series

\[ f(t) = \dfrac{a_0}{2} + \sum_{n=1}^\infty (a_n \cos nt + b_n \sin nt) \] The Fourier coefficients are

\[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{-\pi}^\pi } f(t) \cos nt \hspace{0.15cm} dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{1}{\pi} \displaystyle{ \int _{-\pi}^\pi } f(t) \sin nt \hspace{0.15cm} dt \hspace{1cm} n = 1, 2, \dots \end{align} \] In the integrals any convenient integration range extending over an interval of \(2\pi\) may be used.

Examples of Fourier series

We shall obtain the Fourier series of the \half-rectified" square wave shown in the Figure below.

[Image: half rectified square pulse]

We have \[ f(t) = \begin{cases} 1 \hspace{1cm} 0 < t < \pi \\ 0 \hspace{1cm} \pi < t < 2\pi \end{cases} \] \[f(t + 2\pi) = f(t) \] The calculation of the Fourier coefficients is merely a straightforward integration using the results already obtained: \[ a_n = \dfrac{1}{\pi} \displaystyle{ \int_{-\pi}^\pi } f(t) \cos nt \hspace{0.15cm}dt \] in general. Hence, for our square wave \[ a_n = \dfrac{1}{\pi} \displaystyle{ \int_{0}^\pi } (1) \cos nt \hspace{0.15cm}dt = \dfrac{1}{\pi} \left[ \dfrac{\sin nt}{n} \right] _0 ^\pi = 0 \] provided \( n \neq 0\).

But \( a_0 = \dfrac{1}{\pi}\displaystyle{ \int_{0}^\pi } (1) \hspace{0.15cm}dt = 1\), so the constant term is \( \dfrac{a_0}{2} = \dfrac{1}{2} \).

(The square wave takes on values \(1\) and \(0\) over equal length intervals of \(t\) so \( \dfrac{1}{2}\) is clearly the mean value.)

Similarly \[ b_n = \dfrac{1}{\pi} \displaystyle{ \int_{0}^\pi } (1) \sin nt \hspace{0.15cm}dt = \dfrac{1}{\pi} \left[ \dfrac{-\cos nt}{n} \right] _0 ^\pi \] Some care is needed now! \[ b_n = \dfrac{1}{n\pi}(1 - \cos n\pi)\] But \[ \begin{align} \cos n\pi = +1 \hspace{1cm} \text{ for } \hspace{1cm} &n = 2, 4, 6, \dots \\ \therefore b_n = 0 \hspace{1cm} \text{ for } \hspace{1cm} &n = 2, 4, 6, \dots \end{align} \] However \[ \begin{align} \cos n\pi = -1 \hspace{1cm} \text{ for } \hspace{1cm} &n = 1, 3, 5, \dots \\ \therefore b_n = \dfrac{1}{n\pi}(1 - (-1)) = \dfrac{2}{n\pi} \hspace{1cm} \text{ for } \hspace{1cm} &n = 1, 3, 5, \dots \end{align} \] i.e \(b_1 = \dfrac{2}{\pi}\), \(b_3 = \dfrac{2}{3\pi}\), \(b_5 = \dfrac{2}{5\pi}\), \(\dots\)

Hence the required Fourier series is \[ \begin{align} f(t) &= \dfrac{a_0}{2} + \sum _{n = 1} ^\infty (a_n\cos nt + b_n \sin nt ) \hspace{1cm} \text{in general} \\ f(t) &= \dfrac{1}{2} + \dfrac{2}{\pi} \left(\sin t + \dfrac{1}{3}\sin 3t + \dfrac{1}{5}\sin 5t + \dots \right) \hspace{1cm} \text{in this case} \end{align} \] Note that the Fourier series for this particular form of the square wave contains a constant term and odd harmonic sine terms. We already know why the constant term arises (because of the non-zero mean value of the functions) and will explain later why the presence of any odd harmonic sine terms could have been predicted without integration.

The Fourier series we have found can be written in summation notation in various ways:

For odd values of \(n\) we have \[ \dfrac{1}{2} + \dfrac{2}{\pi} \sum _{n=1}^\infty \dfrac{1}{n} \sin nt \] or, since \(n\) is odd, we may rewrite \( n = 2k - 1\), \(k = 1,2 \dots \) and write the Fourier series as \[ \dfrac{1}{2} + \dfrac{2}{\pi} \sum_{k = 1}^\infty \dfrac{1}{2k - 1} \sin (2k -1) t \]

Exercise

Obtain the Fourier series of the square wave one period of which is shown below:

[Image: square pulse]

  Fill in the boxes below. The layout may serve as a hint

\(a_0 = \)

For even values of \(n\)

\(a_n = \)

For \(n = 1, 5, 9, \dots \)

\(a_n = \)

For \(n = 3, 7, 11, \dots \)

\(a_n = \)

Finally, \( b_n =\)
Feedback: We have, since the function is non-zero only for \( -\dfrac{\pi}{2} < t < \dfrac{\pi}{2}\), \[ a_0 = \dfrac{1}{\pi} \displaystyle{ \int _{-\frac{\pi}{2}} ^{\frac{\pi}{2}} } 4 dt = 4\] \[ \therefore \dfrac{a_0}{2} = 2 \] is the constant term as we would expect. Also \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{-\frac{\pi}{2}} ^{\frac{\pi}{2}} } 4 \cos nt \hspace{0.15cm}dt = \left[ \dfrac{\sin nt}{n} \right] _{-\frac{\pi}{2}} ^{\frac{\pi}{2}} \\ &= \dfrac{4}{n\pi} \left\{ \sin \left( \dfrac{n\pi}{2} \right) - \sin \left( - \dfrac{n\pi}{2} \right) \right\} = \dfrac{8}{n\pi} \sin \left( \dfrac{n\pi}{2} \right) \hspace{1cm} n = 1, 2, 3, \dots \end{align} \] It follows from a knowledge of the sine function that \[ a_n = \begin{cases} \hspace{0.5cm}0 \hspace{1.5cm} n = 2, 4, 6, \dots \\ \hspace{0.3cm}\dfrac{8}{n\pi} \hspace{1cm} n = 1, 5, 9, \dots \\ -\dfrac{8}{n\pi} \hspace{1cm} n = 3, 7, 11, \dots \end{cases} \] Also \[ b_n = \dfrac{1}{\pi} \displaystyle{ \int _{-\frac{\pi}{2}} ^{\frac{\pi}{2}} } 4 \sin nt \hspace{0.15cm}dt = \dfrac{4}{\pi} \left[ - \dfrac{\cos nt}{n} \right] _{-\frac{\pi}{2}}^{\frac{\pi}{2}} = - \dfrac{4}{n\pi} \left\{ \cos \left( \dfrac{n\pi}{2} \right) - \cos \left( - \dfrac{n\pi}{2} \right) \right\} = 0 \] Hence the Fourier series would be \[ f(t) = 2 + \dfrac{8}{\pi} \left( \cos t - \dfrac{1}{3}\cos 3t + \dfrac{1}{5} \cos 5t - \dfrac{1}{7} \cos 7t + \dots \right) \]

Clearly, in finding the Fourier series of square waves, the integration is particularly simple because \(f(t)\) takes on piecewise constant values. For other functions, such as saw-tooth waves this will
not be the case. Before we tackle such functions however we shall generalise our formulae for the
Fourier coeffcients \(a_n\), \(b_n\) to the case of a periodic function of arbitrary period, rather than confining
ourselves to period \(2\pi\).

Fourier series for functions of general period

This is a straightforward extension of the period \(2\pi\) case that we have already discussed. Using \(x\) (instead of \(t\)) temporarily as the variable. We have seen that a \(2\pi\) periodic function \(f(x)\) has a Fourier series \[ f(x) = \dfrac{a_0}{2} + \sum _{n = 1}^\infty ( a_n \cos nx + b_n \sin nx) \] with \[ a_n = \dfrac{1}{\pi} \displaystyle{ \int _{-\pi} ^\pi } f(x) \cos nx \hspace{0.15cm} dt \hspace{2cm} n = 0, 1, 2, \dots\] \[ b_n = \dfrac{1}{\pi} \displaystyle{ \int _{-\pi} ^\pi } f(x) \sin nx \hspace{0.15cm} dt \hspace{2cm} n = 1, 2, \dots\] Suppose we now change the variable to \(t\) where \(x = \dfrac{2\pi}{T}t\).

Thus \( x = \pi \) corresponds to \( t = T/2 \) and \( x = - \pi \) corresponds to \( t = -T/2\).

Hence regarded as a function of \(t\), we have a function with period \(T\).

Making the substitution \(x = \dfrac{2\pi}{T}t\), and hence \(dx = \dfrac{2\pi}{T} dt\), in the expressions for \(a_n\) and \(b_n\) we obtain \[ \begin{align} a_n &= \dfrac{2}{T} \int _{-\frac{T}{2}} ^{\frac{T}{2}} f(t) \cos \left( \dfrac{2n\pi t}{T} \right) dt \hspace{2cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{2}{T} \int _{-\frac{T}{2}} ^{\frac{T}{2}} f(t) \sin \left( \dfrac{2n\pi t}{T} \right) dt \hspace{2cm} n = 1, 2, \dots \end{align} \] These integrals give the Fourier coefficients for a function of period \(T\) whose Fourier series is \[ f(t) = \dfrac{a_0}{2} + \sum _{n = 1} ^\infty \left\{ a_n\cos \left( \dfrac{2n\pi t}{T}\right) + b_n \sin\left( \dfrac{2n\pi t}{T}\right) \right\} \] Various other notations are commonly used in this case e.g. it is sometimes convenient to write the period \(T = 2l\). (This is particularly useful when Fourier series arise in the solution of partial differential equations.) Another alternative is to use the angular frequency \(\omega\) and put \(T = 2\pi/\omega\).

Example

Write down the form of the Fourier series and expressions for the coefficients if

1. \(T = 2l\)
2. \(T = \dfrac{2\pi}{\omega}\)

Solution

1. \( f(t) = \dfrac{a_0}{2} + \sum _{n = 1} ^\infty \left\{ a_n\cos \left( \dfrac{n\pi t}{l}\right) + b_n \sin\left( \dfrac{n\pi t}{l}\right) \right\} \)
with
\( a_n = \dfrac{1}{l} \displaystyle{ \int _{-l} ^l } f(t) \cos \left( \dfrac{n\pi t}{l} \right) \hspace{0.15cm} dt \)
and similarly for \(b_n\).
2. \( f(t) = \dfrac{a_0}{2} + \sum _{n = 1} ^\infty \left\{ a_n\cos \left( n\omega t \right) + b_n \sin\left( n\omega t \right) \right\} \)
with
\( a_n = \dfrac{\omega}{\pi} \displaystyle{ \int _{-\frac{\pi}{\omega}} ^{\frac{\pi}{\omega}} } f(t) \cos \left( n\omega t \right) \hspace{0.15cm} dt \)
and similarly for \(b_n\).

You should note that, as usual, any convenient integration range of length \(T\) (or \(2l\) or \( \dfrac{2\pi}{\omega}\) ) can be used in evaluating \(a_n\) and \(b_n\).

Example

Find the Fourier series of the function shown in the Figure below which is a saw-tooth wave with alternate portions removed.

[Image: saw-tooth-pulse]

Solution

Here the period \(T = 2l = 4\) so \(l = 2\). The Fourier series will have the form \[ f(t) = \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos \left( \dfrac{n\pi t}{2} \right) + b_n \sin \left( \dfrac{n\pi t}{2} \right) \right\} \] The coefficients \(a_n\) are given by \[ a_n = \dfrac{1}{2} \int _{-2}^2 f(t) \cos \left( \dfrac{n\pi t}{2} \right) \hspace{0.15cm} dt \] where \[ f(t) = \begin{cases} 0 \hspace{1cm} -2 < t < 0\\ t \hspace{1cm} < t < 2 \end{cases} \] \[f(t+4) = f(t)\] Hence \( a_n = \dfrac{1}{2} = \displaystyle{\int_{0}^2} t \cos \left( \dfrac{n \pi t}{2} \right) \hspace{0.15cm} dt \).

The integration is readily performed using integration by parts: \[ \begin{align} \displaystyle{\int_{0}^2} t \cos \left( \dfrac{n \pi t}{2} \right) \hspace{0.15cm} dt &= \left[ t \dfrac{2}{n\pi}\sin \left( \dfrac{n\pi t}{2} \right) \right]_0^2 - \dfrac{2}{n\pi} \displaystyle{\int_{0}^2} \sin \left( \dfrac{n\pi t}{2} \right) \hspace{0.15cm} dt \\ &= \dfrac{4}{n^2 \pi^2} \left[ \cos \left( \dfrac{n\pi t}{2} \right) \right]_0^2 \hspace{1cm} n \neq 0 \\ &= \dfrac{4}{n^2 \pi^2} (\cos n\pi - 1). \end{align} \] Hence, since \( a_n = \dfrac{1}{2} = \displaystyle{\int_{0}^2} t \cos \left( \dfrac{n \pi t}{2} \right) \hspace{0.15cm} dt \), we have \[ a_n = \begin{cases} 0 \hspace{2.2cm} n = 2, 4, 6, \dots \\ -\dfrac{4}{n^2\pi^2} \hspace{1cm} n = 1, 3, 5, \dots \end{cases} \] The constant term is \( \dfrac{a_0}{2}\) where \( a_0 = \dfrac{1}{2} \displaystyle{\int_{0}^2} t \hspace{0.15cm}dt = 1\).

Similarly, \[ b_n = \dfrac{1}{2} = \displaystyle{\int_{0}^2} t \sin \left( \dfrac{n \pi t}{2} \right) \hspace{0.15cm} dt \] where \[ \displaystyle{\int_{0}^2} t \sin \left( \dfrac{n \pi t}{2} \right) \hspace{0.15cm} dt = \left[- t \dfrac{2}{n\pi}\cos \left( \dfrac{n\pi t}{2} \right) \right]_0^2 + \dfrac{2}{n\pi} \displaystyle{\int_{0}^2} \cos \left( \dfrac{n\pi t}{2} \right) \hspace{0.15cm} dt \] The second integral gives zero. Hence \[ b_n = - \dfrac{2}{n\pi}\cos n\pi = \begin{cases} -\dfrac{2}{n\pi} \hspace{1cm} n = 2, 4, 6, \dots \\ +\dfrac{2}{n\pi} \hspace{1cm} n = 1, 3, 5, \dots \end{cases} \] Hence, using all these results for the Fourier coefficients, the required Fourier series is \[ \begin{align} f(t) = \dfrac{1}{2} &- \dfrac{4}{\pi^2} \left\{ \cos \left( \dfrac{\pi t}{2} \right) + \dfrac{1}{9} \cos \left( \dfrac{3 \pi t}{2} \right) + + \dfrac{1}{25} \cos \left( \dfrac{5 \pi t}{2} \right) + \dots \right\} \\ &+ \dfrac{2}{\pi}\left\{ \sin \left( \dfrac{\pi t}{2} \right) - \dfrac{1}{2} \sin \left( \dfrac{2 \pi t}{2} \right) + \dfrac{1}{3} \sin \left( \dfrac{3 \pi t}{2} \right) + \dots \right\} \end{align} \] Notice that because the Fourier coefficients depend on \( \dfrac{1}{n^2}\) (rather than \( \dfrac{1}{n}\) as was the case for the square wave) the sinusoidal components in the Fourier series have quite rapidly decreasing amplitudes. We would therefore expect to be able to approximate the original saw-tooth function using only a quite small number of terms in the series.

Exercise

Obtain the Fourier series of the function \[ \begin{align} f(t) &= t^2 \hspace{1cm} -1 < t < 1 \\ f(t + 2) &= f(t) \end{align} \]

[Image: task-pulse]

\(f(t) = \) + \(\displaystyle{\sum _{n=1}^\infty }\)
Feedback: Since \(T = 2l = 2\) and since the function has a non-zero average value, the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n\pi t) + b_n \sin (n\pi t) \right\} \] Because the function is non-negative there will be a constant term. Since \(T = 2l = 2\) then \(l = 1\) and we have \[ \begin{align} a_n &= \displaystyle{ \int _{-1}^1 }t^2 \cos (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \displaystyle{ \int _{-1}^1 }t^2 \sin (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \displaystyle{ \int_{-1}^1} t^2 \hspace{0.15cm}dt \). The integral for \(b_n\) is zero for all \(n\) because the integrand is an odd function of \(t\). Since the integrand is even in the integrals for \(a_n\) we can write \[a_n = 2 \displaystyle{ \int _{0}^1 }t^2 \cos (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots\] The constant term will be \( \dfrac{a_0}{2}\) where \(a_0 = 2 \displaystyle{ \int_{0}^1} t^2 \hspace{0.15cm}dt = \dfrac{2}{3} \). For \(n = 1, 2, 3, \dots , \) we must integrate by parts (twice): \[ \begin{align} a_n &= 2 \left\{ \left[ \dfrac{t^2}{n\pi}\sin(n\pi t) \right] _0^1 - \dfrac{2}{n\pi} \displaystyle{\int_0^1}t\sin(n\pi t) \hspace{0.15cm}dt \right\} \\ &= -\dfrac{4}{n\pi} \left\{ \left[ - \dfrac{t}{n\pi}\cos(n\pi t) \right] _0^1 + \dfrac{1}{n\pi} \displaystyle{\int_0^1}\cos(n\pi t) \hspace{0.15cm}dt \right\} \end{align} \] The integral in the second term gives zero so \( a_n = \dfrac{4}{n^2\pi^2} \cos n\pi \). Now writing out the final form of the Fourier series we have \[ \begin{align} f(t) &= \dfrac{1}{3} + \displaystyle{ \sum_{n=1}^\infty} \dfrac{4 \cos n\pi \cos(n\pi t)}{n^2\pi^2} \\ &= \dfrac{1}{3} + \dfrac{4}{\pi^2} \left\{ -\cos(\pi t) + \dfrac{1}{4} \cos(2\pi t) - \dfrac{1}{9} \cos(3\pi t) + \dots \right\} \end{align} \]

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = \begin{cases} 1 \hspace{1cm} 0 < t < \dfrac{\pi}{2} \\ 0 \hspace{1cm} \dfrac{\pi}{2} < t < 2\pi \end{cases} \] \[ f(t + 2\pi) = f(t)\] by filling in the boxes below. You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\). The boxes below take the form \[ \begin{align} f(t) = \dfrac{a_0}{2} &+ a_1 \cos c_1 t + a_2 \cos c_2 t + a_3 \cos c_3 t + a_4 \cos c_4 t + a_5 \cos c_5 t + a_6 \cos c_6 t \\ &+ b_1 \sin c_1 t + b_2 \sin c_2 t + b_3 \sin c_3 t + b_4 \sin c_4 t + b_5 \sin c_5 t + b_6 \sin c_6 t \end{align} \]

\( f(t) =\) + \( \cos ( \) \( t ) \) + \( \cos ( \) \( t ) \) + \( \cos ( \) \( t ) \) + \( \cos ( \) \( t ) \) + \( \cos ( \) \( t ) \) + \( \cos ( \) \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \) \( t ) \)

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = \begin{cases} 1 \hspace{1cm} 0 < t < \dfrac{\pi}{2} \\ 0 \hspace{1cm} \dfrac{\pi}{2} < t < 2\pi \end{cases} \] \[ f(t + 2\pi) = f(t)\] by filling in the boxes below. You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\). When you enter an answer into a box, it will appear in the series below, which takes the form \[ \begin{align} f(t) = \dfrac{a_0}{2} &+ a_1 \cos c_1 t + a_2 \cos c_2 t + a_3 \cos c_3 t + a_4 \cos c_4 t + a_5 \cos c_5 t + a_6 \cos c_6 t \\ &+ b_1 \sin c_1 t + b_2 \sin c_2 t + b_3 \sin c_3 t + b_4 \sin c_4 t + b_5 \sin c_5 t + b_6 \sin c_6 t \end{align} \]

\(\dfrac{a_0}{2} = \) \(a_1 = \)   \(c_1 = \)  \(a_2 = \)  \(c_2 =\)  \( a_3 =\)   \(c_3 = \)  \(a_4 = \)   \(c_4 = \)  \(a_5 = \)   \(c_5 =\)  \(a_6 =\)   \(c_6 =\)  \(b_1 =\)  \(s_1 =\)  \(b_2 =\)    \(s_2 =\)  \( b_3 =\)  \(s_3 =\)  \(b_4 =\)   \(s_4 =\)  \(b_5 =\)   \(s_5 =\)  \(b_6 =\)   \(s_6 =\)

\(f(t) =\) +  \( \cos (  \)  \( t  )\) + \( \cos ( \)  \( t)  \) +  \( \cos ( \) \( t ) \) + \( \cos ( \)  \( t ) \) +  \( \cos ( \)  \( t ) \) + \( \cos ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) +  \( \sin ( \)  \( t ) \)
Feedback: Since \(T = 2\pi\) and since the function has a non-zero average value, the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n t) + b_n \sin (n t) \right\} \] where \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} }f(t) \cos (n t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} } f(t) \sin (n t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{2\pi}} f(t) \hspace{0.15cm}dt = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\frac{\pi}{2} } } dt = \dfrac{1}{2} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\frac{\pi}{2}}} \cos (nt) \hspace{0.15cm} dt = \dfrac{1}{\pi} \left[ \dfrac{1}{n} \sin (nt) \right] _0^{\frac{\pi}{2}} \\ &= \dfrac{1}{n\pi} \sin \left( \dfrac{n\pi}{2} \right) \\ &= \begin{cases} \dfrac{1}{n\pi}(-1)^{n+1} \hspace{1cm} n = 1,3,5,7, \dots \\ 0 \hspace{2cm} n = 2,4,6,8, \dots \end{cases} \end{align} \] Similarly for \(b_n\) we have \[ b_n = \begin{cases} \dfrac{1}{n\pi} \hspace{1cm} n = 1,3,5, \dots\\ \dfrac{2}{n\pi} \hspace{1cm} n = 2, 6, 10, \dots\\ 0 \hspace{1.2cm} n = 4, 8, 12, \dots \end{cases} \] Thus the series is given by \[ \begin{align} f(t) &= \dfrac{1}{4} + \dfrac{1}{\pi} \cos t - \dfrac{1}{3\pi} \cos 3t + \dfrac{1}{5\pi} \cos 5t + \dots \\ &+ \dfrac{1}{\pi} \sin t + \dfrac{2}{2\pi} \sin 2t + \dfrac{1}{3\pi} \sin 3t + \dfrac{1}{5\pi} \sin 5t + \dfrac{2}{6\pi}\sin 6t + \dots \end{align} \]

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = t^2\] \[ f(t + 2) = f(t)\] by filling in the boxes below. You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\). When you enter an answer into a box, it will appear in the series below, which takes the form \[ \begin{align} f(t) = \dfrac{a_0}{2} &+ a_1 \cos c_1 t + a_2 \cos c_2 t + a_3 \cos c_3 t + a_4 \cos c_4 t + a_5 \cos c_5 t + a_6 \cos c_6 t \\ &+ b_1 \sin c_1 t + b_2 \sin c_2 t + b_3 \sin c_3 t + b_4 \sin c_4 t + b_5 \sin c_5 t + b_6 \sin c_6 t \end{align} \]

\(\dfrac{a_0}{2} = \) \(a_1 = \)   \(c_1 = \)  \(a_2 = \)  \(c_2 =\)  \( a_3 =\)   \(c_3 = \)  \(a_4 = \)   \(c_4 = \)  \(a_5 = \)   \(c_5 =\)  \(a_6 =\)   \(c_6 =\)  \(b_1 =\)  \(s_1 =\)  \(b_2 =\)    \(s_2 =\)  \( b_3 =\)  \(s_3 =\)  \(b_4 =\)   \(s_4 =\)  \(b_5 =\)   \(s_5 =\)  \(b_6 =\)   \(s_6 =\)

\(f(t) =\) +  \( \cos (  \)  \( t  )\) + \( \cos ( \)  \( t)  \) +  \( \cos ( \) \( t ) \) + \( \cos ( \)  \( t ) \) +  \( \cos ( \)  \( t ) \) + \( \cos ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) +  \( \sin ( \)  \( t ) \)
Feedback: Since \(T = 2\) the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n\pi t) + b_n \sin (n\pi t) \right\} \] where \[ \begin{align} a_n &= \displaystyle{ \int _{-1}^{1} }f(t) \cos (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \displaystyle{ \int _{-1}^{1} } f(t) \sin (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \displaystyle{ \int_{-1}^{1}} t^2 \hspace{0.15cm}dt = \dfrac{2}{3} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \displaystyle{ \int_{-1}^{1} } t^2 \cos (n\pi t) \hspace{0.15cm} dt \\ &= \left[ \dfrac{t^2}{n\pi} \sin (n\pi t) \right] _{-1}^{1} - \dfrac{2}{n\pi} \displaystyle{ \int_{-1}^{1} } t \sin n\pi t \hspace{0.15cm} dt \\ &= 0 - \dfrac{2}{n\pi} \left\{ \left[ - \dfrac{t}{n\pi} \cos n \pi t \right] _{-1}^1 + \dfrac{1}{n\pi} \displaystyle{ \int_{-1}^{1} } \cos n\pi t \hspace{0.15cm} dt \right\} \\ &= -\dfrac{2}{n\pi} \left\{ -\dfrac{1}{n\pi} \cos n\pi - \dfrac{1}{n\pi} \cos (-n\pi) + \dfrac{1}{n^2\pi^2} \left[ \sin n\pi t \right]_{-1}^1 \right\} \\ &= \dfrac{4}{n^2\pi^2} \cos n\pi \end{align} \] As the function is even, we have \(b_n = 0\). Thus the series is given by \[ \begin{align} f(t) &= \dfrac{1}{3} - \dfrac{4}{\pi^2} \cos \pi t + \dfrac{1}{\pi^2} \cos 2\pi t - \dfrac{4}{9\pi^2} \cos 3\pi t \\ &+ \dfrac{1}{4\pi^2} \cos 4\pi t - \dfrac{4}{25\pi^2} \cos 5\pi t + \dfrac{1}{9\pi^2} \cos 6\pi t + \dots \end{align} \]

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = \begin{cases} 0 \hspace{1cm} -\pi < t < 0\\ t^2 \hspace{1cm} 0 < t < \pi \end{cases} \] \[ f(t + 2\pi) = f(t)\] by filling in the boxes below. You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\). When you enter an answer into a box, it will appear in the series below, which takes the form \[ \begin{align} f(t) = \dfrac{a_0}{2} &+ a_1 \cos c_1 t + a_2 \cos c_2 t + a_3 \cos c_3 t + a_4 \cos c_4 t + a_5 \cos c_5 t + a_6 \cos c_6 t \\ &+ b_1 \sin c_1 t + b_2 \sin c_2 t + b_3 \sin c_3 t + b_4 \sin c_4 t + b_5 \sin c_5 t + b_6 \sin c_6 t \end{align} \]

\(\dfrac{a_0}{2} = \) \(a_1 = \)   \(c_1 = \)  \(a_2 = \)  \(c_2 =\)  \( a_3 =\)   \(c_3 = \)  \(a_4 = \)   \(c_4 = \)  \(a_5 = \)   \(c_5 =\)  \(a_6 =\)   \(c_6 =\)  \(b_1 =\)  \(s_1 =\)  \(b_2 =\)    \(s_2 =\)  \( b_3 =\)  \(s_3 =\)  \(b_4 =\)   \(s_4 =\)  \(b_5 =\)   \(s_5 =\)  \(b_6 =\)   \(s_6 =\)

\(f(t) =\) +  \( \cos (  \)  \( t  )\) + \( \cos ( \)  \( t)  \) +  \( \cos ( \) \( t ) \) + \( \cos ( \)  \( t ) \) +  \( \cos ( \)  \( t ) \) + \( \cos ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \) \( t ) \) + \( \sin ( \)  \( t ) \) + \( \sin ( \)  \( t ) \) +  \( \sin ( \)  \( t ) \)
Feedback: Since \(T = 2\pi\) and since the function has a non-zero average value, the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n t) + b_n \sin (n t) \right\} \] where \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} }f(t) \cos (n t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} } f(t) \sin (n t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\pi}} t^2 \hspace{0.15cm}dt = \dfrac{\pi^2}{3} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\pi} } t^2 \cos (n\pi t) \hspace{0.15cm} dt \\ &=\dfrac{1}{\pi} \left\{ \left[ \dfrac{t^2}{n} \sin (n t) \right] _{0}^{\pi} - \dfrac{2}{n} \displaystyle{ \int_{0}^{\pi} } t \sin n t \hspace{0.15cm} dt \right\}\\ &= - \dfrac{2}{n\pi} \left\{ \left[ - \dfrac{t}{n} \cos n \pi t \right] _{0}^\pi + \dfrac{1}{n} \displaystyle{ \int_{0}^{\pi} } \cos n t \hspace{0.15cm} dt \right\} \\ &= -\dfrac{2}{n\pi} \left\{ -\dfrac{\pi}{n} \cos n\pi + \dfrac{1}{n^2} \left[ \sin n t \right]_{0}^\pi \right\} \\ &= \dfrac{2}{n^2} \cos n\pi \\ &= \begin{cases} -\dfrac{2}{n^2} \hspace{1cm} n = 1,3,5, \dots\\ \dfrac{2}{n^2} \hspace{1cm} n = 2,4,6, \dots \end{cases} \end{align} \] Similarly for \(b_n\) we have \[ b_n = \begin{cases} -\dfrac{\pi}{n} \hspace{1cm} n = 2,4,6, \dots\\ \dfrac{\pi}{n} - \dfrac{4}{n^3\pi} \hspace{1cm} n = 1,3,5, \dots\\ \end{cases} \] Thus the series is given by \[ \begin{align} f(t) &= \dfrac{\pi^2}{6} - 2 \cos t + \dfrac{1}{2} \cos 2t - \dfrac{2}{9} \cos 3t + \dfrac{1}{8} \cos 4t - \dfrac{2}{25\pi} \cos 5t + \dfrac{1}{18} \cos 6t+ \dots \\ &+ \left( \pi - \dfrac{4}{\pi} \right) \sin t - \dfrac{\pi}{2} \sin 2t + \left( \dfrac{\pi}{3} - \dfrac{4}{9\pi} \right) \sin 3t - \dfrac{\pi}{4} \sin 4t + \left( \dfrac{\pi}{5} - \dfrac{4}{25\pi} \right) \sin 5t - \dfrac{\pi}{6}\sin 6t + \dots \end{align} \]

Orthogonality properties of sinusoids

As stated earlier, a periodic function \(f(t)\) with period \(2\pi\) has a Fourier series representation \[ \begin{align} f(t) &= \dfrac{a_0}{2} + a_1 \cos t + a_2 cos 2t + \dots + b_1 \sin t + b_2 \sin 2t + \dots , \\ &= \dfrac{a_0}{2} + \sum _{n=1}^\infty \left( a_n \cos nt + b_n \sin nt \right) \end{align} \] To determine the Fourier coefficients \(a_n\), \(b_n\) and the constant term \( \dfrac{a0}{2} \) use has to be made of certain integrals involving sinusoids, the integrals being over a range \( \alpha \), \( \alpha+2\pi\), where \(\alpha\) is any number. (We will normally choose \( \alpha = -\pi\).)

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = \begin{cases} 1 \hspace{1cm} 0 < t < \dfrac{\pi}{2} \\ 0 \hspace{1cm} \dfrac{\pi}{2} < t < 2\pi \end{cases} \] \[ f(t + 2\pi) = f(t).\] You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\):
Feedback: Since \(T = 2\pi\) and since the function has a non-zero average value, the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n t) + b_n \sin (n t) \right\} \] where \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} }f(t) \cos (n t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} } f(t) \sin (n t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{2\pi}} f(t) \hspace{0.15cm}dt = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\frac{\pi}{2} } } dt = \dfrac{1}{2} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\frac{\pi}{2}}} \cos (nt) \hspace{0.15cm} dt = \dfrac{1}{\pi} \left[ \dfrac{1}{n} \sin (nt) \right] _0^{\frac{\pi}{2}} \\ &= \dfrac{1}{n\pi} \sin \left( \dfrac{n\pi}{2} \right) \\ &= \begin{cases} \dfrac{1}{n\pi}(-1)^{n+1} \hspace{1cm} n = 1,3,5,7, \dots \\ 0 \hspace{2cm} n = 2,4,6,8, \dots \end{cases} \end{align} \] Similarly for \(b_n\) we have \[ b_n = \begin{cases} \dfrac{1}{n\pi} \hspace{1cm} n = 1,3,5, \dots\\ \dfrac{2}{n\pi} \hspace{1cm} n = 2, 6, 10, \dots\\ 0 \hspace{1.2cm} n = 4, 8, 12, \dots \end{cases} \] Thus the series is given by \[ \begin{align} f(t) &= \dfrac{1}{4} + \dfrac{1}{\pi} \cos t - \dfrac{1}{3\pi} \cos 3t + \dfrac{1}{5\pi} \cos 5t + \dots \\ &+ \dfrac{1}{\pi} \sin t + \dfrac{2}{2\pi} \sin 2t + \dfrac{1}{3\pi} \sin 3t + \dfrac{1}{5\pi} \sin 5t + \dfrac{2}{6\pi}\sin 6t + \dots \end{align} \]

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = t^2,\] \[ f(t + 2) = f(t).\] You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 6\):
Feedback: Since \(T = 2\) the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n\pi t) + b_n \sin (n\pi t) \right\} \] where \[ \begin{align} a_n &= \displaystyle{ \int _{-1}^{1} }f(t) \cos (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \displaystyle{ \int _{-1}^{1} } f(t) \sin (n\pi t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \displaystyle{ \int_{-1}^{1}} t^2 \hspace{0.15cm}dt = \dfrac{2}{3} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \displaystyle{ \int_{-1}^{1} } t^2 \cos (n\pi t) \hspace{0.15cm} dt \\ &= \left[ \dfrac{t^2}{n\pi} \sin (n\pi t) \right] _{-1}^{1} - \dfrac{2}{n\pi} \displaystyle{ \int_{-1}^{1} } t \sin n\pi t \hspace{0.15cm} dt \\ &= 0 - \dfrac{2}{n\pi} \left\{ \left[ - \dfrac{t}{n\pi} \cos n \pi t \right] _{-1}^1 + \dfrac{1}{n\pi} \displaystyle{ \int_{-1}^{1} } \cos n\pi t \hspace{0.15cm} dt \right\} \\ &= -\dfrac{2}{n\pi} \left\{ -\dfrac{1}{n\pi} \cos n\pi - \dfrac{1}{n\pi} \cos (-n\pi) + \dfrac{1}{n^2\pi^2} \left[ \sin n\pi t \right]_{-1}^1 \right\} \\ &= \dfrac{4}{n^2\pi^2} \cos n\pi \end{align} \] As the function is even, we have \(b_n = 0\). Thus the series is given by \[ \begin{align} f(t) &= \dfrac{1}{3} - \dfrac{4}{\pi^2} \cos \pi t + \dfrac{1}{\pi^2} \cos 2\pi t - \dfrac{4}{9\pi^2} \cos 3\pi t \\ &+ \dfrac{1}{4\pi^2} \cos 4\pi t - \dfrac{4}{25\pi^2} \cos 5\pi t + \dfrac{1}{9\pi^2} \cos 6\pi t + \dots \end{align} \]

Exercise

Write out the terms of the Fourier series for the periodic signal given by \[ f(t) = \begin{cases} 0 \hspace{1cm} -\pi < t < 0\\ t^2 \hspace{1cm} 0 < t < \pi \end{cases} \] \[ f(t + 2\pi) = f(t).\] You should give the constant term \(\dfrac{a_0}{2}\) and each term corresponding to \( n = 1\) to \( n = 3\):
Feedback: Since \(T = 2\pi\) and since the function has a non-zero average value, the form of the Fourier series is \[ \dfrac{a_0}{2} + \sum_{n=1}^\infty \left\{ a_n \cos (n t) + b_n \sin (n t) \right\} \] where \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} }f(t) \cos (n t) \hspace{0.15cm}dt \hspace{1cm} n = 0, 1, 2, \dots \\ b_n &= \dfrac{1}{\pi} \displaystyle{ \int _{0}^{2\pi} } f(t) \sin (n t) \hspace{0.15cm}dt \hspace{1cm} n = 1, 2, \dots \end{align} \] Because the function is non-negative there will be a constant term. The constant term will be \(\dfrac{a_0}{2}\) where \( a_0 = \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\pi}} t^2 \hspace{0.15cm}dt = \dfrac{\pi^2}{3} \). For \(n = 1, 2, 3, \dots , \) we have \[ \begin{align} a_n &= \dfrac{1}{\pi} \displaystyle{ \int_{0}^{\pi} } t^2 \cos (n\pi t) \hspace{0.15cm} dt \\ &=\dfrac{1}{\pi} \left\{ \left[ \dfrac{t^2}{n} \sin (n t) \right] _{0}^{\pi} - \dfrac{2}{n} \displaystyle{ \int_{0}^{\pi} } t \sin n t \hspace{0.15cm} dt \right\}\\ &= - \dfrac{2}{n\pi} \left\{ \left[ - \dfrac{t}{n} \cos n \pi t \right] _{0}^\pi + \dfrac{1}{n} \displaystyle{ \int_{0}^{\pi} } \cos n t \hspace{0.15cm} dt \right\} \\ &= -\dfrac{2}{n\pi} \left\{ -\dfrac{\pi}{n} \cos n\pi + \dfrac{1}{n^2} \left[ \sin n t \right]_{0}^\pi \right\} \\ &= \dfrac{2}{n^2} \cos n\pi \\ &= \begin{cases} -\dfrac{2}{n^2} \hspace{1cm} n = 1,3,5, \dots\\ \dfrac{2}{n^2} \hspace{1cm} n = 2,4,6, \dots \end{cases} \end{align} \] Similarly for \(b_n\) we have \[ b_n = \begin{cases} -\dfrac{\pi}{n} \hspace{1cm} n = 2,4,6, \dots\\ \dfrac{\pi}{n} - \dfrac{4}{n^3\pi} \hspace{1cm} n = 1,3,5, \dots\\ \end{cases} \] Thus the series is given by \[ \begin{align} f(t) &= \dfrac{\pi^2}{6} - 2 \cos t + \dfrac{1}{2} \cos 2t - \dfrac{2}{9} \cos 3t \dots \\ &+ \left( \pi - \dfrac{4}{\pi} \right) \sin t - \dfrac{\pi}{2} \sin 2t + \left( \dfrac{\pi}{3} - \dfrac{4}{9\pi} \right) \sin 3t + \dots \end{align} \]