Skip to main content
Home
A key to conquer the (open source) world.

Main navigation

  • Home
  • About Us
    • About this website
    • About_me
    • Family rivalry
  • Gurus
  • Tutorials
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Tutorials

πŸ“ 2. Fourier Series General Concepts

Hero image for keyhole tutorials.

Before building a Fourier series, we need to understand periodic functions and a few key properties of sine and cosine integrals. These concepts explain why complicated periodic signals can be decomposed into simple waves.

Fourier series explained main picture.

πŸ” 2.1 Periodic Functions

Definition 1 β€” Periodic Function

A function \( f \) is periodic if there exists a number \( p\neq 0 \) such that

\[ f(x+p) = f(x) \]

for every value of x.

The number \( p \) is called a period of the function.

Consequence

If \( p \) is a period of \( f \) then every integer multiple of \( p \) is also a period.

\[ np, \quad n \in \mathbb{Z},\; n \neq 0 \]

Examples

For instance,

\[ f(x+2p) = f(x+p+p) = f(x+p) = f(x) \]

Similarly,

\[ f(x-p) = f(x-p+p) = f(x) \]

Definition 2 β€” Fundamental Period

The smallest positive number for which

\[ f(x+p) = f(x) \]

holds is called the fundamental period of the function \( f \).

All integer multiples of this number are also periods, but the smallest one is usually the most useful.

Examples of Periodic Functions

The functions:

\[ \sin x, \quad \cos x \]

have period \( 2\pi \).

The functions

\[ \sin(nx), \quad \cos(nx) \]

have period \( \frac{2\pi}{n} \).

A function such as

\[ 1 + 2\sin x + 3\cos x + 5\sin(5x) – 8\cos(8x) \]

also has period \( 2\pi \).

The function

\[ \frac{a_0}{2} + \sum_{n=1}^{N} \left(a_n \cos(nx) + b_n \sin(x)\right) \]

is periodic with period \( 2\pi \):

  • \( \cos(nx) \) is \( 2\pi \)-periodic for any integer n.
  • \( \sin(x) \) is also \( 2\pi \)-periodic.
  • A finite sum of \( 2\pi \)-periodic functions is also \( 2\pi \)-periodic.

So the function remains \( 2\pi \)-periodic.

Similarly, the general trigonometric series

\[ \frac{a_0}{2} + \sum_{n=1}^{\infty} \left(a_n \cos(nx) + b_n \sin(nx)\right) \]

is periodic with period \( 2\pi \).

This is the standard Fourier series form. The summation goes to \( \infty \) because the function is expressed as an infinite sum of sine and cosine harmonics.

A finite approximation, where N is a fixed integer, is also periodic with period \( 2\pi \)

\[ \frac{a_0}{2} + \sum_{n=1}^{N} \left(a_n \cos(nx) + b_n \sin(nx)\right) \]

Why the function \( 1 + 2\sin x + 3\cos x + 5\sin(5x) – 8\cos(8x) \) is periodic with periode \( 2\pi \)?

1. Periods of the Individual Terms

A key rule for trigonometric functions is:

  • \( \sin(kx) \) has period \( \frac{2\pi}{k} \).
  • \( \cos(kx) \) has period \( \frac{2\pi}{k} \).

Examining each term of the function:

  • 1 has any period.
  • \( \sin x \) has period \( 2\pi \).
  • \( \cos x \) has period \( 2\pi \).
  • \( \sin(5x) \) has period \( \frac{2\pi}{5} \).
  • \( \cos(8x) \) has period \( \frac{2\pi}{8}=\frac{\pi}{4} \) .

Conclusion: The five individual terms of the function have 3 different periods.

2. Period of a Sum of Periodic Functions

When periodic functions are added together, the period of the sum must be a common multiple of all individual periods.

So in this case we need a number \( T \) such that:

\[ T = n_{1}(2\pi) \\ T = n_{2}(\frac{2\pi}{5}) \\T = n_{3}(\frac{\pi}{4}) \]

for some integers \( n_{1},n_{2},n_{3} \).

Solution:

\[ 2\pi = (n_{1}=1)(2\pi) \\ 2\pi = (n_{2}=5)(\frac{2\pi}{5}) \\2\pi = (n_{3}=8)(\frac{\pi}{4}) \]

This confirms that \( T =2\pi \) is a common period for all terms, it is the smallest number that works for all terms simultaneously.

3. Interpretation
  • \( \sin x \) completes 1 cycle in \( 2\pi \).
  • \( \sin (5x) \) completes 5 cycles in \( 2\pi \).
  • \( \cos (8x) \) completes 8 cycles in \( 2\pi \).

