But what is a Fourier series? From heat flow to drawing with circles | DE4

3Blue1Brown
30 Jun 201924:47

Summary

TLDRThis script delves into the mesmerizing world of complex Fourier series, where simple rotating vectors combine to create intricate shapes over time. It explores the historical context of Fourier series, originating from the heat equation, and demonstrates how these mathematical tools can describe and control complex patterns. The video explains the concept of breaking down functions into sums of sine waves and rotating vectors, leading to a deeper understanding of differential equations. It concludes by emphasizing the broad applicability of Fourier series and their significance in solving real-world problems.

Takeaways

  • ๐Ÿ“ The video discusses the complex Fourier series, which involves adding vectors that rotate at constant frequencies to create intricate shapes over time.
  • ๐ŸŽญ The animation consists of 300 rotating arrows, each contributing to the complexity of the overall pattern, showcasing the beauty of mathematics in motion.
  • ๐Ÿ” The complexity of the animation is contrasted with the simplicity of its components, highlighting how simple rotational motions can combine to form complex patterns.
  • ๐Ÿค” The video ponders the coordination of the 'swarm' of arrows, which despite their chaotic motion, work together to trace out specific shapes.
  • ๐Ÿงฎ Fourier series are introduced as a mathematical tool that can describe and control the complexity of such animations, emphasizing the predictability and controllability of the patterns.
  • ๐ŸŒก๏ธ The origin of Fourier series is rooted in the heat equation, which Fourier developed to understand how temperature distributions evolve over time.
  • ๐Ÿ”„ The video explains how linear equations, like the heat equation, allow for the combination of solutions to create new solutions, a fundamental property used in Fourier series.
  • ๐Ÿ”ข The concept of infinite sums is introduced to explain how a sum of waves can approximate a discontinuous function, such as a step function, through the limit of partial sums.
  • ๐Ÿ“‰ The video delves into the technicalities of Fourier series, including the computation of coefficients for the series, which are found through integrals of the function.
  • ๐ŸŽจ The broader view of complex functions and rotating vectors is presented as a generalization of the real-valued functions typically used in Fourier series, providing a richer context for understanding the mathematics.

Q & A

  • What is a complex Fourier series?

    -A complex Fourier series is a mathematical technique used to decompose a function into a sum of rotating vectors, each with a constant integer frequency. It's a generalization of the more familiar Fourier series that deals with sine and cosine waves, allowing for a broader range of functions to be represented.

  • How does the animation with 300 rotating arrows relate to complex Fourier series?

    -The animation demonstrates the concept of complex Fourier series by showing how a complex shape can be drawn over time by adding together the motion of multiple arrows, each rotating at a constant frequency. This illustrates the idea of breaking down a function into simpler, oscillatory components.

  • What is the significance of being able to control the initial size and angle of each vector in a complex Fourier series?

    -Controlling the initial size and angle of each vector allows for the creation of a wide variety of shapes and patterns over time. This customization is essential for the practical application of Fourier series in various fields, as it enables the representation and manipulation of complex functions.

  • How does the concept of Fourier series relate to the heat equation?

    -Fourier series is intrinsically linked to the heat equation through the work of Joseph Fourier, who developed the series to solve the heat equation. The heat equation describes how temperature distributions evolve over time, and Fourier's method of breaking down functions into simpler components allowed for the equation's solutions to be found under various initial conditions.

  • What is the role of linearity in the context of the heat equation and Fourier series?

    -Linearity is crucial because it means that the sum of two solutions to the heat equation is also a solution, and solutions can be scaled by constants. This property allows for the construction of custom solutions by combining and scaling an infinite set of basic solutions, which are the exponentially decaying cosine waves in the context of Fourier series.

  • Why is the concept of infinite sums important in understanding Fourier series?

    -Infinite sums are important because they allow for the representation of functions that cannot be accurately represented by finite sums alone. In the context of Fourier series, infinite sums enable the approximation of non-periodic, discontinuous, or complex functions by combining an infinite number of simpler, periodic components.

  • How does the concept of complex numbers and complex exponentials contribute to the understanding of Fourier series?

    -Complex numbers and complex exponentials provide a powerful framework for understanding and computing Fourier series. They allow for the representation of rotating vectors and the generalization of Fourier series to functions with complex outputs, which simplifies computations and offers a deeper insight into the underlying mathematics.

  • What is the significance of the formula e^(i*t) in Fourier series?

    -The formula e^(i*t), representing a complex exponential, is fundamental in Fourier series because it describes a point moving around the unit circle in the complex plane as time 't' progresses. This property is used to model the rotating vectors that are the building blocks of the Fourier series decomposition.

  • How are the coefficients in a Fourier series calculated?

    -The coefficients in a Fourier series are calculated using integrals that essentially average the function over a period. For a function f(t), the coefficient c_n is found by integrating f(t) multiplied by the complex exponential e^(-i*n*2*pi*t) over the interval [0, 1], and then multiplying by the appropriate normalizing factor.

  • What is the practical application of Fourier series in solving differential equations?

    -Fourier series are used to solve differential equations by expressing complex functions as a sum of simpler, exponential functions. This allows for the application of linearity properties and the superposition principle, enabling the construction of solutions for a wide range of initial conditions and boundary conditions.

