Ma · Mathematics

Even and Odd Fourier Series for f(x) = π − x on (0, π)

Published By the 9to5Science editorial team

At a glance

  1. 1. Choose an extension

    For a half-range expansion, extend the function evenly for a cosine series or oddly for a sine series.

  2. 2. Compute coefficients

    Use the half-range coefficient integrals on zero to pi and simplify separately for even and odd indices.

  3. 3. Write each series

    The even extension gives a cosine series with only odd harmonics; the odd extension gives all sine harmonics.

  4. 4. Check convergence

    On the interval, both series equal the function; at jumps, a Fourier series converges to the midpoint of its one-sided limits.

For a function specified only on 0<x<π0<x<\pi, “the even and odd Fourier series” usually means its two half-range expansions. The cosine series comes from reflecting the function evenly across x=0x=0; the sine series comes from reflecting it oddly. The coefficients—and the periodic functions represented—are therefore different.

For f(x)=π−xf(x)=\pi-x, the even extension produces a cosine series with only odd-indexed cosine terms. The odd extension produces a sine series with every positive integer frequency. Both equal π−x\pi-x at each point strictly inside the original interval.

Half-range coefficient formulas

A cosine half-range expansion on (0,π)(0,\pi) has the form

f(x)∼a02+∑n=1∞ancos⁡(nx),f(x)\sim \frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos(nx),

where

a0=2π∫0πf(x) dx,an=2π∫0πf(x)cos⁡(nx) dx.a_0=\frac{2}{\pi}\int_0^\pi f(x)\,dx, \qquad a_n=\frac{2}{\pi}\int_0^\pi f(x)\cos(nx)\,dx.

A sine half-range expansion has the form

f(x)∼∑n=1∞bnsin⁡(nx),bn=2π∫0πf(x)sin⁡(nx) dx.f(x)\sim\sum_{n=1}^{\infty}b_n\sin(nx), \qquad b_n=\frac{2}{\pi}\int_0^\pi f(x)\sin(nx)\,dx.

The factor 2/π2/\pi is the half-range normalization for an interval of length π\pi. The constant term in the cosine series is a0/2a_0/2, not a0a_0.

Even extension: cosine series

First calculate the constant coefficient:

a0=2π∫0π(π−x) dx=2π[πx−x22]0π=π.\begin{aligned} a_0&=\frac{2}{\pi}\int_0^\pi(\pi-x)\,dx\\ &=\frac{2}{\pi}\left[\pi x-\frac{x^2}{2}\right]_0^\pi =\pi. \end{aligned}

For n≥1n\ge 1, integration by parts gives

an=2π∫0π(π−x)cos⁡(nx) dx=2π1−cos⁡(nπ)n2=2(1−(−1)n)πn2.\begin{aligned} a_n&=\frac{2}{\pi}\int_0^\pi(\pi-x)\cos(nx)\,dx\\ &=\frac{2}{\pi}\frac{1-\cos(n\pi)}{n^2}\\ &=\frac{2\bigl(1-(-1)^n\bigr)}{\pi n^2}. \end{aligned}

If nn is even, this coefficient is zero. If nn is odd, it is 4/(πn2)4/(\pi n^2). Thus the cosine expansion is

π−x=π2+4π(cos⁡x+cos⁡3x32+cos⁡5x52+⋯ ),0<x<π.\boxed{\pi-x=\frac{\pi}{2}+\frac{4}{\pi}\left(\cos x+\frac{\cos 3x}{3^2}+\frac{\cos 5x}{5^2}+\cdots\right),\quad 0<x<\pi.}

Equivalently, the sum can be written as π2+4π∑k=0∞cos⁡((2k+1)x)(2k+1)2\frac{\pi}{2}+\frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\cos((2k+1)x)}{(2k+1)^2}.

This series represents the even periodic extension, which on [−π,π][-\pi,\pi] is π−∣x∣\pi-|x|. It is continuous at the endpoints when repeated with period 2π2\pi, and its cosine coefficients decay as 1/n21/n^2.

Odd extension: sine series

For the sine coefficients,

bn=2π∫0π(π−x)sin⁡(nx) dx=2π(π(1−(−1)n)n+π(−1)nn)=2n.\begin{aligned} b_n&=\frac{2}{\pi}\int_0^\pi(\pi-x)\sin(nx)\,dx\\ &=\frac{2}{\pi}\left(\frac{\pi(1-(-1)^n)}{n}+\frac{\pi(-1)^n}{n}\right)\\ &=\frac{2}{n}. \end{aligned}

So the odd half-range expansion is

π−x=2(sin⁡x+sin⁡2x2+sin⁡3x3+⋯ ),0<x<π.\boxed{\pi-x=2\left(\sin x+\frac{\sin 2x}{2}+\frac{\sin 3x}{3}+\cdots\right),\quad 0<x<\pi.}

Here the odd periodic extension on (−π,π)(-\pi,\pi) equals π−x\pi-x for positive xx and −π−x-\pi-x for negative xx. It has a jump at x=0x=0, which explains why its sine coefficients decrease only as 1/n1/n.

A quick check at x=π/2x=\pi/2

The function value is f(π/2)=π/2f(\pi/2)=\pi/2. In the cosine series, every term vanishes because cos⁡((2k+1)π/2)=0\cos((2k+1)\pi/2)=0, leaving π/2\pi/2. In the sine series, the even-indexed terms vanish and the odd-indexed terms alternate:

2(1−13+15−17+⋯ )=π2,2\left(1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots\right)=\frac{\pi}{2},

by the alternating arctangent series. The two expansions agree with the function, despite having different terms and convergence behavior.

Convergence and endpoint values

On every point 0<x<π0<x<\pi, both Fourier series converge to π−x\pi-x. The cosine series also converges to the even extension’s endpoint values: at x=0x=0 it gives π\pi, and at x=πx=\pi it gives 00.

For the odd extension, the periodic function jumps at x=0x=0. A Fourier series at a jump converges to the average of the left- and right-hand limits, so the sine series has value 00 there—not π\pi. At x=πx=\pi, the periodic odd extension is continuous with value 00, and the series converges to 00.

Common mistakes

  • Using the full-range coefficient factor: For these half-range formulas, use 2/π2/\pi in the integrals, not 1/π1/\pi.
  • Forgetting the half in the constant term: The cosine series begins with a0/2=π/2a_0/2=\pi/2.
  • Dropping parity-dependent terms incorrectly: In the cosine series, even indices vanish and odd indices remain. In the sine series, every coefficient is 2/n2/n.
  • Treating the extensions as identical: A cosine series and a sine series represent different periodic extensions; they happen to match the original function on (0,π)(0,\pi).
  • Assuming the sine series equals the endpoint value of the original formula: At x=0x=0, its value is determined by the odd extension’s jump and is the midpoint, 00.

References

  1. Fourier Series and Boundary Value Problems — James Ward Brown and Ruel V. Churchill

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.