After \( 2\pi \), all waves return to the same starting point simultaneously, so the entire function repeats.

The function has a period \( 2\pi \).

\( T =2\pi \) is a common period of all terms.

Why the function \( f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n\cos(nx)+b_n\sin(nx)\right) \) is periodic with periode \( 2\pi \)?

1. What β€œperiodic” means

A function is periodic if its values repeat after some distance \( T \).

\[ f(x+T)=f(x) \]

For this function we want to show the repetition happens after \( 2\pi \).

\[ f(x+2\pi)=f(x) \]

2. Key property of sine and cosine

The sine and cosine functions repeat every \( 2\pi \).

\[ \cos(\theta+2\pi)=\cos(\theta) \]

\[ \sin(\theta+2\pi)=\sin(\theta) \]

This means if you shift the input by \( 2\pi \), the value does not change.

3. What happens to \( \cos (nx) \)?

Now look at one term of the series.

\[ \cos(nx) \]

If we shift x by \( 2\pi \), we get

\[ \cos(n(x+2\pi)) \]

Expand inside the cosine:

\[ \cos(nx+2\pi n) \]

Because cosine repeats every \( 2\pi \), adding \( 2\pi n \) does not change the value:

\[ \cos(nx+2\pi n)=\cos(nx) \]

So each cosine term repeats after \( 2\pi \).

4. What happens to \( \sin (nx) \)?

Start with

\[ \sin(nx) \]

Shift x by \( 2\pi \):

\[ \sin(n(x+2\pi)) \]

Expand:

\[ \sin(nx+2\pi n) \]

Since sine also repeats every \( 2\pi \):

\[ \sin(nx+2\pi n)=\sin(nx) \]

So each sine term also repeats after \( 2\pi \).

5. Apply this to the whole function

Now evaluate the function at \( x +2\pi \) :

\[ f(x+2\pi)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n\cos(n(x+2\pi))+b_n\sin(n(x+2\pi))\right) \]

Using the identities we proved:

\[ \cos(n(x+2\pi))=\cos(nx) \]

\[ \sin(n(x+2\pi))=\sin(nx) \]

So the function becomes

\[ f(x+2\pi)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n\cos(nx)+b_n\sin(nx)\right) \]

But this is exactly the original function:

\[ f(x+2\pi)=f(x) \]

6. Final intuition (important)

A Fourier series is built from sines and cosines, and each of those repeats every \( 2\pi \).

Since the function is just a sum of repeating functions, the whole function repeats after \( 2\pi \).

βœ… Conclusion

\[ f(x+2\pi)=f(x) \]

Therefore the function is periodic with period \( 2\pi \).

Theorem β€” Integral Over One Period

  • The integral of a periodic function over one period is independent of the lower limit of integration.

In other words, if a function has period \( p \), then integrating it over any interval of length \( p \) always gives the same value.

Proof

Let \( f \) be a periodic function with period \( p \). This means:

\[ f(x+p) = f(x) \]

for every real number x.

Step 1 β€” Start with the integral

Consider the integral over an arbitrary interval of length \( p \) with \( a\neq 0 \):

\[ \int_a^{a+p} f(x)\,dx \]

Step 2 β€” Split the interval

Split the interval at 0 and \( p \):

\[ \int_a^{a+p} f(x)\,dx
=
\int_a^{0} f(x)\,dx
+
\int_{0}^{p} f(x)\,dx
+
\int_{p}^{a+p} f(x)\,dx \]

This is allowed because of the property of definite integrals that works even if the intermediate point is outside the interval.

For any numbers a,b,c,

\[ \int_a^b f(x)\,dx
=
\int_a^c f(x)\,dx
+
\int_c^b f(x)\,dx \]

Step 3 β€” Transform the split integral

In the split integral, perform the substitution

\[ x = t + p \]

Then dx = dt, and the limits change:

  • when x = p = t + p, then t = 0
  • when x = a + p = t + p, then t = a

So the last integral becomes

\[ \int_{p}^{a+p} f(x)\,dx
=
\int_{0}^{a} f(t+p)\,dt \]

Step 4 β€” Use periodicity

Because \( f \) has period \( p \),

\[ f(t+p)=f(t) \]

Therefore

\[ \int_{p}^{a+p} f(x)\,dx
=
\int_{0}^{a} f(t)\,dt \]

Step 5 β€” Simplify

In a definite integral, the symbol used for the variable of integration has no meaning outside the integral. It is only a placeholder.

Therefore:

\[ \int_0^a f(t)\,dt
=
\int_0^a f(x)\,dx \]

represent exactly the same quantity.

