Problem 338
Hard Remainders and Fourier Series

Expand f(x)=x(pi-x), x in[0,pi), with period pi

Expand $f(x)=x(\pi-x)$, $x\in[0,\pi)$, with period $\pi$, in a Fourier series.

Explanation of Method

Here the period is $T=\pi$ (not $2\pi$), so the fundamental domain is a single interval of length $\pi$, and the basis frequencies are $2\pi n/T=2n$. The key subtlety is that $x(\pi-x)$ is defined only on $[0,\pi)$ and is not symmetric about the interval's midpoint in a way that would let half-interval shortcuts apply — the coefficients must be computed by integrating over the full period $[0,\pi)$ directly.

  1. Set up the coefficient formulas for period $T=\pi$: $a_n=\frac2\pi\int_0^\pi f(x)\cos(2nx)\,dx$, similarly for $b_n$.
  2. Compute $a_0$ and $a_n$ by direct integration by parts over the full period.
  3. Compute $b_n$ and show it vanishes.

Step 1 · Setup

With period $T=\pi=2l$ (so $l=\pi/2$), the Fourier series is $f(x)=\frac{a_0}2+\sum_{n\ge1}[a_n\cos(2nx)+b_n\sin(2nx)]$, with coefficients computed as averages over one full period, $$ a_n = \frac2\pi\int_0^\pi f(x)\cos(2nx)\,dx, \qquad b_n = \frac2\pi\int_0^\pi f(x)\sin(2nx)\,dx. $$

Step 2 · Computing $a_0$ and $a_n$

$$ a_0 = \frac2\pi\int_0^\pi x(\pi-x)\,dx = \frac2\pi\left[\frac{\pi x^2}2-\frac{x^3}3\right]_0^\pi = \frac2\pi\cdot\frac{\pi^3}6 = \frac{\pi^2}3. $$ For $a_n$, integrating $x(\pi-x)\cos(2nx)$ by parts twice over the full period $[0,\pi]$ (using $\sin(2n\pi)=0$, $\cos(2n\pi)=1$ at both endpoints): $$ a_n = -\frac1{n^2}, \qquad\text{for every } n\ge1 \text{ (both even and odd)}. $$ (Verified symbolically and numerically: direct computation gives $a_1=-1$, $a_2=-\frac14$, $a_3=-\frac19$, $a_4=-\frac1{16}$ — confirming the coefficient is simply $-1/n^2$ for all $n$, with no odd/even distinction. An earlier attempt that integrated only over the half-interval $[0,\pi/2]$ and doubled the result — valid only for functions symmetric about the interval's midpoint — gave the wrong, parity-dependent answer and has been discarded.)

Step 3 · Computing $b_n$

Similarly, integrating $x(\pi-x)\sin(2nx)$ by parts twice over $[0,\pi]$, the boundary and interior terms cancel exactly: $$ b_n = 0 \quad\text{for every } n\ge1. $$ (Verified: direct numerical integration gives $b_n\approx0$ to machine precision for $n=1,\ldots,5$.)

Step 4 · Fourier series

$$ \boxed{x(\pi-x) = \frac{\pi^2}6 - \sum_{n=1}^\infty\frac{\cos(2nx)}{n^2}} $$ (Verified numerically at several points, e.g. $x=1.5$: series partial sum to $2000$ terms $\approx2.46239$, matching $f(1.5)=1.5(\pi-1.5)\approx2.46239$ exactly.)


Summary Table

PropertyValue
Period$\pi$ (so basis is $\cos(2nx),\sin(2nx)$)
$a_0$$\pi^2/3$
$a_n$$-1/n^2$ (all $n$)
$b_n$$0$ (all $n$)

Additional Notes

Result

$$ x(\pi-x) = \frac{\pi^2}6 - \sum_{n=1}^\infty\frac{\cos(2nx)}{n^2}, \qquad x\in[0,\pi), \text{ period } \pi. $$