[Math] finding Fourier series of $|x\sin(x)|$

fourier series

I have this function: $f(x)=|x\sin(x)|$

Now, since this is an even function I know the $b_k \equiv 0$.

I tried calculating the $a_k$ coefficients and got
$$a_k = \frac{2(-1)^{k+1}}{k^2 – 1}$$ so what I'm not sure about is this:

  1. is this correct? I tried finding Fourier series calculator but failed…
  2. if so, what am I to do about $k=1$?

thanks in advance

Best Answer

Your answer is correct for $n \neq 1$. In order to see what happens when $n=1$, let's review the calculation.

Assuming you are defining the function on the interval $[-\pi,\pi]$ and extending periodically from there, and assuming the form $$f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}[a_n \cos(nx) + b_n \sin(nx)]$$ then, as you said, $b_n = 0$ for all $n$ because $f$ is even. The formula for $a_n$ is $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x) \cos(nx)\ dx$$ Since your $f$ is even, so is $f(x)\cos(nx)$, so we can integrate over $[0,\pi]$ and double the result: $$a_n = \frac{2}{\pi}\int_0^{\pi} f(x) \cos(nx)\ dx$$ On the interval $[0,\pi]$, we have $|x\sin(x)| = x\sin(x)$ so we can shed the absolute values when computing the integral: $$a_n = \frac{2}{\pi}\int_0^{\pi}x \sin(x)\cos(nx)\ dx$$ Using the trig identity $\sin(a)\cos(b) = \frac{1}{2}[\sin(a+b)+\sin(a-b)]$, this becomes $$a_n = \frac{1}{\pi}\left(\int_0^{\pi}x\sin((n+1)x)\ dx - \int_0^{\pi}x\sin((n-1)x)\ dx\right)$$ Note that if $n=1$, the integrand in the second integral becomes $x\sin(0x) = 0$, so only the first integral contributes to the answer in that case. The first integral doesn't have any special case to worry about, because we are only interested in $n \geq 0$.

I'll let you carry out the integration; the result for the first integral should be $$\int_0^{\pi}x\sin((n+1)x)\ dx = \frac{\pi \cos(\pi n)}{(n+1)} = \frac{\pi(-1)^{n}}{n+1}$$ and for the second integral (when $n \neq 1$): $$\int_0^{\pi}x\sin((n-1)x)\ dx = \frac{\pi \cos(\pi n)}{(n-1)} = \frac{\pi (-1)^{n}}{n-1}$$ So, for $n = 1$ we have $$a_1 = \frac{(-1)^{n}}{n+1} = \frac{-1}{2}$$ and for $n \neq 1$ we have $$a_n = \frac{(-1)^{n}}{n+1} - \frac{(-1)^{n}}{n-1} = \frac{2(-1)^{n+1}}{n^2 - 1}$$

Related Question