Substitute this result back into the expression:

\[ \int_a^{a+p} f(x)\,dx
=
\int_a^{0} f(x)\,dx
+
\int_{0}^{p} f(x)\,dx
+
\int_{p}^{a+p} f(x)\,dx \]

will result in:

\[ \int_a^{a+p} f(x)\,dx
=
\int_a^{0} f(x)\,dx
+
\int_{0}^{p} f(x)\,dx
+
\int_{0}^{a} f(x)\,dx \]

The first and last integrals cancel because

\[ \int_a^{0} f(x)\,dx = -\int_0^{a} f(x)\,dx \]

Thus we obtain

\[ \int_a^{a+p} f(x)\,dx
=
\int_{0}^{p} f(x)\,dx \]

Conclusion

The integral of a periodic function over any interval of length \( p \) is always the same. Therefore, the value of the integral does not depend on the lower limit a.

\[ \int_a^{a+p} f(x)\,dx = \int_0^{p} f(x)\,dx \]

βœ… Intuition

A periodic function repeats its graph every \( p \). Integrating over any interval of length \( p \) therefore always covers exactly one full cycle, so the area under the curve is always the same.

πŸ“Š 2.2 Important Integrals

In Fourier series we often encounter integrals involving products of sine and cosine functions.
When these functions are integrated over the symmetric interval
\[ [-\pi,\pi] \]
many of these integrals become very simple, they satisfy several important relationships known as orthogonality relations.

The reason is that sine and cosine functions have special symmetry properties.

These properties cause many integrals to become zero, which is a key idea behind Fourier series.

Theorem

For integers \( n,m\in \mathbb{N} \), the following integrals hold.

1. Sine Γ— Cosine

\[(2.2.1)\int_{-\pi}^{\pi} \sin(nx)\cos(mx)\,dx = 0 \]

2. Sine Γ— Sine

\[ (2.2.2)\int_{-\pi}^{\pi} \sin(nx)\sin(mx)\,dx =
\begin{cases}
0 & n \ne m \\
\pi & n=m>0 \\
0 & n=m=0
\end{cases} \]

3. Cosine Γ— Cosine

\[ (2.2.3)\int_{-\pi}^{\pi} \cos(nx)\cos(mx)\,dx =
\begin{cases}
0 & n \ne m \\
\pi & n=m>0 \\
2\pi & n=m=0
\end{cases} \]

Useful Trigonometric Identities

The following identities are often used to compute these integrals.

Product-to-sum formulas

\[ \sin a \cos b = \frac{1}{2}[\sin(a+b)+\sin(a-b)] \]

\[ \cos a \cos b = \frac{1}{2}[\cos(a+b)+\cos(a-b)] \]

\[ \sin a \sin b = \frac{1}{2}[\cos(a-b)-\cos(a+b)] \]

Power-reduction formulas

\[ \sin^2 x = \frac{1}{2}(1-\cos 2x) \]

\[ \cos^2 x = \frac{1}{2}(1+\cos 2x) \]

βœ… Key idea

These results show that sine and cosine waves with different frequencies cancel each other when integrated over a full period.

This property, called orthogonality, is what allows a Fourier series to decompose a function into independent sine and cosine components.

πŸ“ Proof β€” (2.2.1) Sine Γ— Cosine Orthogonality

We want to prove that for \( n,m\in \mathbb{N} \):

\[ \int_{-\pi}^{\pi} \sin(nx)\cos(mx)\,dx = 0 \]

🌱 Step 1 β€” Define the function

Let

\[ f(x)=\sin(nx)\cos(mx) \]

To evaluate the integral, we study the symmetry of this function.

πŸ”„ Step 2 β€” Evaluate the function at \( -x \)

Substitute \( -x \) into the function.

\[ f(-x)=\sin(n(-x))\cos(m(-x)) \]

πŸ” Step 3 β€” Use symmetry properties of sine and cosine

The sine and cosine functions have important symmetry properties.

\[ \sin(-x)=-\sin(x) \]

\[ \cos(-x)=\cos(x) \]

Applying these properties gives:

\[ f(-x)=-\sin(nx)\cos(mx) \]

So we obtain:

\[ f(-x) = -f(x) \]

βš–οΈ Step 4 β€” Recognize the function is odd

A function satisfying

\[ f(-x) = -f(x) \]

is called an odd function.

For odd functions, the area on the left side of the origin cancels the area on the right side.

πŸ‘‰ Graphically, this means symmetry around the origin.

πŸ“Š Step 5 β€” Apply the theorem about odd functions

For any odd function:

\[ \int_{-a}^{a} f(x)\,dx = 0 \]

