First Year Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Fourier series and harmonic analysis

Fourier series and harmonic analysis: periodic function representation, Dirichlet conditions, even/odd and half‑range expansions, complex form, Parseval’s identity, Gibbs phenomenon, and extracting harmonics from tabulated data.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Fourier series lets engineers represent any reasonable periodic signal (voltage, current, displacement, temperature, vibration) as a sum of simple sinusoids. This is essential for analyzing filters and circuits, vibration modes, heat flow in fins, periodic loads on structures, and signal compression. Harmonic analysis is the reverse process: from measured periodic data (e.g., oscilloscope samples), extract the amplitudes and phases of the harmonics for diagnosis and design.

Key ideas

  • Fourier series (trigonometric form)
    • Definition (interval [−π, π]): If f(x) is periodic with period 2π and satisfies Dirichlet conditions (below), its Fourier series is f(x) ~ a0/2 + Σ_{n=1 to ∞} [an cos(nx) + bn sin(nx)].
    • Coefficients on [−π, π] an = (1/π) ∫{−π}^{π} f(x) cos(nx) dx, bn = (1/π) ∫{−π}^{π} f(x) sin(nx) dx, a0 = (1/π) ∫_{−π}^{π} f(x) dx.
  • Dirichlet conditions (sufficient for convergence)
    • On [−π, π], f(x) must be: (i) absolutely integrable, (ii) have a finite number of maxima and minima, and (iii) a finite number of finite discontinuities. Then the Fourier series converges to f(x) at every point of continuity, and to the average of left- and right-limits at each jump discontinuity.
  • Even/odd simplifications
    • A function is even if f(−x) = f(x). Then bn = 0 (only cosine terms remain).
    • A function is odd if f(−x) = −f(x). Then an = 0 and a0 = 0 (only sine terms remain).
  • Half-range expansions (0 to L)
    • On (0, L), you can expand f(x) in a half-range sine or cosine series by making an odd or even extension to (−L, L).
    • Half-range cosine (even extension): f(x) ~ a0/2 + Σ an cos(nπx/L) with an = (2/L) ∫_0^L f(x) cos(nπx/L) dx.
    • Half-range sine (odd extension): f(x) ~ Σ bn sin(nπx/L) with bn = (2/L) ∫_0^L f(x) sin(nπx/L) dx.
  • Complex (exponential) form
    • Using e^{inx} = cos(nx) + i sin(nx): f(x) ~ Σ_{n=−∞}^{∞} c_n e^{inx}, with c_n = (1/2π) ∫{−π}^{π} f(x) e^{−inx} dx and c{−n} = c_n* for real f.
    • Relation to an, bn: c_0 = a0/2, and for n ≥ 1, an = c_n + c_{−n}, bn = i(c_n − c_{−n}).
  • Convergence and Gibbs phenomenon
    • Near a jump discontinuity, the partial sums overshoot by about 9% of the jump height; this Gibbs phenomenon does not vanish as more terms are added, but the region of oscillation narrows.
    • What to draw for an exam: Plot one period of a square wave with labeled jump heights; draw the 5-term partial sum showing overshoot near the jump; label the overshoot ≈ 0.089×(jump).
  • Orthogonality and energy
    • On [−π, π]: ∫_{−π}^{π} cos(mx) cos(nx) dx = 0 if m ≠ n, = π if m = n ≠ 0; similarly for sines; and ∫ sin(mx) cos(nx) dx = 0 for all m,n.
    • Parseval’s identity (energy equality) on [−π, π]: (1/π) ∫{−π}^{π} |f(x)|^2 dx = (a0^2)/2 + Σ{n=1}^{∞} (an^2 + bn^2).
  • Differentiation and integration of Fourier series
    • If Σ [an cos(nx) + bn sin(nx)] converges absolutely and f is piecewise smooth, then you may differentiate or integrate term-by-term inside intervals of continuity. Differentiation: d/dx [an cos(nx) + bn sin(nx)] = −n an sin(nx) + n bn cos(nx). Integration: ∫ [an cos(nx) + bn sin(nx)] dx = (an/n) sin(nx) − (bn/n) cos(nx) for n ≥ 1, plus the integral of a0/2 which is (a0/2) x.
  • Harmonic analysis (from tabulated data)
    • For N equally spaced samples over one period: θ_k = 2πk/N, f_k = f(θ_k).
    • Discrete harmonic coefficients (trapezoidal rule over a period) are a0 = (2/N) Σ f_k, an = (2/N) Σ f_k cos(nθ_k), bn = (2/N) Σ f_k sin(nθ_k), for n = 1,2,…, typically up to N/2.
    • Amplitude-phase form: an cos(nx) + bn sin(nx) = Rn cos(nx − φn), where Rn = √(an^2 + bn^2) and φn = atan2(bn, an).

