- There was only the answer, so I add its question at the top and some links at the bottom. --Jaemin 14:50, 28 September 2010 (UTC).

# Exercise: Compute the Fourier series coefficients of the following periodic signal:

$ \;\;\;x(t)=|\text{sin}(\pi t)|, \;\; \text{with the period }T=1 $

- Note: It is not necessary to state the period in the question, as one can figure it out from the signal itself. --Mboutin 08:15, 29 September 2010 (UTC)

## Answer

- Note: Before beginning to answer the question, you should ask yourself whether this is a signal that can be directly expressed in terms of complex exponentials. In this case (because of the absolute value), it is not easy to do so directly. --Mboutin 08:15, 29 September 2010 (UTC)

$ a_n = \frac{1}{T}\int_{0}^{T}x(t)e^{-j\frac{2\pi}{T}n t} dt = \int_{0}^{1}x(t)e^{-j2\pi n t} $

Substitute $ a=\pi, \;\; b=-j2\pi n $ :: This change of varible is confusing. At the very least, I would not use the variable a, as it is easily confused with the coefficients of the series. --Mboutin 08:15, 29 September 2010 (UTC)

$ \begin{align} a_n &= \int_{0}^{1}\text{sin}(at)e^{bt}dt = \left[\frac{1}{b}\text{sin}(at)e^{bt}\right]^{1}_{0} - \int_{0}^{1}\frac{a\text{cos}(at)}{b}e^{bt}dt \\ &= \left(\frac{e^b}{b}\text{sin}(a)\right) - \frac{a}{b}\left(\left[\frac{\text{cos}(at)}{b}e^{bt}\right]^{1}_{0} - \int_{0}^{1}\frac{-a\text{sin}(at)}{b}e^{bt}dt\right) \\ &= \left(\frac{e^b}{b}\text{sin}(a)\right) - \frac{a}{b} \left( \left( \frac{\text{cos}(a)}{b}e^{b}-\frac{1}{b}\right) + \frac{a}{b}\int_{0}^{1}\text{sin}(at)e^{bt}dt \right) \\ &= \frac{e^b}{a}\text{sin}(a)-\frac{a\text{cos}(a)}{b^2}e^b + \frac{a}{b^2} - \frac{a^2}{b^2}\int_{0}^{1}\text{sin}(at)e^{bt}dt \\ \end{align} $

As you can see $ \int_{0}^{1}\text{sin}(at)e^{bt}dt $ term repeats, therefore it needs to be subtracted to both sides.

Then, *a*_{n} can be calculated.

$ \frac{e^{-j2\pi n}}{-j2\pi n}\text{sin}\pi + \frac{\pi \text{cos}\pi}{4 \pi^2 n^2}e^{-j2\pi n} - \frac{\pi}{4 \pi^2 n^2} = \left(1-\frac{\pi^2}{4\pi^2 n^2}\right) \int_{0}^{1}\text{sin}(\pi t) e^{-j2\pi n t}dt = \left(1-\frac{\pi^2}{4\pi^2 n^2}\right) a_n $

From this equation, $ \frac{e^{-j2\pi n t}}{-j2\pi n}\text{sin}\pi=0 $ because of sinπ, and $ \frac{\pi \text{cos}\pi}{4 \pi^2 n^2}e^{-j2\pi n} = \frac{-\pi}{4\pi^2 n^2} $

There are two terms of $ -\frac{\pi}{4\pi^2 n^2} $.

$ a_n=\frac{-\frac{2\pi}{4\pi^2 n^2}}{1-\frac{\pi^2}{4\pi^2 n^2}} = -\frac{2\pi}{4\pi^2 n^2 - \pi^2} = \frac{2}{\pi(1-4n^2)} $

- Note 1: You answered the question by integration by parts. It works, but there is an easier way: express sin as a linear combination of exponential (using Euler's formula), and then the integral becomes trivial. --Mboutin 08:15, 29 September 2010 (UTC)
- Note 2: Be careful when computing $ a_0 $: you must not divide by zero! (In the computations above, you divided by b). In general, I recommend computing $ a_0 $ separately. --Mboutin 08:15, 29 September 2010 (UTC)

Supplement from Note 2 of Prof. Boutin --Jaemin 15:44, 29 September 2010 (UTC)

$ a_0 = \left[ \frac{1}{T}\int_{0}^{T} |\text{sin}(\pi t)| e^{-j\frac{2\pi}{T}nt} dt \right]_{n=0} = \int_{0}^{1} \text{sin}(\pi t) dt = \left[ -\frac{\text{cos}(\pi t)}{\pi} \right]^{1}_{0} = \frac{2}{\pi} $

Even though they are the same eventually, it is really important to derive $ a_0 $ separately, when dividing by zero.

Supplement from Note 1 of Prof. Boutin --Jaemin 16:20, 29 September 2010 (UTC)

Using Euler's formula,

$ \text{sin}(\pi t) = \frac{1}{2j}\left[e^{j\pi t} - e^{-j\pi t}\right] $

And using above to calculate the Fourier series coefficient, (since $ \text{sin}(\pi t) \geq 0 $ for the integration interval)

$ \begin{align} a_n & = \frac{1}{T}\int_{0}^{T} |\text{sin}(\pi t)| e^{-j\frac{2\pi}{T}nt} dt = \frac{1}{2j} \int_{0}^{1} \left( e^{j\pi t} - e^{-j\pi t} \right) e^{-j2\pi nt} dt \\ & = \frac{1}{2j} \left( \int_{0}^{1} e^{-j(2\pi n - \pi)t} dt - \int_{0}^{1} e^{-j(2\pi n + \pi)t} dt \right) \\ & = \frac{1}{2j} \left( \left[ \frac{e^{-j(2\pi n - \pi)t}}{-j\pi(2n-1)} \right]^{1}_{0} - \left[ \frac{e^{-j(2\pi n + \pi)t}}{-j\pi(2n+1)} \right]^{1}_{0} \right) = \frac{1}{2j} \left( \frac{e^{-j2\pi n}e^{j\pi} - 1}{-j\pi(2n-1)} - \frac{e^{-j2\pi n}e^{-j\pi} - 1}{-j\pi(2n+1)} \right) \\ & = \frac{1}{2j} \left( \frac{-2}{-j\pi(2n-1)} - \frac{-2}{-j\pi(2n+1)} \right) = -\frac{1}{j} \left( \frac{(2n+1)-(2n-1)}{-j\pi(4n^2-1)} \right) = \frac{2}{\pi(1-4n^2)} \\ \end{align} $

Note that $ e^{-j2\pi n}=1 $ for any value of integer n.

In this way, you do not have to calculate separately for $ a_0 $.