This happens because the area on the left side cancels the area on the right side.

βœ… Applying this to our function gives

\[ \int_{-\pi}^{\pi} \sin(nx)\cos(mx)\,dx = 0 \]

🌊 Intuitive explanation

The graph of \( \sin (nx) \cos (mx) \) is symmetric around the origin:

  • the positive area on one side of the y-axis
  • cancels the negative area on the other side

So the total integral over the symmetric interval \( [-\pi,\pi] \) becomes zero.

🌟 Key Insight

  • Sine Γ— cosine is always an odd function.

πŸ‘‰ Therefore, its integral over any symmetric interval is zero.

This is the first orthogonality relation and a key reason why Fourier series can separate functions into independent sine and cosine components.

πŸ“ Proof β€” (2.2.2) Sine Γ— Sine Orthogonality

We now prove the second important orthogonality result used in Fourier series.

\[ \int_{-\pi}^{\pi} \sin(nx)\sin(mx)\,dx =
\begin{cases}
0 & n \ne m \\
\pi & n=m>0 \\
0 & n=m=0
\end{cases} \]

We prove this using a trigonometric identity.

🌱 Step 1 β€” Use a product-to-sum identity

We use the trigonometric identity that converts a product of sines into cosines to simplify the product:

\[ \sin a \sin b = \frac{1}{2}\left[\cos(a-b)-\cos(a+b)\right] \]

Substitute

\[ a=nx,\quad b=mx \]

Then:

\[ \sin(nx)\sin(mx)=\frac{1}{2}\left[\cos((n-m)x)-\cos((n+m)x)\right] \]

πŸ”„ Step 2 β€” Insert into the integral

Substitute the identity into the integral:

\[ \int_{-\pi}^{\pi}\sin(nx)\sin(mx)\,dx \]

becomes

\[ \frac12
\int_{-\pi}^{\pi}
\left[\cos((n-m)x)-\cos((n+m)x)\right]dx \]

Now we examine the different cases.

πŸ” Case 1 β€” \( n\neq m \)

If \( n\neq m \), both terms contain cosine functions with non-zero frequencies.

We use the fact that:

\[ \int_{-\pi}^{\pi}\cos(kx)\,dx=0
\quad\text{for } k\neq0 \]

πŸ‘‰ Intuition:

  • Over one full period, positive and negative parts cancel out.
  • Over the interval \([-\pi,\pi] \), the cosine wave has positive and negative parts that cancel out perfectly when \( k\neq 0 \).
  • So the total signed area becomes zero.

Therefore 

\[ \int_{-\pi}^{\pi}\sin(nx)\sin(mx)\,dx=0 \]

πŸ” Case 2 β€” \( n=m\gt 0 \)

Then the function becomes:

\[ \sin(nx)\sin(nx)=\sin^2(nx) \]

Use the identity

\[ \sin^2 x=\frac12(1-\cos 2x) \]

Replacing x with nx:

\[ \sin^2(nx)=\frac12(1-\cos(2nx)) \]

Now integrate:

\[ \int_{-\pi}^{\pi}\sin^2(nx)\,dx
=
\int_{-\pi}^{\pi}\frac12(1-\cos(2nx))\,dx \]

Split the integral:

\[ \frac12\int_{-\pi}^{\pi}1\,dx
-
\frac12\int_{-\pi}^{\pi}\cos(2nx)\,dx \]

The second integral is zero, because over the interval \([-\pi,\pi] \), the function \(cos(2nx) \) completes an integer number of full oscillations, and the positive and negative areas cancel out perfectly.

So we obtain

\[ \frac{1}{2}\int_{-\pi}^{\pi}1dx=\frac{1}{2}\left[ x \right]^{\pi}_{-\pi}=\frac{\pi-(-\pi)}{2}=\pi \]

Thus

\[ \int_{-\pi}^{\pi}\sin(nx)\sin(nx)\,dx=\pi \]

πŸ” Case 3 β€” \( n=m=0 \)

Then

\[ \sin(0x)\sin(0x)=0 \]

So

\[ \int_{-\pi}^{\pi}0\,dx=0 \]

Final Result

\[ \int_{-\pi}^{\pi}\sin(nx)\sin(mx)\,dx =
\begin{cases}
0 & n\ne m \\
\pi & n=m>0 \\
0 & n=m=0
\end{cases} \]

🌟 Key insight

Different sine waves cancel out over a full period unless they have the same frequency.

πŸ‘‰ You can think of them as independent directions (like perpendicular vectors).

This property is called orthogonality, and it is what makes Fourier series work so beautifully.

πŸ“ Proof β€” (2.2.3) Cosine Γ— Cosine Orthogonality

