A Fourier series expresses a periodic function as a sum of sine and cosine waves. In plain language, it breaks one repeating shape into simpler repeating pieces with different frequencies.

If ff is periodic and piecewise smooth over one period, this expansion is the standard starting point. It is useful because the coefficients tell you which frequencies matter and how strongly they appear.

Fourier series formula for a 2π2\pi-periodic function

For a 2π2\pi-periodic function, the standard real Fourier series is

f(x)a02+n=1(ancos(nx)+bnsin(nx))f(x) \sim \frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos(nx) + b_n\sin(nx)\right)

The symbol \sim matters. It means this is the Fourier series associated with ff, not automatically an algebraic identity at every point.

The coefficients are found by integrating over one full period:

a0=1πππf(x)dxa_0 = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\,dx an=1πππf(x)cos(nx)dxa_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos(nx)\,dx bn=1πππf(x)sin(nx)dxb_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin(nx)\,dx

Here is the intuition:

  • a0/2a_0/2 is the average level of the function over one period.
  • ana_n measures the cosine part of frequency nn.
  • bnb_n measures the sine part of frequency nn.

Large coefficients mean that frequency contributes more to the final shape.

What changes when the period is TT instead of 2π2\pi

If the period is TT, the same idea still works, but the waves have to fit that period:

f(x)a02+n=1(ancos(2πnxT)+bnsin(2πnxT))f(x) \sim \frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos\left(\frac{2\pi n x}{T}\right) + b_n\sin\left(\frac{2\pi n x}{T}\right)\right)

with coefficients

a0=2Tx0x0+Tf(x)dxa_0 = \frac{2}{T}\int_{x_0}^{x_0+T} f(x)\,dx an=2Tx0x0+Tf(x)cos(2πnxT)dxa_n = \frac{2}{T}\int_{x_0}^{x_0+T} f(x)\cos\left(\frac{2\pi n x}{T}\right)\,dx bn=2Tx0x0+Tf(x)sin(2πnxT)dxb_n = \frac{2}{T}\int_{x_0}^{x_0+T} f(x)\sin\left(\frac{2\pi n x}{T}\right)\,dx

You can integrate over any interval of length TT. The condition is simple: the interval must cover exactly one full period.

Why sine and cosine work here

Sine and cosine are periodic, and different frequencies stay separate when you integrate them over a full period. That orthogonality is what makes the coefficient formulas work.

So the series is really asking the same question again and again: how much of frequency nn is inside the original function? The coefficients answer that question.

Use symmetry before you integrate

Before doing any integration, check whether the function is even or odd.

  • If ff is even, then all bnb_n terms are 00.
  • If ff is odd, then a0=0a_0=0 and all ana_n terms are 00.

This does not solve every problem, but it often removes half the work before you start integrating.

Worked example: Fourier series of f(x)=xf(x)=x on (π,π)(-\pi,\pi)

Take

f(x)=xfor π<x<πf(x) = x \qquad \text{for } -\pi < x < \pi

and extend it periodically with period 2π2\pi.

This is a good first example because the function is odd. That means

a0=0,an=0a_0 = 0, \qquad a_n = 0

so only sine terms remain.

Now compute bnb_n:

bn=1πππxsin(nx)dxb_n = \frac{1}{\pi}\int_{-\pi}^{\pi} x\sin(nx)\,dx

Because xx and sin(nx)\sin(nx) are both odd, their product is even. So

bn=2π0πxsin(nx)dxb_n = \frac{2}{\pi}\int_0^{\pi} x\sin(nx)\,dx

Use integration by parts with

u=x,dv=sin(nx)dxu=x, \qquad dv=\sin(nx)\,dx

Then

du=dx,v=cos(nx)ndu=dx, \qquad v=-\frac{\cos(nx)}{n}

So

0πxsin(nx)dx=[xcos(nx)n]0π+1n0πcos(nx)dx\int_0^{\pi} x\sin(nx)\,dx = \left[-\frac{x\cos(nx)}{n}\right]_0^{\pi} + \frac{1}{n}\int_0^{\pi}\cos(nx)\,dx

The remaining cosine integral is

0πcos(nx)dx=[sin(nx)n]0π=0\int_0^{\pi}\cos(nx)\,dx = \left[\frac{\sin(nx)}{n}\right]_0^{\pi} =0

and the boundary term gives

[xcos(nx)n]0π=πcos(nπ)n=π(1)nn\left[-\frac{x\cos(nx)}{n}\right]_0^{\pi} = -\frac{\pi\cos(n\pi)}{n} = -\frac{\pi(-1)^n}{n}

Therefore

bn=2π(π(1)nn)=2(1)n+1nb_n = \frac{2}{\pi}\left(-\frac{\pi(-1)^n}{n}\right) = \frac{2(-1)^{n+1}}{n}

So the Fourier series is

x2n=1(1)n+1nsin(nx)x \sim 2\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin(nx)

or, written term by term,

x2(sinxsin(2x)2+sin(3x)3sin(4x)4+)x \sim 2\left(\sin x - \frac{\sin(2x)}{2} + \frac{\sin(3x)}{3} - \frac{\sin(4x)}{4} + \cdots\right)

This is the key idea: a function that does not look like a sine wave can still be built from sine waves if the coefficients are chosen correctly.

What a Fourier series converges to

If the periodic function is piecewise smooth, the usual textbook rule is:

  • At a point where the function is continuous, the Fourier series converges to f(x)f(x).
  • At a jump discontinuity, it converges to the midpoint
f(x)+f(x+)2\frac{f(x^-)+f(x^+)}{2}

That second rule is easy to miss. It matters whenever the periodic extension has jumps, even if the original formula on one interval looked harmless.

For the example f(x)=xf(x)=x on (π,π)(-\pi,\pi), the periodic extension jumps at x=±πx=\pm\pi, so the series converges to 00 there because the midpoint of the jump is 00.

Common Fourier series mistakes

  1. Using the 2π2\pi formulas on a problem with a different period without rescaling the sine and cosine terms.
  2. Forgetting the periodic extension. A Fourier series represents the repeating version of the function, not only the formula written on one interval.
  3. Skipping symmetry checks and doing unnecessary integrals.
  4. Dropping the normalization factor, such as 1/π1/\pi or 2/T2/T.
  5. Assuming the series equals the function value at a jump. Under the usual convergence condition, it approaches the midpoint instead.

Where Fourier series are used

Fourier series are most useful when a problem has periodic structure or periodic boundary conditions.

  • In signals and acoustics, they describe harmonics and frequency content.
  • In heat and wave problems, they help solve differential equations on bounded intervals.
  • In engineering, they approximate repeating inputs and responses.
  • In numerical work, partial sums give usable approximations even when the full function is more complicated.

Try a similar Fourier series problem

Try the same process for f(x)=x2f(x)=x^2 on (π,π)(-\pi,\pi). Start with symmetry before you integrate.

That case is useful because x2x^2 is even, so the sine terms disappear. Comparing it with f(x)=xf(x)=x makes the symmetry rule much easier to remember.

Need help with a problem?

Upload your question and get a verified, step-by-step solution in seconds.

Open GPAI Solver →