Articles

Computing Fourier Series | MIT 18.03SC Differential Equations, Fall 2011


PROFESSOR: Hi, everyone. Welcome back. So today we’d like to tackle
a problem in Fourier series. And specifically, we’re just
going to compute the Fourier series for a simple function. So the function we’re interested
in is f of t, which we’re told is periodic with period 2pi–
f of t is 1 from minus pi to 0, and then it’s minus
1 from 0 to pi. So first off, we’re interested
in sketching f of t. Secondly, we’d like to compute
the Fourier series for f of t. And then thirdly, we’d like to
sketch the first non-zero term of the Fourier series. And we can specifically
sketch this single term on top of f of t. So I’ll let you think
about this problem for now, and I’ll be back in a moment. Hi, everyone. Welcome back. So let’s take a look
at sketching f of t. So for part a, we
have our axes, t. And we’re told f of t
within some interval. So we might as well plot
f of t on that interval. So minus pi, pi and
0, we know that f of t is 1 from minus pi to 0. We’re also told that it’s
minus 1 from 0 to pi. And now to fill in the blanks
or to complete the picture of f, we’re told that it
has a period of 2pi. So note that
they’ve told us what f looks like over
the range of minus pi to pi, which is
the length of 2pi. So basically what we can do
is we can use this as a stamp and just pick up
this entire picture, shift it over one
period 2pi, and just thinking of this picture in
stamping it in multiple places. So just filling
this in it’s going to look like a square wave,
which jumps between minus 1 and 1 at every multiple of pi. So this concludes part a. For part b, which is the
real meat of the problem, we’re interested in computing
a Fourier series for f of t. Now, we can always write
down a Fourier series for any periodic function. And specifically in
this case, for part b, the periodic function we’re
interested in has period 2pi. So for the class
notes, we’ve identified L with half the period. So in this case,
L is 2pi divided by 2, which gives us pi. And just to recall what a
Fourier series is, what we do is we try and take
our function f of t and write it down as a
summation of sines and cosines. So in this case for function
f of t, which is 2pi periodic, it’s going to look
something like this. It’s going to a of 0 plus
sum from n equals 1– and there’s going to be
infinitely many terms, but in this case we have a
of n times cosine of n*t. And it’s n*t here because
we have period 2pi. Plus b_n sine n_t. So this is the general form. And when asked to compute the
Fourier series of a function, the main difficulty is to
compute these coefficients a_n and b_n. However, that
essentially boils down to working out some integrals. So let’s take a look
at what a of 0 is. So the formula for a_0 is 1
over 2L– so in this case, it’s 1 over 2pi–
times the integral over 1 period of the
function, from minus pi to pi, of just f of t. So notice how a_0 is just
the average of the function. So if we take a look at
the function f of t, f of t spends exactly half of its
time at 1 and half of its time at minus 1. So immediately we could
guess that the average value of f of t is going to be 0. If you wanted to work
it out specifically, we would have 1 over 2pi
minus pi to 0, f of t takes on the value of plus 1. And then from 0 to pi, f of t
takes on the value of minus 1. So we would end up getting
pi minus pi, which is 0. For a_n, the formula is
1 over half the period. So note how a of 0 is
just a special case. We always have the full period
in a_0, but in a_n and b_n, the factor that divides the
integral is always going to be half the period times minus pi
to pi, f of t cosine n*t dt. And I should point out
that, in general, we only need to integrate over one
period of the function. So in some sense there’s nothing
special about minus pi and pi. It’s just very often
these are the easiest bounds of integration
to integrate over. But in practice, we
could have used 0 to 2pi or any other interval,
as long as it’s exactly one period of the function. So in this case, I’d
just like to take a look at the symmetry of f of t. And we note that
the function f of t is actually odd
about the origin. So if f of t is odd and cosine
t is an even function, then an odd times an even function
is going to be an odd function. And when you integrate an odd
function from minus any value to the same positive value, so
in this case minus pi to pi, we always get 0. So this is actually
0, because we’re integrating an odd function
over a symmetric interval. So lastly, we have the values
of b_n, which are 1 over pi, minus pi to pi, f
of t of sine n*t dt. And if we were to look at just
the symmetry argument again, f of t is an odd
function, sine t is an odd function, an odd
times an odd function is an even function. When you integrate
an even function over a symmetric bound,
you will essentially get twice the value
of the integral from 0 to one of the bounds. So b of n in this
case doesn’t vanish, which means we actually
have to do some work. So what we do? Well, we know the value of
f of t on two intervals, so we’re just going to have
to work out each interval. Minus pi to 0, it takes
on the value of 1. So we have sine n*t. And then from 0 to pi, f of t
takes on the value of minus 1, sine n*t dt. And you’ll note that these
integrals are actually the same. So this is negative 2 over
pi, zero to pi, sine n*t dt, which if we integrate is
negative 1 over n cosine n*t evaluated between 0 and pi. So if I work this out,
we get minus and a minus, minus 1 over n cosine
n*pi plus 1 over n. So note that cosine
of 0 is just 1. And now if we take a
look at cosine n*pi, we see that cosine n*pi
oscillates between minus 1 and 1. So cosine of pi is negative
1, cosine of 2pi is 1, cosine of 3pi is minus 1. Dot, dot, dot. So this term right here is
actually negative 1 to the n. So we have 2 over n*pi 1
minus negative 1 to the n. And now if we just plug in
some values of b of 1, b of 2, b of 3, b of 4, we can see what
pattern emerges in the b’s. So b of 1, if I plug in 1,
I get 1 minus negative 1. It’s going to be 2. So I get minus 4 over pi. b of 2 is going to be 1 minus
minus 1 squared is just 1. So this vanishes. b of 3 is going to
be 1 minus minus 1 cubed, which is negative 1. So again, we get
negative 4 over 3pi. b of 4 is going to be 0. So it’s sometimes
useful the write out what the Fourier
series looks like. So I’ll just write
it out right here. So we have f of t is going to
be negative 4 over pi times sine of t plus 1/3 sine of 3t
plus 1/5 sine of 5t plus dot, dot, dot. So this concludes part b. And now lastly,
for part c, we’re asked to sketch what does the
first Fourier term look like. So in this case, the
first Fourier term is going to be negative
4 over pi times sine t. So I’m going to go back to
our diagram from part a. So let’s go back to our
diagram from part a. Now what is minus 4 over
pi sine t look like? Well, it’s a sine wave that
has exactly period 2pi, and it’s going to line up
exactly with this square wave. In addition, minus 4 over pi
is just slightly larger than 1. So we’re going to
end up with sin, which peaks just slightly
above 1 and slightly below 1. It’s going to go
through 0, and it’s going to go through
each multiple of pi. So it might look
something like this. So this is the first
Fourier term in the series. And notice how this first
Fourier term is actually pretty good approximation to the
square wave, considering it’s just one term in a series. As we add more
terms in the series, we’re going to get something
which looks closer and closer to a square wave function. So I’d just like
to quickly recap. When computing the Fourier
series for a periodic function, the first useful thing
to do is just write down the formula for
a Fourier series, and then write down the
formulas for the coefficients of the Fourier series. So write down the formulas
for a_0, a_n, b_n. When computing a_0,
you can often just look at the average
of the function. When computing a_n and
b_n, it’s also useful look at the symmetry
of your function. And if it’s either
even or odd symmetric then typically, either all the
a_n’s or all the b_n’s will vanish. And then when you work
out the integrals, you can then reconstruct
the Fourier series. So I would like
to conclude here, and I’ll see you next time.

Leave a Reply

Your email address will not be published. Required fields are marked *