[Math] Fourier Series of a piecewise-linear function

fourier series

One is asked to determine the Fourier series of the function

$$
f(x)=
\left\{\matrix{
0 & \hbox{(for $-\pi\le x<0$)}
\cr
x & \hbox{(for $0\le x<\pi $)}
}\right.
$$
where $f(x+2\pi)$ = $f(x)$. Hence calculate the value of the infinite sum

$$\sum_{n=1}^\infty\frac{1}{(2n-1)^2}$$

For the coefficients,
$A_0$ = $\frac{1}{2\pi}$$\int_{-\pi}^{+\pi}f(x)dx$ = $\frac{1}{2\pi}$[$\int_{-\pi}^0$$f(x)dx$ + $\int_0^{\pi}$$f(x)dx$]

$A_n$ = $\frac{1}{\pi}$$\int_{-\pi}^{+\pi}$$f(x)cos\frac{nx\pi}{\pi}dx$

I know that need to plug in x=0 to f(x) but can not get the fourier series f,from this kinda stuck how to proceed any help will be appriciated

Best Answer

We presume the following form for the Fourier series of $f$: $$\frac{a_0}{2} + \sum_{n=1}^{\infty}a_n \cos(nx) + \sum_{n=1}^{\infty}b_n \sin(nx)$$ where $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x) \cos(nx) dx$$ We intend to evaluate the Fourier series only at $x=0$, so we do not care about the $b_n$ coefficients because $\sin(nx) = 0$ when $x=0$. As $$f(x) = \begin{cases} 0 & \text{if } -\pi \leq x < 0 \\ x & \text{if } 0 \leq x < \pi \\ \end{cases}$$ we have $$a_n = \frac{1}{\pi}\int_0^{\pi}x\cos(nx) dx$$ For $n = 0$, this becomes $$a_0 = \frac{1}{\pi}\int_0^{\pi}x dx = \frac{1}{2\pi}(\pi^2 - 0) = \frac{\pi}{2}$$ For $n \neq 0$, we can use integration by parts, with $u = x$ and $dv = \cos(nx) dx$: $$\begin{aligned} \pi a_n &= \left.\frac{1}{n}x\sin(nx)\right|_{0}^{\pi} - \frac{1}{n}\int_0^{\pi}\sin(nx) dx \\ &= \frac{\pi}{n} \sin(n\pi) + \frac{1}{n^2}(\cos(n\pi) - 1) \\ &= \frac{1}{n^2}(\cos(n\pi) - 1) \end{aligned}$$ where we have used that $\sin(n\pi) = 0$ when $n$ is an integer.

For even $n$, we have $\cos(n\pi) = 1$, so $$a_n = \frac{1}{\pi n^2}(1 - 1) = 0$$ For odd $n$, we have $\cos(n\pi) = -1$, so $$a_n = \frac{1}{\pi n^2}(-1 - 1) = -\frac{2}{\pi n^2}$$ This means that the Fourier series for $f$ is (ignoring the sine terms) $$\begin{aligned} \frac{a_0}{2} + \sum_{n=1}^{\infty}a_n \cos(nx) &= \frac{\pi}{4} + \sum_{m=1}^{\infty}a_{2m-1} \cos((2m-1)x) \\ &= \frac{\pi}{4} - \sum_{m=1}^{\infty}\frac{2}{\pi(2m-1)^2}\cos((2m-1)x) \\ \end{aligned}$$ Plugging in $x=0$, we have $\cos((2m-1)0) = 1$ for all $m$, so we end up with $$0 = f(0) = \frac{\pi}{4} - \sum_{m=1}^{\infty}\frac{2}{\pi(2m-1)^2}$$ assuming we can justify that the Fourier series converges to the original function at $x=0$ (e.g. this is true because $f$ is continuous and has bounded variation). This allows us to conclude that $$\sum_{m=1}^{\infty}\frac{2}{(2m-1)^2} = \frac{\pi^2}{4}$$

Related Question