Derivations commonly asked

  • Derive an and bn: Multiply series by cos(mx) or sin(mx), integrate over [−π, π], use orthogonality to isolate the m-th coefficient.
  • Prove Parseval’s identity: Multiply f by its series and integrate term-by-term, or use orthogonality of trigonometric basis.
  • Obtain half-range formulas: Extend f(x) evenly or oddly and apply the [−L, L] formulas with x → πx/L.
  • Show Fourier series of x on [−π, π] and use Parseval to sum Σ 1/n^2.

Formulas

f(x) = a0/2 + Σ_{n=1}^{∞} [an cos(nx) + bn sin(nx)]

  • f(x): function value (same unit as the physical quantity; no SI unit fixed). x: angle in radians. Valid for period 2π when Dirichlet conditions hold.

a0 = (1/π) ∫_{−π}^{π} f(x) dx

  • a0: DC (average) term (same unit as f). Applies for period 2π.

an = (1/π) ∫_{−π}^{π} f(x) cos(nx) dx

  • an: cosine coefficients (same unit as f). n: harmonic index (dimensionless). Applies for period 2π.

bn = (1/π) ∫_{−π}^{π} f(x) sin(nx) dx

  • bn: sine coefficients (same unit as f). n: harmonic index (dimensionless). Applies for period 2π.

General full-range (period 2L): f(x) ~ a0/2 + Σ_{n=1}^{∞} [an cos(nπx/L) + bn sin(nπx/L)], with a0 = (1/L) ∫_{−L}^{L} f(x) dx, an = (1/L) ∫_{−L}^{L} f(x) cos(nπx/L) dx, bn = (1/L) ∫_{−L}^{L} f(x) sin(nπx/L) dx

  • Valid for functions with period 2L under Dirichlet conditions; arguments of the trigonometric functions are dimensionless.

f(x) = Σ_{n=−∞}^{∞} cn e^{inx}, cn = (1/2π) ∫_{−π}^{π} f(x) e^{−inx} dx

  • cn: complex Fourier coefficients (same unit as f). i: √(−1). Valid for period 2π.

Parseval: (1/π) ∫_{−π}^{π} |f(x)|^2 dx = (a0^2)/2 + Σ_{n=1}^{∞} (an^2 + bn^2)

  • Left side: (1/π) times the integral of |f(x)|^2 over one period (units: f^2). Valid when the series converges in mean square.

Half-range cosine: f(x) ~ a0/2 + Σ an cos(nπx/L), an = (2/L) ∫_0^L f(x) cos(nπx/L) dx

  • For even extension on (0, L). x in meters or seconds as per physical domain; the argument of cosine is dimensionless.

Half-range sine: f(x) ~ Σ bn sin(nπx/L), bn = (2/L) ∫_0^L f(x) sin(nπx/L) dx

  • For odd extension on (0, L). Same units as above.

Discrete harmonic analysis: a0 = (2/N) Σ_{k=0}^{N−1} f_k

  • For N uniform samples over a period. f_k has same unit as f. N dimensionless.

Discrete harmonic analysis: an = (2/N) Σ_{k=0}^{N−1} f_k cos(nθ_k), bn = (2/N) Σ_{k=0}^{N−1} f_k sin(nθ_k)

  • θ_k = 2πk/N (radians). Use typically for n = 1,2,…,⌊N/2⌋.