Outlines

00:00

๐Ÿ” Introduction to Complex Fourier Series

The paragraph introduces the concept of complex Fourier series through the lens of an animation featuring 300 rotating arrows. Each arrow rotates at a constant frequency, and their collective motion traces out intricate shapes over time. The speaker emphasizes the stark contrast between the simplicity of individual arrow movements and the resulting complex patterns they form when combined. The audience is encouraged to appreciate the beauty and complexity of the animation, which is a visual representation of the mathematical idea that simple components can create complex outcomes. The paragraph also sets the stage for a deeper exploration of Fourier series, hinting at their origins in solving the heat equation and their broader applications in various fields.

05:04

๐ŸŒก๏ธ Fourier Series and the Heat Equation

This paragraph delves into the historical context of Fourier series, explaining how they were developed as a solution to the heat equation. The heat equation describes how temperature distributions evolve over time, and Fourier's insight was to express any initial temperature distribution as a sum of sine waves. The paragraph discusses how certain boundary conditions lead to the use of cosine functions instead of sine waves and how these solutions can be combined to create custom solutions for different initial conditions. The speaker highlights the linear property of the heat equation, which allows for the addition of solutions and the scaling of them to fit specific scenarios. The paragraph also touches on the idea that the complexity of the heat distribution's evolution is captured by the different decay rates of the frequency components, leading to the concept of Fourier series as a way to describe and control complex phenomena through simple mathematical constructs.

10:05

๐ŸŒŸ The Immortality of Fourier's Legacy

The speaker reflects on the enduring impact of Fourier's work, noting that his ideas have become synonymous with the analysis of functions as combinations of simple oscillations. The paragraph explores the question of how to express non-wavy, discontinuous functions, like a step function, as sums of sine waves. It discusses the challenge of representing such functions using waves that satisfy specific boundary conditions and how Fourier's approach to using infinite sums of sine waves provides a solution. The concept of infinite sums is explained, drawing an analogy with the sum of rational numbers converging to an irrational number. The paragraph also raises philosophical questions about the nature of solving partial differential equations with discontinuous initial conditions and the completeness of Fourier series in representing all functions, hinting at deeper mathematical discussions.

15:10

๐Ÿ”„ Complex Numbers and Rotating Vectors in Fourier Series

The paragraph shifts the discussion to a more general view of Fourier series using complex numbers and rotating vectors. It explains how functions with real number outputs can be seen as one-dimensional pencil sketches, and how the decomposition into rotating vectors can be visualized. The speaker introduces the concept of complex exponentials, e to the i times t, which describes a point moving around the unit circle in the complex plane, and how this is fundamental to understanding Fourier series. The paragraph also discusses how the complex plane allows for a cleaner and more intuitive understanding of the computations involved in Fourier series, setting the stage for further exploration of related mathematical concepts like the Laplace transform and the importance of exponential functions.

20:11

๐Ÿ“ Computing Fourier Coefficients and Applications

This paragraph focuses on the practical computation of Fourier coefficients, which are essential for expressing a function as a sum of rotating vectors. The speaker describes how to find the constant term of a Fourier series by averaging the function over its input range, equating this to the calculation of an integral. The paragraph then explains how to compute the coefficients for non-constant terms by multiplying the function by a complex exponential that 'freezes' the corresponding rotating vector, allowing its coefficient to be isolated through averaging. The speaker also touches on the numerical methods used to compute these integrals and how the number of vectors used in the approximation affects the accuracy of the result. The paragraph concludes with a practical example of using Fourier series to model a step function, which has applications in understanding heat dissipation between two rods at different temperatures.

Mindmap

Keywords

๐Ÿ’กFourier Series

Fourier Series is a mathematical tool that decomposes functions into a sum of simple sine and cosine waves. In the context of the video, it's used to explain how complex patterns can be broken down into simpler components. The video script mentions that Fourier Series are not only limited to sine waves but can also be generalized to rotating vectors, which is a broader concept that includes the traditional sine wave decomposition as a special case.

๐Ÿ’กComplex Numbers

