Signals and Systems Part 2: Fourier Series

Lesson 10: The Complex Fourier Series


Down with sines and cosines!

Sines and cosines are great, but as we have seen they are a little awkward to work with. Having to keep track of two sets of coefficients \(a_n\) and \(b_n\) is pretty, not to mention dealing separately with the offset, and as we've seen before, sines and cosines, while they work, they aren't the most elegant way to solve the problems we face in engineering when we deal with linear systems. There is a signal more powerful, which is not only easier to deal with mathematically, but makes all of our physical problems much easier too. This signal is the complex exponential, \(e^{j x}\).

How much complex exponential is in my signal?

So far, we have asked and answered the questions:

Now, we are ready to answer a question that might seem bizarre and nonsensical at first - how much \(e^{jx}\) is in my signal? Hold up. How can a signal (let's take the square wave we are so fond of) contain a complex exponential? The square wave is real! Well, it doesn't just contain one complex exponential - it contains a bunch. Remember how we could make an (odd) square wave by adding up a bunch of sine waves? Well, we can also make a sinewave by adding a couple of complex exponentials:

\begin{equation} sin(x) = \frac{1}{2j}\left(e^{jx} - e^{-jx}\right) \end{equation}

So, just as an odd square wave contains a bunch of sinewaves, it also contains a bunch of complex exponentials. But since our square wave is real those complex exponentials come in pairs - if our square wave (or any real signal) contains an \(e^{jx}\) it must also contain an \(e^{-jx}\).

The inner product, revisited

There's one more subtle point regarding the inner product that we need to revisit. Up until this point we have been dealing only with real signals. When we have complex signals, there's a little extra step we have to do when we take the inner product - we need to complex conjugate the second term inside the integral. So if we want the inner product between two complex periodic signals, \(f(x)\) and \(g(x)\), with a period \(P\), the inner product looks like this:

\begin{equation} \langle f(x), g(x) \rangle = \int_{0}^{P}f(x) g^*(x) dx \end{equation}

Where the (*) denotes complex conjugation. Why do we have to do this? Well, imagine we want to ask a simple question - how much \(e^{jx}\) is in \(e^{jx}\)? If we didn't complex conjugate, our integral would look like this:

\begin{equation} \langle e^{jx}, e^{jx} \rangle = \int_{0}^{2\pi}e^{jx} e^{jx} dx = \int_{0}^{2\pi}e^{2jx} dx = 0 \end{equation}

The inner product is zero! That's clearly nonsense, because we expect there to be exactly \(1\) \(e^jx\) in our signal \(e^{jx}\). To remedy this, we complex conjugate the second term. Then, our integral will look like this:

\begin{equation} \langle e^{jx}, e^{jx} \rangle = \int_{0}^{2\pi}e^{jx} e^{-jx} dx = \int_{0}^{2\pi}1 dx = 2\pi \end{equation}

Ah, a nonzero value, phew!

The Complex Fourier Series

To answer the question "how much \(e^{jx}\) is in my signal?" all we need to do is divide the inner product by \(2\pi\), or one full period. This will ensure there is exactly 1 \(e^{jx}\) in \(e^{jx}\), and all is right with the world. For \(2\pi\) periodic signals, we can find how much \(e^{jx}\) is in them by taking the inner product and dividing by the period of \(2\pi\). Let's do an example just to hammer this one home:

How much \(e^{jx}\) is in an odd square wave with a period of \(2\pi\)?





How much \(e^{-jx}\) is in an odd square wave with a period of \(2\pi\)?





Notice that this is half the value we would expect for a sinewave, but the values are imaginary because a sinewave is \(\frac{1}{2j}\left(e^{jx} - e^{-jx}\right)\). This is so important let's do another example, this time with an even square wave:

How much \(e^{jx}\) is in an even square wave with a period of \(2\pi\)?





How much \(e^{-jx}\) is in an even square wave with a period of \(2\pi\)?





For an even square wave, there is half as much \(e^{jx}\) and \(e^{-jx}\) as there is \(cos(x)\), (which remember, had a coefficient of \(4/\pi\)), but each of these are positive and real because \(cos(x) = \frac{1}{2}\left(e^{jx} + e^{-jx}\right) \). Also notice that for both even and odd square waves, there is a nonzero amount of \(e^{jx}\). This is in contrast to the Sine and Cosine series, which could only represent even and odd signals.

The n-th Fourier Coefficient

And, finally, we can ask the question not just for \(e^{jx}\), and \(e^{-jx}\), but any integer multiple of our signal's frequency. We can ask how much \(e^{jnx}\) is in my signal?. The answer is the nth complex Fourier Coefficient \(c_n\) (or just Fourier Coefficient, no one actually uses the Sine/Cosine Fourier series) ;)

\begin{equation} c_n=\frac{1}{P}\langle f(x), e^{jnx} \rangle =\frac{1}{P}\int_{0}^{P}f(x) e^{-jnx} dx \end{equation}

And now we've finally met the \(c_n\) coefficients that I spoke of earlier in the course :). One big happy family of Fourier Coefficients, \(a_n\), \(b_n\), and \(c_n\). Fortunately, engineers are pretty much settled on only using the complex Fourier series.

Reason 1 - We only need one set of Coefficients

We saw above that there are complex exponentials in both even and odd square waves (and indeed all even and odd signals), because the complex exponential is neither even nor odd - its real part is even, but its imaginary part is odd. This lets us represent either even or odd signals, or signals which are neither even nor odd. The coefficients will just change from being real (when representing an even signal) to being imaginary (when representing an odd signal), or complex (when representing a signal neither even nor odd). This is a whole lot more convenient than lugging around two sets of coefficients!

Reason 2 - No more special offset

Remember how we had to divide the offset by 2 when dealing with the cosine series? With complex exponentials, this is no longer the case! \(e^{j0x}\), which is just equal to \(1\), has exactly the same amount of energy has \(e^{jx}\) over a \(2\pi\) interval (check the inner product!), and so the coefficient \(c_0\) directly represents the offset of a signal. This means we need only a single series to represent any periodic signal (although we have to include both positive and negative values of \(n\).

Let's do an example

Let's do an example to give you a feel for what is going on. Let's say we have an even square wave with an offset of 1:

What is the nth Fourier Coefficient \(c_n\) of this signal?





Given the answer above, what is the \(c_0\) coefficient? (hint: take a limit, or approximate \(sin(x)\) as x since x is approaching zero)





But whatever happened to time?

For all of our work on the Fourier series, we have been working with the variable \(x\), but typically, in engineering, we care much more about \(t\), or time. We want to be able to use what we learn on physical problems and signals which exist in the real world, and so we need to be able to deal with functions of time.




If you found this content helpful, it would mean a lot to me if you would support me on Patreon. Help keep this content ad-free, get access to my Discord server, exclusive content, and receive my personal thanks for as little as $2. :)

Become a Patron!