Back to Blog
Articles

A Brief Introduction to Fourier Transform

A simple introduction to the basic concepts of Fourier Transform.

Papers often move from the time domain to the frequency domain in a single equation. If waves, phase, and complex notation are unfamiliar, that jump is hard to follow. This note starts with a sine wave, uses Euler's formula to read the spectrum, and finishes with an interactive plot.

Trigonometric Functions

Sine and cosine provide a useful starting point for periodic signals.

Trigonometric functions have widespread applications in physics and engineering, particularly in describing waves and vibrations.

A wave is essentially a way of transferring energy, and this transfer often appears in the form of "periodic oscillations."

Periodic?

A common example might be a pendulum, which swings back and forth in a periodic motion. When we observe its motion path, we can see that its displacement changes like a wave, moving from positive values to zero, then to negative values, and then repeating.

So we try to use trigonometric functions to describe the wave more precisely, mathematically represented as:

y(t)=Asin⁡(2πft)y(t) = A \sin(2\pi f t)

Each variable here is related to the pendulum's motion:

  • y(t)y(t): The displacement of the pendulum at time tt.
  • AA: The amplitude, representing the maximum distance the pendulum swings.
  • ff: The frequency, representing how many times the pendulum swings per second.

With the sine function, we can more accurately describe the characteristics of the wave.

If you look closely, you will notice that some waves do not start at zero but rather start oscillating after a certain time offset, which is represented by the "phase ϕ\phi."

The complete waveform formula can be written as:

y(t)=Asin⁡(2πft+ϕ)y(t) = A \sin(2\pi f t + \phi)

Or it can be expressed using the cosine function:

y(t)=Acos⁡(2πft+ϕ)y(t) = A \cos(2\pi f t + \phi)

The difference between sine and cosine waves is in the phase shift, and both can be used to describe wave variations.

Additionally, to describe the rate of change of the wave more effectively, we can use the "angular velocity ω\omega," which represents the rate of phase change per second, with the formula:

ω=2πf\omega = 2\pi f

The interactive chart lets you adjust amplitude, frequency, and phase to see how the sine wave changes.

Interactive sine wave

Waveform
0 — 10 s5.0-5.0
Sine wave

Superposition of Waves

With sine and cosine waves, it's like having the basic elements of the x-axis and y-axis; we can combine different waveforms to form more complex waves, such as:

y(t)=Acos⁡(2πft)+Bsin⁡(2πft)y(t) = A \cos(2\pi f t) + B \sin(2\pi f t)

In this equation, AA and BB are coefficients that determine the size of the cosine and sine components. By superimposing multiple waves, we can form complex waveforms.

You can use the following interactive chart to adjust the parameters of two sine waves and observe the waveform formed by their superposition.

Wave superposition

Two waves and their sum
0 — 10 s10.0-10.0
Wave 1Wave 2Sum
Wave 1
Wave 2

Complex Form

While the trigonometric representation of sine and cosine waves is very intuitive, using complex numbers to represent waveforms is more concise and powerful in mathematical and engineering applications.

Why?

Because complex numbers can unify the combination of sine and cosine into a single formula and make it easier to handle operations like superposition, differentiation, and integration.

Before understanding the complex form, let's quickly review the basic concept of complex numbers. A complex number consists of a real part and an imaginary part, written as:

z=a+biz = a + bi

Where:

  • aa is the real part.
  • bb is the imaginary part.
  • ii is the imaginary unit, satisfying i2=−1i^2 = -1.

Complex numbers can also be expressed in "polar form" as:

z=r(cos⁡θ+isin⁡θ)z = r(\cos\theta + i\sin\theta)

Here:

  • r=a2+b2r = \sqrt{a^2 + b^2} is the modulus of the complex number, representing the distance from the origin to the point (a,b)(a, b).
  • θ=atan2⁡(b,a)\theta = \operatorname{atan2}(b, a) is the argument of the complex number, representing the angle of rotation from the positive real axis.
  • cos⁡θ\cos\theta and sin⁡θ\sin\theta define the direction corresponding to the angle θ\theta.

In Cartesian coordinates, the point (a,b)(a, b) can be converted to polar coordinates (r,θ)(r, \theta).

Substituting rr and θ\theta into the trigonometric expression, we get z=r(cos⁡θ+isin⁡θ)z = r(\cos\theta + i\sin\theta).

Euler's Formula

From a mathematical perspective, the exponential function exe^x can be expanded into a power series:

ex=1+x1!+x22!+x33!+⋯e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots

This series is intuitive when xx is a real number, but it also applies when xx is a complex number.

For example, when x=iθx = i\theta, we substitute into the formula to get:

eiθ=1+iθ1!+(iθ)22!+(iθ)33!+⋯e^{i\theta} = 1 + \frac{i\theta}{1!} + \frac{(i\theta)^2}{2!} + \frac{(i\theta)^3}{3!} + \cdots

Expanding (iθ)n(i\theta)^n, and noting the periodicity of powers of ii (i2=−1,i3=−i,i4=1i^2 = -1, i^3 = -i, i^4 = 1), we can separate the real and imaginary parts of the expansion:

The real part is:

1+(iθ)22!+(iθ)44!+⋯=1−θ22!+θ44!−⋯1 + \frac{(i\theta)^2}{2!} + \frac{(i\theta)^4}{4!} + \cdots = 1 - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \cdots

This is exactly the expansion of cos⁡θ\cos\theta, and similarly, the imaginary part is:

(iθ)1!+(iθ)33!+(iθ)55!+⋯=i(θ−θ33!+θ55!−⋯ )\frac{(i\theta)}{1!} + \frac{(i\theta)^3}{3!} + \frac{(i\theta)^5}{5!} + \cdots = i\left(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\right)

This is exactly the expansion of sin⁡θ\sin\theta.

Therefore, combining the real and imaginary parts, we obtain the famous Euler's formula:

eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta

Here:

  • eiθe^{i\theta} is the exponential representation of the complex number, containing the real part cos⁡θ\cos\theta and the imaginary part isin⁡θi\sin\theta.
  • The real and imaginary parts of the complex number correspond to the horizontal and vertical movements of the waveform.

Complex Waves

Geometric meaning of Euler's formula, source: Wikipedia

We can use Euler's formula to rewrite the waveform equation. For example, consider the following complex waveform:

z(t)=Aei(2πft+ϕ)z(t) = A e^{i(2\pi f t + \phi)}

Expanding ei(2πft+ϕ)e^{i(2\pi f t + \phi)} and using Euler's formula, we get:

z(t)=A[cos⁡(2πft+ϕ)+isin⁡(2πft+ϕ)]z(t) = A \left[\cos(2\pi f t + \phi) + i\sin(2\pi f t + \phi)\right]

This represents the same waveform having both:

  • Real part ℜ(z)=Acos⁡(2πft+ϕ)\Re(z) = A \cos(2\pi f t + \phi)
  • Imaginary part ℑ(z)=Asin⁡(2πft+ϕ)\Im(z) = A \sin(2\pi f t + \phi)

Thus, if we want to represent sine and cosine waves using complex numbers, we can use the real and imaginary parts of the complex number to represent them:

  1. Sine wave y(t)=Asin⁡(2πft+ϕ)y(t) = A \sin(2\pi f t + \phi):

    • We can represent it using the imaginary part of the complex number: y(t)=ℑ(Aei(2πft+ϕ))y(t) = \Im \left(A e^{i(2\pi f t + \phi)}\right)
  2. Cosine wave y(t)=Acos⁡(2πft+ϕ)y(t) = A \cos(2\pi f t + \phi):

    • We can represent it using the real part of the complex number: y(t)=ℜ(Aei(2πft+ϕ))y(t) = \Re \left(A e^{i(2\pi f t + \phi)}\right)

Here, Aei(2πft+ϕ)A e^{i(2\pi f t + \phi)} is the unified complex representation, where the real and imaginary parts correspond to the cosine and sine waves, respectively.

Superposition of Waves

If we directly use trigonometric functions to represent the superposition of two waveforms, we need to use the addition formulas for trigonometric functions, such as:

cos⁡(A+B)=cos⁡Acos⁡B−sin⁡Asin⁡B\cos(A + B) = \cos A \cos B - \sin A \sin B

and

sin⁡(A+B)=sin⁡Acos⁡B+cos⁡Asin⁡B\sin(A + B) = \sin A \cos B + \cos A \sin B

When superimposing two waveforms:

y1(t)=A1cos⁡(2πf1t+ϕ1),y2(t)=A2sin⁡(2πf2t+ϕ2)y_1(t) = A_1 \cos(2\pi f_1 t + \phi_1), \quad y_2(t) = A_2 \sin(2\pi f_2 t + \phi_2)

We would need to expand each waveform separately, apply the cosine and sine addition formulas, and then organize the real and imaginary parts.

Expanding more waves by hand produces longer expressions and more chances to miss a term.

In the complex form, each waveform is represented as:

z1=A1ei(2πf1t+ϕ1),z2=A2ei(2πf2t+ϕ2)z_1 = A_1 e^{i(2\pi f_1 t + \phi_1)}, \quad z_2 = A_2 e^{i(2\pi f_2 t + \phi_2)}

The superposed waveform becomes:

z(t)=z1+z2=A1ei(2πf1t+ϕ1)+A2ei(2πf2t+ϕ2)z(t) = z_1 + z_2 = A_1 e^{i(2\pi f_1 t + \phi_1)} + A_2 e^{i(2\pi f_2 t + \phi_2)}

Complex addition is linear: add the complex waveforms first, then take the real or imaginary part. Magnitudes and phases cannot be added term by term; calculate them from the resulting complex number.

On the other hand, complex numbers inherently contain both real and imaginary parts, which already carry the information for the cosine and sine components of the waveform. Therefore, there is no need to manually handle the decomposition of trigonometric functions.

Another advantage of using complex numbers is that they allow us to clearly separate the "amplitude" and "phase" of the waveform:

  • The amplitude is determined by the magnitude ∣z∣|z|.
  • The phase is determined by the argument arg⁡(z)\arg(z).

When superimposing waveforms, these pieces of information can be handled separately or together in calculations, without needing to expand into trigonometric sum or difference formulas. For example, if we want to simply analyze the amplitude of the superposed waveform, we can directly calculate ∣z∣=ℜ(z)2+ℑ(z)2|z| = \sqrt{\Re(z)^2 + \Im(z)^2}.

Finally, phase rotation of the waveform corresponds to the shift of the complex number's argument. If we need to adjust the phase of the superposed waveform, we only need to add a rotation angle Δθ\Delta\theta to eiθe^{i\theta}, without separately adjusting the phases of the cosine and sine components.

Fourier Transform

All that has been discussed so far serves to help us understand the mathematical formula of the Fourier Transform.

The core concept of the Fourier Transform is:

  • Under suitable conditions, signals can be analyzed using sine and cosine components at different frequencies.

This means that even if a signal looks very complex, such as a piece of music, an image, or a pulse, we can still decompose it into simple, basic waveforms. These basic waveforms are the familiar sine and cosine waves, and they combine in different frequencies, amplitudes, and phases to form the complete signal.

Sine and cosine waves have powerful mathematical properties. For periodic signals that meet the expansion conditions, sine and cosine waves can be viewed as a set of "basis functions," just like the xx, yy, and zz coordinate axes are used to describe positions in space. By appropriately combining them, we can represent any complex shape or variation.

Suppose a signal y(t)y(t) is a time-varying function. The Fourier Transform helps us answer two key questions:

  1. What frequencies exist in this signal?
  2. What are the amplitude and phase of each frequency?

This frequency decomposition allows us to understand the signal from a completely different perspective. Instead of directly observing the waveform changing over time, we can see the signal's spectral characteristics more clearly.

The mathematical definition of the Fourier Transform provides the method for converting a signal from the "time domain" to the "frequency domain," with the core formula being:

Y(f)=∫−∞∞y(t)e−i2πft dtY(f) = \int_{-\infty}^\infty y(t) e^{-i 2\pi f t} \, dt

The physical meaning of each part of the formula is as follows:

  1. Original Signal y(t)y(t):

    y(t)y(t) is a function defined in the time domain. This can be any form of signal, such as the sound wave of a piece of music, the amplitude variations of an electrical signal, or a pulse sequence that jumps within a time interval.

    y(t)y(t) contains the amplitude values of the signal at each moment of time tt.

  2. Complex Exponential Function e−i2πfte^{-i 2\pi f t}:

    This is the key part of the Fourier Transform, and it is actually a combination of sine and cosine waves:

    e−i2πft=cos⁡(2πft)−isin⁡(2πft)e^{-i 2\pi f t} = \cos(2\pi f t) - i \sin(2\pi f t)

    In the Fourier Transform, e−i2πfte^{-i 2\pi f t} is used to match a complex waveform with frequency ff to y(t)y(t), extracting the strength of the signal at that frequency.


The integral operation is essentially an inner product calculation, used to measure the similarity between y(t)y(t) and e−i2πfte^{-i 2\pi f t}.

This "similarity" determines the contribution of the signal at frequency ff.

The Fourier Transform scans over all possible frequencies ff.

For each ff, Y(f)Y(f) is a complex coefficient; its magnitude and angle describe the frequency contribution. The collection of these coefficients is the spectrum.

Instead of talking more about it, let's try calculating it ourselves:

Consider a signal with a single frequency:

y(t)=Acos⁡(2πf0t+ϕ)y(t) = A \cos(2\pi f_0 t + \phi)

Using Euler's formula, we express it as:

y(t)=ℜ{Aei(2πf0t+ϕ)}y(t) = \Re\left\{ A e^{i (2\pi f_0 t + \phi)} \right\}

Now, performing the Fourier Transform:

Y(f)=∫−∞∞y(t)e−i2πft dtY(f) = \int_{-\infty}^\infty y(t) e^{-i 2\pi f t} \, dt