Complex numbers are numbers that consist of a real part and an imaginary part, usually written as a + bi, where 'i' is the square root of -1. The video script uses complex numbers to represent rotating vectors in two dimensions, which simplifies the computation and visualization of Fourier Series. The concept is crucial as it allows for a more general treatment of functions, not just those with real number outputs.

๐Ÿ’กHeat Equation

The heat equation is a partial differential equation that describes how the distribution of heat (or variation in temperature) evolves over time. In the video, the heat equation serves as the original motivation for the development of Fourier Series. The script explains how Fourier Series can be used to solve the heat equation for specific initial conditions, such as a rod with a temperature distribution that looks like a cosine wave.

๐Ÿ’กLinear Equations

Linear equations are those that are linear in the unknown functions and their derivatives. The video script discusses the heat equation as a linear equation, which means solutions can be combined and scaled to construct new solutions. This property is essential for the application of Fourier Series, as it allows for the construction of solutions to the heat equation by combining simple cosine wave solutions.

๐Ÿ’กExponential Decay

Exponential decay refers to the decrease of a quantity at a rate proportional to its current value. In the video, the script describes how higher frequency components in the Fourier Series of a solution to the heat equation decay faster over time, leading to a smoothing effect as the high-frequency terms approach zero.

๐Ÿ’กDiscrete vs. Continuous

The video script contrasts discrete sums, which are finite, with continuous or infinite sums, which can approach a limit. The concept is important in understanding how Fourier Series can approximate functions. While a finite number of terms in a Fourier Series will never perfectly represent a discontinuous function like a step function, an infinite sum can get arbitrarily close to the desired shape.

๐Ÿ’กComplex Exponentials

Complex exponentials, such as e^(i*t), are used in the video to describe rotating vectors in the complex plane. These are fundamental to the generalization of Fourier Series to complex functions and are essential for solving differential equations. The video script explains how complex exponentials can be thought of as a shorthand for describing rotation, but they also play a deeper role in mathematical analysis.

๐Ÿ’กCoefficients

Coefficients in the context of Fourier Series are the constants that multiply each sine or cosine term in the series. The video script describes how these coefficients determine the initial size and angle of the rotating vectors that make up the Fourier Series representation of a function. The script also explains how these coefficients can be calculated using integrals over the function.

๐Ÿ’กNumerical Integration

Numerical integration is a method for approximating the value of a definite integral using numerical techniques. In the video, numerical integration is mentioned as a way to compute the coefficients of the Fourier Series. The script describes how this is done by summing the product of the function values and the exponential terms over many small intervals.

๐Ÿ’กSVG

SVG (Scalable Vector Graphics) is a file format for defining images in terms of mathematical curves. The video script mentions using SVG files to define the paths for the animations, which allows for the function mapping from time to points in space to be predefined. This is used in conjunction with Fourier Series to animate the complex functions.

Highlights

The animation is created using a complex Fourier series, where each vector rotates at a constant integer frequency.

By adjusting the initial size and angle of each vector, any shape can be drawn over time.

The animation consists of 300 rotating arrows, showcasing the intricacy of the motion.

The complexity of the animation arises from the simple rotation of individual arrows.

The animation demonstrates how a swarm of simple motions can create coordinated complexity.

Fourier series can describe and control the animation's complexity through mathematical tuning.

Fourier series originated from the heat equation, which describes temperature distribution over time.

The heat equation is a linear equation, allowing for the combination of solutions to create new solutions.

Fourier proposed expressing any initial distribution as a sum of sine waves, even discontinuous ones.

The Fourier series can be used to solve the heat equation for any initial condition.

The coefficients in the Fourier series are found by integrating the function over the input range.

The Fourier series is a sum of complex exponentials, which are more general than sine waves.

The complex plane allows for a cleaner understanding of Fourier series and their applications.

The constant term in the Fourier series is the average value of the function over the input range.

The coefficients for non-constant terms are found by multiplying the function by a phase shift and integrating.

The Fourier series can be used to approximate any function, with increasing accuracy as more terms are included.

The step function example demonstrates how Fourier series can model real-world phenomena like heat dissipation.

The Fourier series has far-reaching implications beyond its origins in physics, with applications in various fields.

Transcripts

play00:05

Here, we look at the math behind an animation like this one,

play00:08

what's known as a complex Fourier series.

play00:11

Each little vector is rotating at some constant integer frequency,

play00:15

and when you add them together, tip to tail, the final tip draws out some shape over time.

play00:21

By tweaking the initial size and angle of each vector,

play00:24

we can make it draw pretty much anything we want, and here you'll see how.

play00:31

Before diving into it all, I want you to take

play00:33

a moment to just linger on how striking this is.

play00:37

This particular animation has 300 rotating arrows in total.

play00:41

Go full screen for this if you can, the intricacy is worth it.