Amplitude–phase: an cos(nx) + bn sin(nx) = Rn cos(nx − φn)

  • Rn = √(an^2 + bn^2) (same unit as f). φn = atan2(bn, an) (radians). n dimensionless.

Gibbs overshoot ≈ 0.089 × (jump height)

  • Rule-of-thumb at a jump discontinuity for partial sums. Dimensionless ratio.

Worked examples

  1. Full-range Fourier series of f(x) = x on (−π, π)
  • Given: f(x) = x (unit: same as x, but treat as mathematical). Periodic extension of period 2π.
  • Observations: f is odd ⇒ a0 = 0, an = 0. Only bn needed.
  • Step 1: Compute bn. bn = (1/π) ∫{−π}^{π} x sin(nx) dx = (2/π) ∫{0}^{π} x sin(nx) dx. Integrate by parts: ∫ x sin(nx) dx = −x cos(nx)/n + sin(nx)/n^2. Evaluate 0 to π: [−π cos(nπ)/n + 0] − [0 + 0] = −π(−1)^n / n. Hence bn = (2/π) × (−π(−1)^n / n) = −2(−1)^n / n = 2(−1)^{n+1}/n.
  • Step 2: Write series and note convergence at endpoints. f(x) ~ Σ bn sin(nx) ⇒ x ~ 2 Σ_{n=1}^{∞} (−1)^{n+1} (1/n) sin(nx), for x ∈ (−π, π). At x = ±π, the series converges to (π + (−π))/2 = 0 (the average of the left and right limits).
  • Final answer: x = 2 Σ_{n=1}^{∞} (−1)^{n+1} (1/n) sin(nx) on (−π, π).

Using Parseval here gives a standard sum: (1/π) ∫{−π}^{π} x^2 dx = Σ b_n^2 = Σ 4/n^2 ⇒ (1/π) × (2π^3/3) = 4 Σ 1/n^2 ⇒ 2π^2/3 = 4 Σ 1/n^2 ⇒ Σ{n=1}^{∞} 1/n^2 = π^2/6.

  1. Half-range cosine series of f(x) = x on (0, π)
  • Given: f(x) = x on 0 < x < π; extend evenly to (−π, π) ⇒ cosine series.
  • Step 1: Compute a0. a0 = (2/π) ∫_0^π x dx = (2/π) [x^2/2]_0^π = (2/π) × (π^2/2) = π.
  • Step 2: Compute an for n ≥ 1. an = (2/π) ∫_0^π x cos(nx) dx. Integrate by parts or from known integral: ∫ x cos(nx) dx = x sin(nx)/n + cos(nx)/n^2. Evaluate 0 to π: [π sin(nπ)/n + cos(nπ)/n^2] − [0 + 1/n^2] = [0 + (−1)^n/n^2] − 1/n^2 = ((−1)^n − 1)/n^2. Hence an = (2/π) × ((−1)^n − 1)/n^2 = 0 for even n; for odd n, an = −4/(π n^2).
  • Step 3: Write the series. x ~ a0/2 + Σ an cos(nx) = π/2 − (4/π) Σ_{k=0}^{∞} [cos((2k+1)x)/(2k+1)^2], for 0 < x < π.
  • Final answer: x = π/2 − (4/π) [cos x/1^2 + cos 3x/3^2 + cos 5x/5^2 + …], 0 < x < π.

