Strange Fourier series with all coefficients being null

fourier seriessequences-and-series

I needed to calculate the Fourier series expansion of the function
$$
f(x) = \sin(x)\cos(x)\ ,
$$

so I started computing the coefficients of the series
$$
f(x) = A_0 + \sum_{n=1}^\infty A_n\cos(nx) + B_n\sin(nx)\ .
$$

The $A_0$ and $A_n$ coefficients became zero because of the parity of the function $f(x)$, so only the $B_n$ coefficients should survive. However, I got surprised when entering the following integral into the Maple software,
$$
B_n = \dfrac{1}{\pi} \int_{-\pi}^\pi \sin(x)\cos(x)\sin(nx)\ dx\ ,
$$

which returned the result
$$
B_n = \dfrac{2\sin(n\pi)}{\pi(n^2-4)}\ ,
$$

that seems to be always null since $\sin(n\pi) = 0$ when $n\in\mathbb{N}$.

This would mean that all the coefficients of the series are zero, obviously not matching with the original behaviour of $f(x)$. Where did I make a mistake? What is happening here?

Best Answer

Note that $B_n$ is undefined when $n=2$ (a zero appears in the denominator), so you have to calculate that separately. Then

$$B_2 = \frac 1 \pi \int_{-\pi}^\pi \sin(x)\cos(x)\sin(2x) \, \mathrm{d}x$$

You can show that $B_2 = 1/2$. Then you have a single-term Fourier series showing that

$$\sin(x)\cos(x) = \frac 1 2 \sin(2x)$$