play00:50

Think about this, the action of each individual arrow is perhaps

play00:54

the simplest thing you could imagine, rotation at a steady rate.

play00:58

And yet the collection of all added together is anything but simple,

play01:02

and the mind-boggling complexity is put into an even sharper focus the farther we

play01:06

zoom in, revealing the contributions of the littlest, quickest,

play01:09

and downright frenetic arrows.

play01:12

When you consider the chaotic frenzy you're looking at,

play01:15

and the clockwork rigidity underlying all the motions,

play01:18

it's bizarre how the swarm acts with a kind of coordination to trace

play01:21

out some very specific shape.

play01:23

And unlike much of the emergent complexity you find elsewhere in nature,

play01:27

this is something that we have the math to describe and to control completely.

play01:31

Just by tuning the starting conditions, nothing more,

play01:34

we can make this swarm conspire in all of the right ways to draw anything you want,

play01:39

provided you have enough little arrows.

play01:42

What's even crazier is that the ultimate formula for all of this is incredibly short.

play01:52

Now often, Fourier series are described in terms of something that looks a little

play01:56

different, functions of real numbers being broken down as a sum of sine waves.

play02:01

That turns out to be a special case of this more general rotating vector

play02:04

phenomenon that we'll build up to, but it's where Fourier himself started,

play02:07

and there's good reason for us to start the story there as well.

play02:11

Technically, this is the third video in a sequence about the heat equation,

play02:14

what Fourier was working on when he developed his big idea.

play02:18

I would like to teach you about Fourier series in a way that doesn't depend on

play02:21

you coming from those chapters, but if you have at least a high-level idea for

play02:25

the problem from physics which originally motivated this piece of math,

play02:28

it gives some indication for just how unexpectedly far-reaching Fourier series are.

play02:32

All you need to know is that we had a certain equation which tells us

play02:36

how the temperature distribution on a rod would evolve over time,

play02:40

and incidentally it also describes many other phenomena unrelated to heat.

play02:44

While it's hard to directly use this equation to figure out what will happen to an

play02:49

arbitrary heat distribution, there's a simple solution if the initial function just

play02:53

happens to look like a cosine wave, with the frequency tuned so that it's flat at each

play02:57

end point.

play02:58

Specifically, as you graph what happens over time,

play03:01

these waves simply get scaled down exponentially,

play03:04

with higher frequency waves having a faster exponential decay.

play03:10

The heat equation happens to be what's known in the business as a linear equation,

play03:15

meaning if you know two solutions and add them up, that sum is a new solution.

play03:20

You can even scale them each by some constant,

play03:23

which gives you some dials to turn to construct a custom function solving the equation.

play03:29

This is a fairly straightforward property that you can verify for yourself,

play03:32

but it's incredibly important.

play03:34

It means we can take our infinite family of solutions,

play03:37

these exponentially decaying cosine waves, scale a few of them by some

play03:41

custom constants of our choosing, and combine them to get a solution for a new,

play03:45

tailor-made initial condition, which is some combination of cosine waves.

play03:50

One important thing I'd like you to notice is that when you combine these waves,

play03:54

because the higher frequency ones decay faster,

play03:57

the sum you construct will tend to smooth out over time,

play04:00

as all the high frequency terms quickly go to zero,

play04:02

leaving only the low frequency terms dominating.

play04:06

So in a funny way, all of the complexity in the evolution of this heat

play04:09

distribution which the heat equation implies is captured by this

play04:12

difference in the decay rates for the different pure frequency components.

play04:18

It's at this point that Fourier gains immortality.

play04:21

I think most normal people at this stage would say, well,

play04:24

I can solve the heat equation when the initial distribution just happens to look like

play04:28

a wave, or a sum of waves, but what a shame it is that most real world distributions

play04:32

don't at all look like that.

play04:34

I mean, for example, let's say you brought together two rods

play04:37

which were each at some uniform temperature, and you wanted

play04:40

to know what happens immediately after they come into contact.

play04:45

To make the number simple, let's say the temperature of the left rod is 1 degree,

play04:49

and the right rod is negative 1 degree, and that the total length,

play04:53

L, of the combined two rods is 1.

play04:54

What this means is our initial temperature distribution is a step function,

play04:59

which is so obviously different from a sine wave, or the sum of sine waves,

play05:03

don't you think?

play05:05

I mean, it's almost entirely flat, not wavy, and for god's sake it's even discontinuous!

play05:10

And yet Fourier thought to ask a question which seems absurd.

play05:14

How do you express this as a sum of sine waves?

play05:17

Even more boldly, how do you express any initial distribution as a sum of sine waves?

play05:21

And it's more constrained than just that!

play05:24