As an application of Parseval on (0, π) with this series, you can derive Σ_{k=0}^{∞} 1/(2k+1)^4 = π^4/96.

  1. Harmonic analysis from 8 equally spaced samples (discrete)
  • Given: One period sampled at N = 8 points θ_k = 2πk/8, k = 0,…,7 (radians). Measured voltage v(θ) (unit: volt) has samples: v_k at θ = [0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°] as [10.0000, 11.8284, 6.0000, 0.1716, 2.0000, 6.1716, 6.0000, 5.8284]. Compute a0, a1, b1, a2, b2 using discrete formulas and identify the first two harmonics.
  • Step 1: DC term a0. Sum Σ v_k = 48.0000 V. Then a0 = (2/N) Σ v_k = (2/8) × 48.0000 = 12.0000 V ⇒ DC component a0/2 = 6.0000 V.
  • Step 2: First harmonic (n = 1). a1 = (2/8) Σ v_k cos θ_k, b1 = (2/8) Σ v_k sin θ_k. Using orthogonality over equally spaced points (or by direct summation), Σ cos θ_k = 0, Σ sin θ_k = 0, and Σ v_k cos θ_k = 16.0000, Σ v_k sin θ_k = 0.0000. Hence a1 = (2/8) × 16.0000 = 4.0000 V, b1 = 0.0000 V. Amplitude R1 = √(4^2 + 0^2) = 4.0000 V, phase φ1 = atan2(0, 4) = 0 rad.
  • Step 3: Second harmonic (n = 2). a2 = (2/8) Σ v_k cos 2θ_k, b2 = (2/8) Σ v_k sin 2θ_k. Over the 8-point grid, Σ v_k cos 2θ_k = 0.0000, Σ v_k sin 2θ_k = 12.0000. Hence a2 = 0.0000 V, b2 = (2/8) × 12.0000 = 3.0000 V. Amplitude R2 = √(0^2 + 3^2) = 3.0000 V, phase φ2 = atan2(3, 0) = π/2 rad.
  • Step 4: Reconstructed signal (first two harmonics + DC): v(θ) ≈ 6.0000 + 4.0000 cos θ + 3.0000 sin 2θ V.
  • Final answer: DC = 6.0000 V, first harmonic 4.0000 V at 0 rad phase, second harmonic 3.0000 V at π/2 phase. This exactly matches the underlying signal in this constructed data set.

Note: In practice, if N is not a multiple of the harmonic period, spectral leakage occurs; windowing or higher N may be needed (covered in Signals/EE, not required here).

Common mistakes

  • Dropping the a0/2 term: The average (DC) component is a0/2, not a0.
  • Wrong parity simplification: Declaring a function even/odd incorrectly; always check f(−x) against f(x).
  • Sign errors in integration by parts: Especially for bn of odd functions like f(x) = x.
  • Misusing Parseval: Squaring coefficients but forgetting the factor (a0^2)/2 or omitting both sine and cosine sums.
  • Discrete analysis indexing: Using θ_k = 2πk/N but summing k = 1 to N instead of 0 to N−1 (double counting 0 and 2π), or forgetting the factor 2/N.
  • Amplitude–phase conversion: Using φ = atan2(−bn, an). For a_n cos(nx) + b_n sin(nx) written as R cos(nx − φ), the correct mapping is a_n = R cos φ, b_n = R sin φ ⇒ φ = atan2(b_n, a_n).

For your exam

  • Computations: Find Fourier series for given f(x) on [−π, π] or [0, L]; simplify using even/odd symmetry; carry out integration by parts cleanly and present the final series with a0/2. Keep units (if any) consistent and state x in radians.
  • Identities from Fourier series: Use Parseval to derive sums like Σ 1/n^2 = π^2/6 or sums over odd integers. Show both sides and all constants.
  • Harmonic analysis (tabular): Given N equally spaced samples, compute a0, a1, b1, etc. Show the discrete formulas, present a small table, and report amplitudes and phases using Rn, φn.
  • Diagrams: If asked about Gibbs, draw and label one period of a function with a jump, sketch a partial sum, and mark the ≈9% overshoot region.

Quick check

  1. State the Dirichlet conditions and what the Fourier series converges to at a jump.
  2. For an even function on [−π, π], which Fourier coefficients vanish? For an odd function?
  3. A periodic signal has a1 = 3, b1 = 4 for its first harmonic term a1 cos x + b1 sin x. What are R1 and φ1 in R1 cos(x − φ1)?

Answers: 1) f is absolutely integrable on [−π, π], has finitely many maxima/minima and finite discontinuities; the Fourier series converges to the average of left and right limits at a jump. 2) Even: all bn = 0; Odd: all an = 0 and a0 = 0. 3) R1 = √(3^2 + 4^2) = 5, φ1 = atan2(4, 3).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?