# Using Fourier series to calculate infinite series.

I am asked to devolop the function $$f(x)=x^2$$ in a series of sine and cosine (Fourier series) in the interval $$[\frac{-1}{2},\frac{1}{2}]$$. And use one of these series to calculate $$\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}\hspace{0.5cm} \text{ and }\hspace{0.5cm} \sum_{n=1}^{\infty} \frac{1}{n^2}$$

Now, the Fourier series is

$$S(f)(x)=a_0+2\sum_{n=1}^{\infty}a_n \cos(2\pi nx)+2\sum_{n=1}^{\infty}b_n \sin(2\pi nx)$$

Since $$f(x)=x^2$$ is even, $$b_n=0$$. I understand this means that I have to use the cosine series the infinite series.

Using $$a_0=\int_{0}^{1} f(x) \,\text{d}x$$ and $$a_n=\int_{0}^{1} f(x) \cos(2\pi nx) \,\text{d}x$$

I got that $$S(f)(x)=\frac{1}{12}+2\sum_{n=1}^{\infty}\frac{(-1)^n}{\pi^2n^2}\cos(2\pi nx)$$

Now, how can I calculate the initial series?

• plugging in a convenient value for $x$ is a good start Jan 30, 2018 at 19:53
• I think the Fourier series converges to the initial function, since $x^2$ is continuous in all of $\mathbb{R}$, therefore $x=S(f)(x)$. Then, if I plug in $x=0$, I will have $0=\frac{1}{12}+2\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}$. This would mean that $\frac{2}{12}=\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2}$. Is this correct? I am not sure since I know that $\sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6}$ (I know it from another problem) Jan 30, 2018 at 20:04
• that computation doesn't look right, you dropped a sign and a $\pi^2$. Also I don't believe there should be a 2 Jan 30, 2018 at 20:10
• Also why are you integrating on the interval $[0,1]$? Jan 30, 2018 at 20:16
• If you shift the integral like this, you will phase shift all of your trig functions along with it. Jan 30, 2018 at 20:27

The function $$x^2$$ is an even function in the given interval, $$[\frac{-1}{2},\frac{1}{2}]$$, thus the sine terms will vanish.
I calculated the Fourier series to be: $$f(x)=x^2=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}cos({2\pi}nx)}$$ NOTE: There is a mistake in your equation above where you multiplied the summation by 2.
1. In solving for $$\sum_{n=1}^\infty {\frac{(-1)^{n+1}}{n^2}}$$: Let $$x=0$$. The Fourier series becomes: $$f(0)=(0)^2=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}cos({2\pi}n{0})}$$ Simplifying: $$0=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}cos(0)} = \frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}}$$ Multiplying by $$-1$$ gives: $$0=-\frac{1}{12}-\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}} = -\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^{n+1}}{\pi^2n^2}}$$ Simplifying further: $$\sum_{n=1}^\infty {\frac{(-1)^{n+1}}{\pi^2n^2}}=\frac{1}{12}$$ Finally, multiplying throughout by $$\pi^2$$ gives: $$\sum_{n=1}^\infty {\frac{(-1)^{n+1}}{n^2}}=\frac{\pi^2}{12}$$
2. In solving for $$\sum_{n=1}^\infty {\frac{1}{n^2}}$$: If we substitute for $$x=\frac{1}{2}$$, the Fourier series gives:
$$f(\frac{1}{2})=(\frac{1}{2})^2=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}cos({2\pi}n\frac{1}{2})}$$ Simplifying: $$\frac{1}{4}=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}cos(n\pi)} = \frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}(-1)^n}$$ But $$\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^n}{\pi^2n^2}(-1)^n}=\frac{1}{12}+\sum_{n=1}^\infty {\frac{(-1)^{2n}}{\pi^2n^2}}=\frac{1}{12}+\sum_{n=1}^\infty {\frac{1}{\pi^2n^2}}$$ Therefore $$\frac{1}{4}=\frac{1}{12}+\sum_{n=1}^\infty {\frac{1}{\pi^2n^2}}$$ Again simplifying gives: $$\frac{1}{6}=\sum_{n=1}^\infty {\frac{1}{\pi^2n^2}}$$ And finally, multiplying both sides by $$\pi^2$$ gives: $$\frac{\pi^2}{6}=\sum_{n=1}^\infty {\frac{1}{n^2}}$$