You have to restrict yourself to adding waves which satisfy a certain boundary condition,

play05:28

and as we saw last video, that means working with these cosine functions whose

play05:32

frequencies are all some whole number multiple of a given base frequency.

play05:36

And by the way, if you were working with some different boundary condition,

play05:40

say that the endpoints have to stay fixed, you'd have a different set of waves at

play05:44

your disposal to piece together, in this case replacing that cosine expression with

play05:48

a sine.

play05:49

It's strange how often progress in math looks more like

play05:52

asking a new question rather than simply answering old ones.

play05:56

Fourier really does have a kind of immortality now,

play05:58

with his name essentially synonymous with the idea of breaking

play06:01

down functions and patterns as combinations of simple oscillations.

play06:05

It's really hard to overstate just how important and far-reaching that idea

play06:09

turned out to be, well beyond anything Fourier himself could have imagined.

play06:13

And yet, the origin of all this is a piece of physics which,

play06:16

at first glance, has nothing to do with frequencies and oscillations.

play06:21

If nothing else, this should give you a hint about

play06:23

the general applicability of Fourier series.

play06:26

Now hang on, I hear some of you saying, none of these sums of sine waves that

play06:29

you're showing are actually the step function, they're all just approximations.

play06:33

And it's true, any finite sum of sine waves will never be perfectly flat,

play06:37

except for a constant function, nor will it be discontinuous.

play06:42

But Fourier thought more broadly, considering infinite sums.

play06:46

In the case of our step function, it turns out to be equal to this infinite sum,

play06:51

where the coefficients are 1, negative one third, plus one fifth, minus one seventh,

play06:57

and so on for all the odd frequencies, and all of it is rescaled by 4 divided by pi.

play07:03

I'll explain where those numbers come from in a moment.

play07:06

Before that, it's worth being clear about what we mean by a phrase like infinite sum,

play07:10

which runs the risk of being a little vague.

play07:13

Consider the simpler context of numbers, where you could say,

play07:17

for example, that this infinite sum of fractions equals pi divided by 4.

play07:21

As you keep adding the terms one by one, at all times what you have is rational,

play07:26

it never actually equals the irrational pi divided by 4.

play07:30

But this sequence of partial sums approaches pi over 4, which is to say,

play07:34

the numbers you see, while never equaling pi over 4,

play07:37

get arbitrarily close to that value, and they stay arbitrarily close to that value.

play07:43

That's all a mouthful to say, so instead we abbreviate

play07:46

and just say the infinite sum equals pi over 4.

play07:50

With functions, you're doing the same thing, but with many different values in parallel.

play07:55

Consider a specific input, and the value of all

play07:58

of these scaled cosine functions for that input.

play08:02

If that input is less than 0.5, as you add more and more terms, the sum will approach 1.

play08:10

If that input is greater than 0.5, as you add more and more terms,

play08:13

it would approach negative 1.

play08:17

At the input 0.5 itself, all of the cosines are 0,

play08:20

so the limit of the partial sums is also 0.

play08:24

That means that, somewhat awkwardly, for this infinite sum to be strictly true,

play08:28

we have to prescribe the value of this set function at the point of

play08:32

discontinuity to be 0, sort of halfway along the jump.

play08:36

Analogous to an infinite sum of rational numbers being irrational,

play08:40

the infinite sum of wavy continuous functions can equal a discontinuous flat function.

play08:47

Getting limits into the game allows for qualitative changes,

play08:50

which finite sums alone never could.

play08:53

There are multiple technical nuances that I'm sweeping under the rug here.

play08:56

Does the fact that we're forced into a certain value for the step function

play08:59

at the point of discontinuity make any difference for the heat flow problem?

play09:03

For that matter, what does it really mean to solve

play09:06

a PDE with a discontinuous initial condition?

play09:09

Can we be sure that the limit of solutions to the heat equation is also a solution?

play09:13

And can we be sure that all functions actually have a Fourier series like this?

play09:17

If not, when not?

play09:19

These are exactly the kind of questions which real analysis is built to answer,

play09:22

but it falls a bit deeper in the weeds than I'd like to go here,

play09:25

so I'll relegate that all to links in the video's description.

play09:28

The upshot is that when you take the heat equation solutions associated with

play09:33

these cosine waves and add them all up, all infinitely many of them,

play09:37

you do get an exact solution describing how the step function will evolve over time,

play09:41

and if you had done this in 1822, you would have become immortal for doing so.

play09:47

The key challenge in all of this, of course, is to find these coefficients.

play09:53

So far, we've been thinking about functions with real number outputs,

play09:57

but for the computations, I'd like to show you something more general than what

play10:00

Fourier originally did, applying to functions whose output can be any complex number

