I'm asked to find the fourier series of the $2 \pi $ periodic function f(x) which is $sin(x)$ between $0$ and $\pi$ and $0$ between $\pi$ and $2\pi$

I use the complex form to proceed and get $$\frac{1}{2\pi}\int_{0}^{\pi}sin(x)e^{-ikx}dx$$. The complex coefficient $c_k$ I get as result is $\frac{-1}{\pi(k^2-1)}$ where $k=2n$ (k even) which is also correct according to WolframAlpha.

But then, I'm asked to use this result to evaluate $\sum_{n=1}^{\infty}\frac{1}{(4n^2-1)^2}$. For that, I switch to the real coefficients using $a_k=c_k+c_{-k}, b_k=i(c_k-c_{-k})$. I get: $a_k=\frac{-2}{\pi(k^2-1)}, a_0=\frac{2}{\pi}$ and $b_k$ is $0$.

So $f(x)=\frac{a_0}{2}+\sum_{k=1}^{\infty}a_kcos(kx)$

I then use Parseval's theorem to evaluate the sum we are looking for, remembering that k is even, i.e. $k=2n$ and that the function is $0$ between $\pi$ and $2\pi$:

$$\frac{1}{\pi}\int_{0}^{2\pi}|f(x)|^2 dx=\frac{a_0^2}{2}+\sum_{k=1}^{\infty}a_k^2$$ (1)

$$\frac{1}{\pi}\int_{0}^{\pi}sin^2(x)dx=\frac{\frac{2^2}{\pi^2}}{2}+\sum_{n=1}^{\infty}\frac{4}{\pi^2(4n^2-1)^2}$$ (2) $$\frac{1}{2}-\frac{2}{\pi^2}=\sum_{n=1}^{\infty}\frac{4}{\pi^2(4n^2-1)^2}$$ (3)

So finally I get$\frac{\pi^2}{8}-\frac{1}{2}=\sum_{n=1}^{\infty}\frac{1}{(4n^2-1)^2}$ (4)

However, WolframAlpha gets $\frac{\pi^2}{16}-\frac{1}{2}$ so I must somehow have forgotten a factor of $\frac{1}{2}$ or put an extra factor of $2$ by $\frac{\pi^2}{8}$.

Logically, this missing/extra factor must have happened while I was evaluating $\frac{1}{\pi}\int_{0}^{\pi}sin^2(x)dx$ because the $-\frac{1}{2}$ at the end that came from the right side of the equality is correct according to WolframAlpha. But even when I evaluate $\frac{1}{\pi}\int_{0}^{\pi}sin^2(x)dx$ in WolframAlpha, I get the $\frac{1}{2}$ from step (3) which finally becomes $\frac{\pi^2}{8}$ and again, an factor of $\frac{1}{2}$ is missing, so I'm a bit perplex about what's wrong.

Thanks for your help !

Edit: the strange thing is that when I evaluate this sum using Parseval but with the fourier series of |sin(x)| between $0$ and $2\pi$, I get the correct result.


I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,

$$ b_1 = \frac{1}{\pi} \int_0^{2\pi} f(x) \sin(x) \, dx = \frac{1}{\pi} \int_0^{\pi} \sin^2(x) \, dx = \frac{1}{2}. $$

My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $\int e^{ikx} \, dx = \frac{e^{ikx}}{ik} + C$ only when $k \neq 0$). In fact, the Fourier series of $f$ is given by

$$ \sum_{k = 1}^{\infty} \frac{2}{\pi(1-4k^2)} \cos(2kx) + \frac{1}{\pi} + \frac{1}{2} \sin(x) $$

and you'll get your missing factor from the extra $\sin$ term.

The complex coefficient $c_1$ is given by

$$ c_1 = \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{-ix} \, dx = \frac{1}{2\pi} \int_0^{\pi} \frac{e^{ix} - e^{-ix}}{2i} e^{-ix} \, dx = \frac{1}{4\pi i} \int_0^{\pi} (1 - e^{-2ix}) \ dx = \frac{1}{4\pi i} \left[x - \frac{e^{-2ix}}{-2i} \right]_{x = 0}^{x = \pi} = -\frac{1}{4}i. $$ Similarly,

$$ c_{-1} = \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{ix} \, dx = \frac{1}{2\pi} \int_0^{\pi} \frac{e^{ix} - e^{-ix}}{2i} e^{ix} \, dx = \frac{1}{4\pi i} \int_0^{\pi} (e^{2ix} - 1) \ dx = \frac{1}{4\pi i} \left[\frac{e^{2ix}}{2i} - x \right]_{x = 0}^{x = \pi} = \frac{1}{4}i. $$


$$ b_1 = i(c_1 - c_{-1}) = i(-\frac{1}{4}i - \frac{1}{4}i) = \frac{1}{2}. $$

| cite | improve this answer | |
  • 1
    $\begingroup$ @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $\frac{0}{0}$. The case $n = 1$ is special and contributes the $\sin$ term. $\endgroup$ – levap Dec 13 '18 at 21:27
  • 1
    $\begingroup$ @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit. $\endgroup$ – levap Dec 13 '18 at 21:40
  • 1
    $\begingroup$ @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work. $\endgroup$ – levap Dec 13 '18 at 22:05
  • 1
    $\begingroup$ The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real). $\endgroup$ – levap Dec 13 '18 at 22:11
  • 1
    $\begingroup$ Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening ! $\endgroup$ – Ryukyu Dec 13 '18 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.