Main content

## Electrical engineering

### Course: Electrical engineering > Unit 6

Lesson 1: Fourier series- Fourier Series introduction
- Integral of sin(mt) and cos(mt)
- Integral of sine times cosine
- Integral of product of sines
- Integral of product of cosines
- First term in a Fourier series
- Fourier coefficients for cosine terms
- Fourier coefficients for sine terms
- Finding Fourier coefficients for square wave
- Visualizing the Fourier expansion of a square wave

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Fourier coefficients for cosine terms

Fourier coefficients for cosine terms. Created by Sal Khan.

## Want to join the conversation?

- The cos(nt) seems a bit meaningless to me since this is an infinite sum. How can this be justified?(7 votes)
- I assume your question is to the reason why its "n" in cos(nt), as n isn't actually any number. If that is the case, then here is how you interpret it. n is any arbitrary integer, and we are trying to solve for the values of the sequence of a sub n in terms of n. Multiplying by cos(nt) means we are solving it as the general case. There are cosines with larger integers than n in the series, since as you pointed out, it is an infinite sum. That isn't the point, the point is that we have a formula for what the values in the sequence a sub n are, for all n, and we get this by multiplying by cos(nt) and then integrating over the period, where cos(nt) is the respective cosine for that particular term. I hope this helps.(7 votes)

- At3:44, we assumed that n is not equal to 1. So we cannot calculate the coeff. a1 with the formula that we found..(2 votes)
- The best way to think about this in my opinion is this:

n actually COULD equal 1. It could equal 2, it could equal 3, it could equal ANY integer. What matters here is at some point between zero and infinity we are going to end up in a situation where n=n, or, in other words, at some point between 0 and infinity the number paired with t equals the n that will cause the integral to be of cos^2(nt) and this will always happen but only once. Therefore the answer will always be pi. Sal just basically said "assume n does not equal 1 or 2 in this one case just so I can show you the general concepts/patterns."(3 votes)

- At3:07we establish that cos(nt) has a non-zero n. Why can we safely assume this?(1 vote)
- There is no assumption involved, rather this is a mathematical fact. The integral over the period of cosine(nt) = 0, if n is not 0.

As you move through the rest of the Fourier series videos this situation comes up. You come across integrals of cos(nt) when you know n is not 0, and this fact is applied. If n = 0 then this result does not apply, and you don't use it.(3 votes)

- I believe that this is official explanation, but I see contradiction anyway. If Sal is assuming that yellow n's are not equal to blue n's, how can he generalize that in the final term they are? We are talking about two different integers, which just happens to be named the same.(1 vote)
- Actually I just realized that all of this makes sense if we work with the final term right away. Because goal of this video was to explain what a/sub/n means. And, if we assume that all n's are equal at the beginning already and work only with the term that contains only them, everything works out fine. Part about the specific terms, assuming that their order numbers aren't equal to n (because they are), just was unnecessary. If I understood everything right.(1 vote)

- Sal was on the verge on mental breakdown while doing all those monotonous stuff xD!!(1 vote)
- Sal loves completeness and excellent calligraphy.(1 vote)

- What does it mean: weighted cosine and sine waves.(1 vote)
- Sal calls the Fourier Series the "weighted" sum of sines and cosines. "Weighted" means the various sine and cosine terms have a different size as determined by each a_n and b_n coefficient. Those terms are referred to as the "weights".

If a_n or b_n is a large number, its cosine or sine term carries more weight in the overall sum (has more effect on what the sum looks like).(1 vote)

- why did we choose to multiply by cos(nt) and not sin(nt) ??(1 vote)
- Look at the main equation for f(t) at the beginning of the video. This is the general formula for Fourier Series, which includes both cosine and sine terms. This video works on the cosine terms. The next video works on the sine terms.

A few videos onward Sal applies the formulas for when f(t) is a square wave.(1 vote)

## Video transcript

