Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Compute the Fourier coefficients of a periodic function

Use when: you have a periodic function with period T and need a_0, a_n, and b_n for its Fourier series

Goal: explicit formulas or numbers for a_0, a_n, and b_n that determine the function's Fourier series

Taught in Deriving the coefficient formulas from orthogonality

  1. 1

    Read off the period T, then pick any one period-length window to integrate over, usually the one where f's own formula is stated most simply.

    Example

    The rectangular pulse has period T=2\pi; its own definition is stated on (-\pi,\pi), so that's the window used below.

    Why: every coefficient formula integrates over exactly one period, and a window of the wrong length changes the constant out front, not just the arithmetic.

  2. 2

    Compute a_0=\dfrac2T\displaystyle\int f(x)\,dx over the chosen period; a_0/2 is f's average value over that period, a fast sanity check.

    Example

    a_0=\dfrac1\pi\displaystyle\int_{-\pi/2}^{\pi/2}1\,dx=1, so the constant term is a_0/2=1/2, exactly the pulse's average, since it's 1 on half its period and 0 on the other half.

    Why: setting n=0 in the a_n formula makes \cos(0\cdot x)=1, so a_0 is the same formula evaluated once at n=0, not a separate idea.

  3. 3

    Compute a_n=\dfrac2T\displaystyle\int f(x)\cos(n\omega_0x)\,dx, then look for a pattern across n rather than stopping after one value.

    Example

    a_n=\dfrac2\pi\displaystyle\int_{-\pi/2}^{\pi/2}\cos(nx)\,dx=\dfrac{4}{n\pi}\sin\!\left(\dfrac{n\pi}2\right), giving a_1=\dfrac4\pi, a_2=0, a_3=-\dfrac{4}{3\pi}.

    • f is even — b_n=0 for every n, so Step 4 needs no work at all.
    • f is odd — a_0=0 and a_n=0 for every n, so only Step 4 has any content.

    Why: multiplying by \cos(n\omega_0x) and integrating isolates a_n because orthogonality sends every other frequency's cross term to 0, leaving only the one that matches.

  4. 4

    Compute b_n=\dfrac2T\displaystyle\int f(x)\sin(n\omega_0x)\,dx, the same idea run with \sin in place of \cos.

    Example

    b_1=\dfrac1\pi\displaystyle\int_{-\pi/2}^{\pi/2}\sin(x)\,dx=\dfrac1\pi\big({-}\cos(\pi/2)+\cos({-}\pi/2)\big)=0, straight from the integral, before appealing to any symmetry shortcut.

    Why: the same orthogonality argument isolates b_n instead of a_n, using \sin(n\omega_0x) as the matching frequency.

Common mistakes

  • Integrating over a window that isn't exactly one full period, which changes the constant 2/T out front.
  • Forgetting the factor of \tfrac12 that turns a_0 into the series' actual constant term a_0/2.
  • Computing a_n or b_n for a single value of n and treating it as the general formula instead of finding the pattern.
  • Not checking evenness or oddness first, which would have predicted that half the coefficients are automatically zero.