Substituting the expression for y(t)y(t):

Y(f)=∫−∞∞ℜ{Aei(2πf0t+ϕ)}e−i2πft dtY(f) = \int_{-\infty}^\infty \Re\left\{ A e^{i (2\pi f_0 t + \phi)} \right\} e^{-i 2\pi f t} \, dt

An infinitely long pure cosine does not have an ordinary convergent Fourier integral. In the sense of distributions, its spectrum has impulses at both +f0+f_0 and −f0-f_0:

Y(f)=A2eiϕδ(f−f0)+A2e−iϕδ(f+f0)Y(f) = \frac{A}{2}e^{i\phi}\delta(f-f_0) + \frac{A}{2}e^{-i\phi}\delta(f+f_0)

A finite observation window changes the spectrum and spreads each peak. We therefore cannot write Y(f0)=AeiϕY(f_0)=Ae^{i\phi} as an ordinary value. The positive and negative frequency coefficients together retain the amplitude and phase.

The spectrum retains frequency, amplitude, and phase information under the conditions of the transform.

Fourier Series

Fourier series describe periodic signals with discrete harmonics; the Fourier transform uses a continuous frequency variable. The two are closely related, but their signal conditions and spectral forms differ.

Unlike the Fourier Transform, which extends the signal's spectrum to a continuous range of frequencies, the Fourier Series focuses on using a set of "discrete frequencies" to describe a periodic signal.

The core concept of the Fourier Series is:

  • Periodic signals satisfying the expansion conditions can be represented with discrete sine and cosine harmonics.

Keeping finitely many terms gives an approximation. More harmonics usually improve reconstruction, though discontinuities can still produce the Gibbs phenomenon.

Suppose a periodic signal x(t)x(t) with period TT can be represented by the Fourier Series as:

x(t)=a0+∑n=1∞[ancos⁡(2πntT)+bnsin⁡(2πntT)]x(t) = a_0 + \sum_{n=1}^\infty \left[ a_n \cos\left(\frac{2\pi n t}{T}\right) + b_n \sin\left(\frac{2\pi n t}{T}\right) \right]

Here, a0,an,bna_0, a_n, b_n are the coefficients of the Fourier Series, representing the amplitudes of the sine and cosine waves at different frequencies, and these coefficients are determined by the following formulas:

  1. DC Component (a0a_0):

    a0=1T∫0Tx(t) dta_0 = \frac{1}{T} \int_{0}^T x(t) \, dt

    It represents the average value of the signal, or the DC component over one period.

  2. Cosine Coefficients (ana_n):

    an=2T∫0Tx(t)cos⁡(2πntT) dta_n = \frac{2}{T} \int_{0}^T x(t) \cos\left(\frac{2\pi n t}{T}\right) \, dt

    It represents the amplitude of the cosine wave at frequency nT\frac{n}{T}.

  3. Sine Coefficients (bnb_n):

    bn=2T∫0Tx(t)sin⁡(2πntT) dtb_n = \frac{2}{T} \int_{0}^T x(t) \sin\left(\frac{2\pi n t}{T}\right) \, dt

    It represents the amplitude of the sine wave at frequency nT\frac{n}{T}.

Similarly, to simplify the representation and computation, the Fourier Series is often written in complex form:

x(t)=∑n=−∞∞cnei2πntTx(t) = \sum_{n=-\infty}^\infty c_n e^{i \frac{2\pi n t}{T}}

Where cnc_n are the complex coefficients, defined as:

cn=1T∫0Tx(t)e−i2πntT dtc_n = \frac{1}{T} \int_{0}^T x(t) e^{-i \frac{2\pi n t}{T}} \, dt

In this form:

  • For n>0n>0, an=2ℜ{cn}a_n = 2\Re\{c_n\}.
  • For n>0n>0, bn=−2ℑ{cn}b_n = -2\Im\{c_n\}.

The Fourier Series has wide applications in engineering and science, such as studying periodic vibrations in mechanical structures and analyzing periodic electrical signals, like square waves, triangle waves, and sawtooth waves.

Conclusion

This note stops at continuous signals and Fourier series. The Discrete Fourier Transform (DFT), Fast Fourier Transform (FFT), convolution, and frequency-domain filtering are natural next topics. The plot below lets you change a waveform and watch its spectrum respond.

Interactive Activity

Based on the settings, the program will plot the corresponding waveform in the time domain and show its analysis results in the frequency domain.

You will see that the frequency domain distribution matches the values on the "settings panel," with other frequencies generated to approximate the waveform.

Interactive Fourier transform

Time domain
0 — 1 s5.0-5.0
Signal
Frequency domain
0 — 20 Hz150.00.0
Spectral magnitude