play10:04

in the 2D plane, which is where all these rotating vectors from the opening come

play10:08

back into play.

play10:10

Why the added complexity?

play10:12

Well, aside from being more general, in my view, the computations become cleaner,

play10:16

and it's easier to understand why they actually work.

play10:20

More importantly, it sets a good foundation for the ideas that will come up later on

play10:24

in the series, like the Laplace transform, and the importance of exponential functions.

play10:29

We'll still think of functions whose input is some real number on a finite interval,

play10:33

say from 0 up to 1 for simplicity, but whereas something like a temperature

play10:37

function will have outputs on the real number line,

play10:40

this broader view will let the outputs wander anywhere in the 2D complex plane.

play10:45

You might think of such a function as a drawing,

play10:47

with a pencil tip tracing out different points in the complex plane as the

play10:51

input ranges from 0 to 1.

play10:53

And instead of sine waves being the fundamental building block,

play10:56

as you saw at the start, we'll focus on breaking these functions down

play10:59

as a sum of little vectors, all rotating at some constant integer frequency.

play11:03

Functions with real number outputs are essentially really boring drawings,

play11:09

a one-dimensional pencil sketch.

play11:11

You might not be used to thinking of them like this,

play11:14

since usually we visualize such a function with a graph,

play11:17

but right now the path being drawn is only in the output space.

play11:25

If you do one of these decompositions into rotating vectors for a boring one-dimensional

play11:30

drawing, what will happen is that the vectors with frequency 1 and negative 1 will

play11:34

have the same length, and they'll be horizontal reflections of each other.

play11:39

When you just look at the sum of these two as they rotate,

play11:42

that sum stays fixed on the real number line, and it oscillates like a sine wave.

play11:46

If you haven't seen it before, this might be a really weird way to think about what a

play11:51

sine wave is, since we're used to looking at its graph rather than the output alone

play11:55

wandering on the real number line, but in the broader context of functions with complex

play11:59

number outputs, this oscillation on the horizontal line is what a sine wave looks like.

play12:04

Similarly, the pair of rotating vectors with frequencies 2 and negative 2 will

play12:09

add another sine wave component, and so on, with the sine waves we were looking

play12:14

for earlier now corresponding to pairs of vectors rotating in opposite directions.

play12:19

So the context that Fourier originally studied,

play12:22

breaking down real-valued functions into sine waves,

play12:25

is a special case of the more general idea of 2D drawings and rotating vectors.

play12:34

And at this point, maybe you don't trust me that widening our view to

play12:37

complex functions makes things easier to understand, but bear with me,

play12:41

it's really worth the added effort to see the fuller picture,

play12:44

and I think you'll be pleased with how clean the actual computation is in

play12:47

this broader context.

play12:49

You may also wonder why, if we're going to bump things up into two dimensions,

play12:52

we don't just talk about 2D vectors, what does the square root

play12:55

of negative one have to do with anything?

play12:58

Well, the heart and soul of Fourier series is the complex exponential, e to the i times t.

play13:04

As the input t ticks forward with time, this value walks

play13:07

around the unit circle at a rate of one unit per second.

play13:12

In the next video you'll see a quick intuition for why exponentiating imaginary

play13:16

numbers walks around circles like this from the perspective of differential equations.

play13:20

And beyond that, as the series progresses, I hope to give you some

play13:23

sense for why complex exponentials like this are actually very important.

play13:27

In theory, you could describe all of the Fourier series stuff purely in terms of vectors,

play13:31

and never breathe a word of i, the square root of negative one.

play13:35

The formulas would become more convoluted, but beyond that,

play13:38

leaving out the function e to the x would somehow no longer authentically

play13:42

reflect why this idea turns out to be so useful for solving differential equations.

play13:47

For right now, if you want, you can think of e to the i t as a

play13:50

notational shorthand for describing rotating vectors,

play13:53

but just keep in the back of your mind that it is more significant than mere shorthand.

play13:58

You'll notice I'm being a little loose with language using the words vector and complex

play14:02

numbers somewhat interchangeably, in large part because thinking of complex numbers

play14:06

as little arrows makes the idea of adding a lot of them together easier to visualize.

play14:11

Alright, armed with the function e to the i times t,

play14:13

let's write down a formula for each of these rotating vectors we're working with.

play14:18

For right now, think of each of them as starting

play14:20

pointing one unit to the right at the number 1.

play14:23

The easiest vector to describe is the constant one, which stays at the number 1,

play14:27

never moving, or if you prefer, it's quote-unquote rotating just at a frequency of 0.

play14:33

Then there will be the vector rotating one cycle every second,

play14:36

which we write as e to the 2 pi i times t.

play14:39

That 2 pi is there because as t goes from 0 to 1,