We now prove the third important orthogonality relation used in Fourier series.

\[ \int_{-\pi}^{\pi} \cos(nx)\cos(mx)\,dx =
\begin{cases}
0 & n \ne m \\
\pi & n=m>0 \\
2\pi & n=m=0
\end{cases} \]

🌱 Step 1 β€” Use a trigonometric identity

We start with the product-to-sum identity for cosine.

\[ \cos a \cos b = \frac{1}{2}\left[\cos(a+b)+\cos(a-b)\right] \]

Substitute:

\[ a = nx,\qquad b = mx \]

Then:

\[ \cos(nx)\cos(mx)=\frac12\left[\cos((n+m)x)+\cos((n-m)x)\right] \]

πŸ”„ Step 2 β€” Insert this into the integral

\[ \int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx \]

After substituting the identity:

\[ \frac12
\int_{-\pi}^{\pi}
\left[\cos((n+m)x)+\cos((n-m)x)\right]dx \]

πŸ” Case 1 β€” \( n\neq m \)

If \( n\neq m \) then

  • \( n+m\neq 0 \)
  • \( n-m\neq 0 \)

Both cosine terms have non-zero frequency.

We use the fact that

\[ \int_{-\pi}^{\pi}\cos(kx)\,dx = 0
\quad (k \ne 0) \]

πŸ‘‰ Intuition: positive and negative parts cancel over a full period.

Therefore both integrals vanish and

\[ \int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx = 0 \]

πŸ” Case 2 β€” \(n=m\gt 0 \)

The product becomes

\[ \cos(nx)\cos(nx)=\cos^2(nx) \]

Use the identity

\[ \cos^2 x = \frac12(1+\cos 2x) \]

Replace x with nx:

\[ \cos^2(nx)=\frac12(1+\cos(2nx)) \]

Now integrate:

\[ \int_{-\pi}^{\pi}\cos^2(nx)\,dx
=
\int_{-\pi}^{\pi}\frac12(1+\cos(2nx))\,dx \]

Split the integral:

\[ \frac12\int_{-\pi}^{\pi}1\,dx
+
\frac12\int_{-\pi}^{\pi}\cos(2nx)\,dx \]

The second integral is zero, because over the interval \([-\pi,\pi] \), the function \(cos(2nx) \) completes an integer number of full oscillations, and the positive and negative areas cancel out perfectly.

\[ \int_{-\pi}^{\pi}\cos(kx)\,dx = 0
\quad (k \ne 0) \]

Computing the first integral of our function:

\[ \frac{1}{2}\int_{-\pi}^{\pi}1dx \]

  • The integral of the constant function 1 is simply:

\[ \int 1 \, dx = x \]

  • Using this rule for definite integrals:
    Suppose:

\[ \int_{}^{}f(x)dx=F(x) \]

  • then

\[ \int_a^b f(x)\,dx = F(b) – F(a) \]

Evaluating the first integral from \( -\pi \) to \( \pi \):

\[ \frac{1}{2}\int_{-\pi}^{\pi}1dx=\frac{1}{2}(\pi - (-\pi))=\frac{1}{2}(2\pi)=\pi \]

Thus

\[ \int_{-\pi}^{\pi}\cos(nx)\cos(nx)\,dx=\pi \]

πŸ” Case 3 β€” \( n=m=0 \)

Then

\[ \cos(0x)\cos(0x)=1 \]

Now integrate:

\[ \int_{-\pi}^{\pi}1\,dx \]

  • The integral of the constant function 1 is simply:

\[ \int 1 \, dx = x \]

  • Using the rule for definite integrals:
    Suppose:

\[ \int_{}^{}f(x)dx=F(x) \]

  • then

\[ \int_a^b f(x)\,dx = F(b) – F(a) \]

Evaluate the integral from \( -\pi \) to \( \pi \):

\[ \int_{-\pi}^{\pi}1dx= (\pi - (-\pi))=2\pi \]

Final Result

\[ \int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx =
\begin{cases}
0 & n \ne m \\
\pi & n=m>0 \\
2\pi & n=m=0
\end{cases} \]

🌟 Key Insight

Cosine waves of different frequencies cancel out over a full period.

πŸ‘‰ Only identical frequencies produce a nonzero result.

This β€œnon-overlapping” behavior is called orthogonality, and it allows Fourier series to break a function into independent cosine and sine components.

Back to the Fourier series explained tutorial list

Back to the tutorial list

Author

 

 

 

 

 

 

Categories
Science
Mon, 04/13/2026 - 17:32

Managed ad1

RSS feed
Powered by Drupal