Transcript for:
Understanding Fourier Series and Convergence

in this video we're going to talk more about fourier series and i first introduced the big picture back in my previous video on this topic and the link to that is down in the description the idea was if i start with some function like maybe this discontinuous function the square wave that's one and then minus one i can try and approximate that function with a sum of trigonometric terms the sum of sine terms and cosine terms and as you can see here this was the graph of the first 19 terms in some so-called fourier series it gives a pretty decent approximation even with this crazy discontinuity that happens at the value of pi now in this video i want to answer a couple important questions and the first of them is well how do i compute out what the coefficients in this fourier series is how do i figure out what the a naught the a n and the bn is and then secondly we're gonna answer the question well when does a fourier series actually converge and become a good approximation so we're gonna talk about both of those issues in this video now first up i actually begin with just a kind of random seeming integral the integral of sine of m times t multiplied by sine of n times t and this is just going to be an integral that's going to be very useful to us so how do i evaluate it well it turns out it depends on the values of the m and the m if m is equal to n then this is sine squared of m of t and you can use a little trig identity and i'll let you do it it computes out and adds up to pi if however the m and the n are different if you try to evaluate this using say integration by parts again i'll let you do the grunt work of it it actually is always zero if m and n is different and the way i sort of think about this is that if you imagine sine but with different frequencies the multiplication with different frequencies always exactly cancels out it always multiplies out to something that integrates to zero so this is one of the most important little trig identities that's relevant for fourier series and there's a couple of them because the same is true for cosine multiplication of cosine with different frequencies integrates out to zero and if it's the same frequency it integrates to pi and finally the last one i might want to consider is what if i combine these two coses times signs and this one doesn't matter about the m in the end this one's always zero okay so three different integrals back to our original problem we're going to use these in a moment so where were we we were trying to make the claim that we had a four east expansion that our f of t was going to be in some sense equal to this fourier series how do i find out what the a naught the a n and the b n are well the first thing i'm going to do is i'm going to multiply both sides of this equation by sine of mt and then i'm going to integrate from 0 to 2 pi i'm always allowed to do the same thing to both sides of an equation i can multiply by some other function and i can integrate it over some region i can do that if it's original is equality then i get a quality here too now let's think about what's going to happen the first thing i'm going to note here is that the contribution from the a0 part is going to be just nothing the reason here is that this a zero was multiplied by sine and when you integrate sine over its period you always get zero integration of constant times sine over its period is again going to be equal to zero then i can look at all the cosine terms and all of those are going to be 0 by that previous identity the integral of a cosine times a sine is always 0. okay finally i have a sum of sine terms but notice here the sum of sine terms is a whole bunch of signs of many different frequencies multiplied to just sine of mt m sort of a specific value well almost all of those are zero again by my previous result the only non-zero one is the specific case when n is equal to m in which case i have b m sine of m t times sine of m t and again we had that integral on the previous page if it was the same frequency sine of mt times sine of mt that integrated out to pi have the extra bm coming out and you get bm times pi okay so in other words i can clean this up a little bit here and what i get is that bm is one over pi the integral from 0 to pi of your function f of t times sine of mt dt and this tells you something now i know how to figure out all of the coefficients of the form bm they're just those specific integrals with whatever function f of t i have okay great we've solved that part of it let's continue instead now what we're going to do is we're going to multiply by cosine on both sides and integrate from 0 to 2 pi similar kind of argument the a naught over two term that's going to cancel away when you integrate because integrating cosine over its period is just zero likewise all the sine terms are going to go away because integrating sines times cosines always equal zero what i'm left with then is the cosine times cosine terms and most of those are zero but there is one non-zero one the time when m is equal to n and i get the integral of am cosine of mt times cosine of mt or cosine of mt squared which we evaluated out to be am times pi and so again i have a formula now for my cosine terms there we have it 1 over pi the integral from 0 to 2pi of f of t cosine of mt dt so this means that for any specific value i can get the am i can get the bm the only thing i don't have yet is that a naught out the front to do that well same trick i'm going to multiply both sides but i'm just going to multiply by 1 and then i'm going to integrate from 0 to 2 pi and now that i'm integrating by 1 all of the cosine terms go away all of the sine terms go away here i'm integrating over their period so they all go away only that remains is the a naught divided by two and that's easy enough to do a naught divided by two times two pi the twos cancel i get a naught times pi and if i bring this one up i'm gonna get that a naught is one over pi the integral from zero to two pi of f of t times 1 dt and if i have all three of my formulas here that is my answer to how i find my coefficients you'll note this is why i choose to canonically reference it as a naught divided by 2. it's because those twos are gonna cancel and mean that our formulas are all consistently one over pi that's why it's defined that way okay so those are our formulas but let's go and apply it in a specific example i'm going to talk about this specific function as one from zero to pi and then zero from pi up to two pi so one and then zero so what i'm trying to do is figure out all of these different coefficients i'm gonna try to figure out the a naught the am and the bm and so what do i do well two things if i plug in the f of t the portions where the f of t are one means i'm just going to plug in one and then for the portions of f of t that are zero that's between pi and two over pi well the easiest way to deal with this is just to change the end points of your integration because it's 0 from pi to 2 pi instead of integrating all the way from 0 to 2 pi i'm just going to integrate from 0 to pi in each place so this is a way a little trick that i can use for this sort of discontinuous function i'll integrate from zero to pi and then i'll just put the function one in and then beyond that it's zero but you don't have to worry about that okay so i have three different intervals the first of them is easy to do this is just going to be 1 pi times 1 over pi is 1. for the second integral again i can do this this is going to be a sine there's a 1 over m that comes out but you know what sine of any integer times pi is always zero sine of pi is zero sine of two pi is zero sine of three pi zero and sine of zero is zero so everything here is zero everything for the ams is just zero okay what about for the bm's well if i do the same thing the integral of sine is going to give a negative cosine of mt divided by m and and now it's not quite so easy it's not the case that everything just cancels when i try to plug in the value of pi so let's focus specifically on that i'll clean up and give myself a little bit of space if i plug in the value of pi then what i'm going to get is this constant on the front 1 over pi times minus 1 over m just a coefficient on the front then plugging in pi gives me cos of m pi minus 1 which is when you plug in 0. so how do i evaluate this now it's actually a little bit of a trick here for dealing with these cosine terms and i'm actually going to put up the plot of cosine just to help me with this so what i'm trying to do here is like cosine of 1 pi 2 pi 3 pi 4 pi and so on but exactly the values change so for example if m is an even number right m is 0 pi 2 pi 4 pi 6 pi et cetera then it's always the peak of my cosine in other words it's equal to 1. but if m is an odd integer like 1 3 5 and so forth this is like cosine of pi cosine of 3 pi and so forth that's always minus 1. so it depends on whether m is even or odd there's a sort of a parity issue appearing here and so the way i can represent this thing that's either plus 1 or minus 1 is with an exponent i replace cosine of m pi with minus 1 to the m let's check this makes sense if i do say m equal to 2 that would be -1 squared minus 1 squared would be 1. that's what i want if m is equal to 1 then minus 1 to the 1 is negative negative 1 that's what i want so this is how i can take my cosine of an integer number of values of pi and replace it with a minus 1 to the m okay let me clean everything up one more time because i have one more step here i want to think about well what is minus 1 to the m minus 1 depends on the value of m if it's an even number this would be 1 minus 1 is equal to 0. so any time m is even 1 minus 1 would be 0. but if m is odd it would be minus 1 minus 1. that would add up to a minus 2. there's another minus on the outside so that would add up to plus 2 it's 2 divided by pi times m that is my coefficient bm so then if i want to take it and plug it into the general fourier series well the a naught is one all of the a n terms are all going to be zero i can get rid of all of those and then i can write down the sine terms that are going to remain and this is what i get one half plus the sum and this is how i try to write only the odd terms i write n equal to 1 3 5 dot dot dot just to indicate that i'm talking about odd terms only up to infinity then it's the terms the b m's that remain 2 over pi times n sine of mt that is my fourier series for this specific function okay so what we've answered is how you find a fourier series if you're given a function you do those integrals that tells you your coefficients plug it into the formula but it doesn't answer the question of whether that fourier series actually converges to something that you care about so i now present to you the fourier convergence theorem this theorem is the fourier convergence theorem and it gives an assumption if your f and your f prime are piecewise continuous on some interval minus l up to l you could then imagine taking that function and periodically extending it beyond this interval but for now it's just defined on this interval well then the conclusion that this converges to precisely the f of t anywhere for any t value where the f of t is continuous and that is it's just a good approximation alternatively if there's a discontinuity then what it converges to is it converges to the midpoint of that discontinuity halfway in between the top value and the bottom value that's where this fourier series is going to converge so this is really nice because these are pretty relaxed conditions f and f prime only being piecewise continuous we're not demanding a lot and what we get is this convergence series that converges to the actual functions when it's continuous into these midpoints when it doesn't and then i've put down the general formulas for computing the a naught the am and the bm so just to illustrate this final point i can go all the way back to my original picture here which is my discontinuous function this is the one that went between 1 and minus 1 very slightly different than the example we did which was 1 and 0 but nevertheless the same idea what we have here is that there's a convergence to the midpoint between the discontinuity that's what we just expected to see from our theorem but then away from the discontinuity at something like for example pi we have a very very good approximation and if we took more terms than the 19 i told the computer to plot when they came up with this plot if we took the limit as the number of terms went to infinity it would indeed converge precisely so that is the idea of fourier series