play14:42

it needs to cover a distance of 2 pi along the circle.

play14:47

Technically in what's being shown, it's actually one cycle every 10 seconds

play14:50

so things aren't too dizzying, I'm slowing everything down by a factor of 10.

play14:55

We also have a vector rotating at one cycle per second in the other direction,

play14:59

e to the negative 2 pi i times t.

play15:04

Similarly, the one going two rotations per second is e to the 2 times 2 pi i times t,

play15:10

where that 2 times 2 pi in the exponent describes how much distance is covered in one

play15:16

second.

play15:20

And we go on like this over all integers, both positive and negative,

play15:25

with a general formula of e to the n times 2 pi times i t.

play15:29

Notice, this makes it more consistent to write that constant vector

play15:32

as e to the 0 times 2 pi times i t, which feels like an awfully

play15:35

complicated way to write the number 1, but at least it fits the pattern.

play15:40

The control that we have, the set of knobs and dials we get to turn,

play15:43

is the initial size and direction of each of these numbers.

play15:47

The way we control that is by multiplying each one by some complex constant,

play15:51

which I'll call c sub n.

play15:53

For example, if we wanted the constant vector not to be at the number 1,

play15:58

but to have a length of 0.5, c sub 0 would be 0.5.

play16:02

If we wanted the vector rotating at 1 cycle per second to start off at an

play16:06

angle of 45 degrees, we'd multiply it by a complex number which has the effect

play16:10

of rotating it by that much, which you can write as e to the pi fourths times i.

play16:15

And if its initial length needed to be 0.3, then the

play16:18

coefficient c sub 1 would be 0.3 times that amount.

play16:22

Likewise, everyone in our infinite family of rotating vectors has some complex constant

play16:27

being multiplied into it, which determines its initial angle and its total magnitude.

play16:32

Our goal is to express any arbitrary function f of t,

play16:36

say this one that draws an eighth note as t goes from 0 to 1,

play16:40

as a sum of terms like this, so we need some way of picking out these constants

play16:46

one by one, given the data of the function itself.

play16:51

The easiest of these to find is the constant term.

play16:55

This term represents a sort of center of mass for the full drawing.

play16:59

If you were to sample a bunch of evenly spaced values for the

play17:02

input t as it ranges from 0 to 1, the average of all the outputs

play17:06

of the function for those samples would be the constant term c0.

play17:11

Or more accurately, as you consider finer and finer samples,

play17:14

the average of the outputs for these samples approaches c0 in the limit.

play17:20

What I'm describing, finer and finer sums of a function for samples of

play17:24

t from the input range, is an integral, an integral of f of t from 0 to 1.

play17:30

Normally, since I'm framing this all in terms of averages,

play17:33

you would divide the integral by the length of the input range,

play17:37

but that length is 1, so in this case, taking an integral and taking an

play17:40

average are the same thing.

play17:42

There's a very nice way to think about why this integral would pull out c0.

play17:47

Remember, we want to think of this function as a sum of rotating vectors,

play17:51

so consider this integral, this continuous average, as being applied to that whole sum.

play17:57

The average of a sum like this is the same as the sum over the averages of each part.

play18:06

You can read this move as a sort of subtle shift in perspective.

play18:09

Rather than looking at the sum of all the vectors at each point in time

play18:13

and taking the average value they sweep out, look at the average of an

play18:17

individual vector as t goes from 0 to 1, and then add up all these averages.

play18:22

But each of these vectors just makes a whole number of rotations around 0,

play18:27

so its average value as t ranges from 0 to 1 will be 0.

play18:31

The only exception is the constant term.

play18:33

Since it stays static and doesn't rotate, its average value

play18:37

is just whatever number it happened to start on, which is c0.

play18:41

So doing this average over the whole function is a

play18:44

sort of clever way to kill all the terms that aren't c0.

play18:48

But here's the actual clever part.

play18:49

Let's say you wanted to compute a different term, like c2,

play18:52

sitting in front of the vector rotating two cycles per second.

play18:56

The trick is to first multiply f of t by something that makes that vector hold still,

play19:01

sort of the mathematical equivalent of giving a smartphone to an overactive child.

play19:06

Specifically, if you multiply the whole function by e to the negative

play19:10

2 times 2 pi i times t, think about what happens to each term.

play19:16

Since multiplying exponentials results in adding what's in the exponent,

play19:21

the frequency term in each of our exponents gets shifted down by 2.

play19:29

So now, as we do our averages of each term, that c-1

play19:33

vector spins around negative 3 times with an average of 0.

play19:37

The c0 vector, previously constant, now rotates twice as t ranges from 0 to 1,

play19:43

so its average is also 0.

play19:46

