Another fun sum

Do problem #3 on page 153, which asks us to compute the alternating sum of the reciprocals of the squares:

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

Comments

  • AbSAbS
    edited March 2021

    The full Fourier series for $f(x)=x^2$ on $[-\pi,\pi]$ is

    $$\frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos(nx)+b_n\sin(nx)\right),$$

    where

    $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}x^2\cos(nx)dx$$

    and

    $$b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}x^2\sin(nx)dx.$$

    First, we find $\frac{a_0}{2}$, taking advantage of the fact that for an even function $g(x)$,

    $$\int_{-L}^{L}g(x)dx = 2\int_{0}^{L}g(x)dx$$:

    $$\frac{a_0}{2} = \frac{1}{2\pi}\int_{-\pi}^{\pi}x^2dx = \frac{1}{\pi}\int_{0}^{\pi}x^2dx = \left[\frac{x^3}{3\pi}\right]_0^{\pi} = \frac{\pi^2}{3}.$$

    Now we find $a_n,$ similarly taking advantage of the fact that $x^2cos(nx)$, as the product of two even functions, is even:

    $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}x^2\cos(nx)dx = \frac{2}{\pi}\int_{0}^{\pi}x^2\cos(nx)dx.$$

    We solve this integral by parts, setting $u=x^2$, $du=2xdx$, $v=\frac{\sin(nx)}{n}$, and $dv=\cos(nx)dx$:

    $$ \frac{2}{\pi}\int_{0}^{\pi}x^2\cos(nx)dx = \frac{2}{n\pi}\left(\left[x^2\sin(nx)\right]_0^{\pi} - 2\int_{0}^{\pi}x\sin(nx)dx\right) = -\frac{4}{n\pi}\int_0^{\pi}x\sin(nx)dx.$$

    Here we integrate by parts again, setting $u=x$, $du=dx$, $v=-\frac{\cos(nx)}{n}$, and $dv=\sin(nx)$:

    $$-\frac{4}{n\pi}\int_0^{\pi}x\sin(nx)dx = \frac{4}{\pi n^2}\left(\left[x\cos(nx)\right]_0^{\pi} - \int_0^{\pi}\cos(nx)dx\right) = \frac{4}{\pi n^2}\left(\pi\cos(nx)-0\right) = \frac{4(-1)^n}{n^2}.$$

    Therefore,

    $$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}x^2\cos(nx)dx = \frac{4(-1)^n}{n^2}.$$

    Finally, since the product of an even function and an odd function is odd, and for an odd function $h(x),$

    $$\int_{-L}^Lh(x)dx = 0,$$

    we can conclude that

    $$b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}x^2\sin(nx)dx = 0.$$

    So the Fourier series for $x^2$ on $[-\pi,\pi]$ is

    $$x^2 = \frac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\cos(nx).$$

    Setting $x=0$:

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

    so

    $$\frac{\pi^2}{3} = -4\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2} = 4\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2}.$$

    Dividing both sides by 4:

    $$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2} = \frac{\pi^2}{12}.$$

Sign In or Register to comment.