- [Voiceover] So we've
been spending some time now thinking about the idea
of a Fourier series, taking a periodic function
and representing it as the sum of weighted cosines and sines, and some of you might say,
well, how is this constant a weighted cosine or sine? Well, you can view a
sub zero as a sub zero times cosine of zero t, and of course cosine of zero t is just 1, so this, it'll just end up being a sub zero, but that could be a weighted
cosine, if you want to view it that way, and in the last video, we started leveraging
some of the integrals, definite integrals of sines and cosines to establish a formula for a sub zero which intuitively ended up
being the average value of our function over, over 1 of its period, or over zero to 2 pi which is the interval
that we are caring about. What I want to do now is
find a general expression for a sub n, where n is not equal to zero. So for n is greater than zero, for n is an integer greater than zero and I'm going to use a very similar, a very similar technique. To figure out a sub zero, I just multiply, I just took the integral of both sides. What I'm going to do now is
I'm going to multiply both sides of this equation by cosine of nt. So let me do that, so on the left-hand side,
I'm going to multiply by cosine of nt, and on the right-hand side, multiplying it by cosine of nt, if I distribute that cosine
of nt, I'm going to multiply every term by cosine nt. So it's going to be cosine of nt, cosine of nt, you might see where this is going, especially 'cause we took
all that trouble to take, to figure out the properties of, of definite integrals. Cosine of nt, cosine of nt, cosine of nt, or the properties of definite integrals of products of cosines and sines. Cosine of nt. And this is going to be
true for all of the terms. There's an infinite number of terms here. That's what that dot,
dot, dot is representing. We're just going to keep
on going on and on and on. And now, let's take the
definite integral of both sides from zero to 2 pi. So the definite integral
from zero to 2 pi, dt, well that's going to
be the integral of this, from zero to 2 pi, and
actually, let me just take that coefficient out of the integral, so zero to 2 pi, dt, so zero to 2 pi, dt, a little bit monotonous but it's worth it, zero to 2 pi, dt, zero to 2 pi, dt, we might as well have fun while we do it, zero to 2 pi, dt, all right. Zero, my hand is hurting, zero to 2 pi, dt, zero to 2 pi, dt, once again, just integration property. I'm taking the integral from zero, the definite integral from zero to 2 pi of both sides, and I'm just
saying, hey, the integral of this infinite sum is
equal to the infinite sum of the different integrals. Now, what is this going to be equal to? Well, we know, we know from before that if I just take the definite integral from
zero to 2 pi of cosine nt, where n is some non-zero integer, this is just going to be zero, so this whole thing is going to be zero. We also know, and we've
established it before, if we take, so I just used this property, we also know if we take
cosine nt times sine of mt for any integers mt over the
interval from zero to 2 pi, that's going to be zero, and we also know, we also know that if we take
the integral of cosine mt, cosine nt, where m does not equal n, where m does not equal n, then that is going to be zero. And so, we know, well, here, we have, we're assuming that, we're assuming here that
n is not equal to 1, the coefficient here, so that
is going to be equal to zero. This is sines and cosines with
the different coefficients, and frankly, if they had
the same coefficient, that's going to be zero. We established that in
the last few videos. This is going to be zero, same argument. This is going to be zero, this is going to be zero. Everything's going to be
zero except for this thing right over here, but what is this thing? This is the definite, what we're taking the integral of, this is the same thing
as cosine-squared of nt, dt, the definite integral
from zero to 2 pi of cosine-squared nt, dt. Well, what is that? Well, we established that for any m, non-zero m, this is
going to be equal to pi. So all our work is paying off. So, this whole integral, this whole integral right
over here is going to evaluate to pi. We did that in another video and so now we can start
solving for a sub n. We know that a sub n times pi, a sub n times pi, times pi is equal to, is equal to this 'cause everything
else ended up being zero which is very nice. It's equal to the definite
integral from zero to 2 pi of f of t, of f of t times cosine nt, cosine of nt, dt. Cosine of nt, dt, and so we
can now solve for a sub n. We just divide both sides by, we just divide both sides by pi, and we get a sub n is equal to, I think we deserve a
little bit of a drum roll, a sub n is equal to 1 over pi, times all of this business, times the definite
integral from zero to 2 pi, f of t, f of t, cosine nt, cosine nt, dt. Dt. So if you want to find the
nth coefficient for one of our cosines, a sub n, well, you take your
function, multiply it times cosine of nt, and then
take that definite integral from zero to 2 pi, and then divide by pi, so pretty intuitive, and what's cool is that the math kind of works out this way, that you can actually do this, so hopefully you enjoyed
that as much as I did.