And likewise, all vectors other than the c2 term make some whole number of rotations,

play19:51

meaning they average out to be 0.

play19:55

So taking the average of this modified function is

play19:58

a clever way to kill all the terms other than c2.

play20:02

And of course, there's nothing special about the number 2 here,

play20:05

you could replace it with any other n, and you have a general formula for cn,

play20:08

which is what we're looking for.

play20:10

Out of context, this expression might look complicated, but remember,

play20:14

you can read it as first modifying our function, our 2d drawing,

play20:17

so as to make the nth little vector hold still,

play20:20

and then performing an average which kills all the moving vectors and

play20:23

leaves you only with the still part.

play20:26

Isn't that crazy?

play20:27

All of the complexity in these decompositions you're seeing of drawings into

play20:31

sums of many rotating vectors is entirely captured in this little expression.

play20:36

So when I'm rendering these animations, that's exactly what I'm having the computer do.

play20:41

It treats the path like a complex function, and for a certain range of values n,

play20:45

it computes this integral to find the coefficient c of n.

play20:51

For those of you curious about where the data for a path itself comes from,

play20:54

I'm going the easy route and just having the program read in an SVG,

play20:57

which is a file format that defines the image in terms of mathematical curves rather

play21:01

than with pixel values.

play21:03

So the mapping f of t from a time parameter to points in space basically comes predefined.

play21:10

In what's shown right now, I'm using 101 rotating vectors,

play21:14

computing the values of n from negative 50 up to 50.

play21:18

In practice, each of these integrals is computed numerically,

play21:21

basically meaning it chops up the unit interval into many small pieces of size delta t,

play21:26

and then adds up this value, f of t times e to the negative n 2 pi i t times delta t,

play21:31

for each one of them.

play21:33

There are fancier methods for more efficient numerical integration,

play21:36

but this gives the basic idea.

play21:38

And after you compute these 101 constants, each one determines an initial

play21:42

angle and magnitude for the little vectors, and then you just set them all rotating,

play21:47

adding them tip to tail as they go, and the path drawn out by the final

play21:51

tip is some approximation of the original path you fed in.

play21:55

As the number of vectors used approaches infinity,

play21:57

the approximation path gets more and more accurate.

play22:14

To bring this all back down to earth, consider the example we were looking at earlier,

play22:18

of a step function, which remember was useful for modeling the heat dissipation

play22:22

between two rods at different temperatures after they come into contact.

play22:26

Like any real number valued function, the step function

play22:29

is like a boring drawing that's confined to one dimension.

play22:33

But this one is an especially dull drawing, since for inputs between 0 and 0.5,

play22:38

the output just stays static at the number 1, and then it discontinuously

play22:42

jumps to negative 1 for inputs between 0.5 and 1.

play22:46

So in the Fourier series approximation, the vector sum stays really

play22:49

close to 1 for the first half of the cycle, then quickly jumps to negative 1,

play22:53

and stays close to that for the second half of the cycle.

play22:57

And remember, each pair of vectors rotating in opposite directions

play23:01

corresponds to one of the cosine waves we were looking at earlier.

play23:06

To find the coefficients, you would need to compute this integral,

play23:09

and for the ambitious viewers among you itching to work out some integrals by hand,

play23:13

this is one where you can actually do the calculus to get an exact answer,

play23:16

rather than just having a computer do it numerically for you.

play23:19

I'll leave it as an exercise to work this out,

play23:22

and to relate it back to the idea of cosine waves by pairing off the vectors

play23:26

that rotate in opposite directions.

play23:28

And for the even more ambitious, I'll leave another exercise up on the screen for

play23:32

how to relate this more general computation with what you might see in a textbook

play23:36

describing Fourier series only in terms of real valued functions with sines and cosines.

play23:41

By the way, if you're looking for more Fourier series content,

play23:44

I highly recommend the videos by Mathologer and The Coding Train,

play23:48

and I'd also recommend this blog post, links of course in the description.

play23:53

So on the one hand, this concludes our discussion of the heat equation,

play23:57

which was a little window into the study of partial differential equations.

play24:01

But on the other hand, this Fourier-to-Fourier series is a first glimpse at a deeper idea.

play24:06

Exponential functions, including their generalization into complex

play24:09

numbers and even matrices, play a very important role for differential equations,

play24:13

especially when it comes to linear equations.

play24:16

What you just saw, breaking down a function as a combination

play24:19

of these exponentials and using that to solve a differential equation,

play24:23

comes up again and again in different shapes and forms.

play24:44

Thank you.

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Fourier SeriesComplex NumbersMath AnimationVector RotationHeat EquationDifferential EquationsMathematicsEducational ContentComplex AnalysisNumerical Integration