# Computing the Fourier series of $f = \cos{2x}$?

I'm currently attempting to solve the following problem:

Given the function $f$ defined on the interval $(0, \pi)$ by $f(x) = \cos{2x}$, find the $2\pi$-periodic, even extension of $f$ and compute the cosine Fourier series of $f$.

However, I seem to be having difficulty obtaining a reasonable result for this problem. Here's what I tried.

I started with the definition of the Fourier series my textbook gave me:

$$F(x) = \frac{a_0}{2} + \sum_{m=1}^\infty\left(a_m \cos{\frac{m\pi x}{L}} + b_m \sin{\frac{m\pi x}{L}} \right) \\ a_m = \frac{1}{L} \int_{-L}^L f(x) \cos{\frac{m\pi x}{L}} \mathrm{d}x \quad\quad m = 0, 1, 2, \ldots \\ b_m = \frac{1}{\pi} \int_{-L}^L f(x) \sin{\frac{m\pi x}{L}} \mathrm{d}x \quad\quad m = 1, 2, \ldots \\$$

Because $\cos{2x}$ is already an even function when I extend it to $(-\pi, \pi)$, I felt comfortable just substituting that as $f$ in directly into the given equations, and using $L = \pi$. Furthermore, because $\cos$ is an even function and $\sin$ is an odd function, $b_n$ should result in zero. Because $a_n$ is an even function, I can simplify my integral further, leaving me with the following equation:

$$F(x) = \frac{a_0}{2} + \sum_{m=1}^\infty\left(a_m \cos{mx} \right) \\ a_m = \frac{2}{\pi} \int_0^\pi \cos{2x} \cos{mx} \,\mathrm{d}x \quad\quad m = 0, 1, 2, \ldots \\$$

Finding $a_0$ turned out to be easy -- the result was just zero:

$$a_0 = \frac{2}{\pi} \int_0^\pi \cos{2x} \, \mathrm{d}x \\ a_0 = \frac{2}{\pi} \left[ \frac{1}{2}\sin{2x} \right]_0^\pi \\ a_0 = \frac{1}{\pi} (\sin{2\pi} - \sin{0}) \\ a_0 = 0 \\$$

However, I had difficulty finding $a_m$. I first tried using one of the product-to-sum trig identities. Specifically, I used $\cos{u}\cos{v} = \frac{1}{2}(\cos{(u-v)} + \cos{(u+v)})$.

$$a_m = \frac{2}{\pi} \int_0^\pi \cos{2x} \cos{mx} \,\mathrm{d}x \\ a_m = \frac{1}{\pi} \int_0^\pi \cos{((2-m)x)} + \cos{((2+m)x)} \, \mathrm{d}x \\ a_m = \frac{1}{\pi} \int_0^\pi \cos{((2-m)x)} \,\mathrm{d}x + \frac{1}{\pi}\int_0^\pi \cos{((2+m)x)} \, \mathrm{d}x \\ a_m = \frac{1}{\pi} \left( \frac{[\sin{((2-m)x)}]_0^\pi}{2-m} + \frac{[\sin{((2+m)x)}]_0^\pi}{2+m} \right) \\ a_m = \frac{1}{\pi} \left( \frac{\sin{((2-m)\pi)}}{2-m} + \frac{\sin{((2+m)\pi)}}{2+m} \right)$$

However, the problem is that it appears as if $a_m = 0$ for almost every possible value of $m$ except $m = 2$. ($m = -2$ is also undefined, but I defined $m = 0, 1, 2, \ldots$).

I then noticed that if I started off by setting $m = 2$, I could use a different trig identity. Specifically, I could use one of the half-angle formulas $\cos^2{u} = \frac{1}{2} + \frac{\cos{2u}}{2}$.

$$a_2 = \frac{2}{\pi} \int_0^\pi \cos{2x} \cos{mx} \,\mathrm{d}x \\ a_2 = \frac{2}{\pi} \int_0^\pi \cos^2{2x} \,\mathrm{d}x \\ a_2 = \frac{2}{\pi} \int_0^\pi \frac{1}{2} + \frac{\cos{4x}}{2} \,\mathrm{d}x \\ a_2 = \frac{1}{\pi} \int_0^\pi 1 + \cos{4x} \,\mathrm{d}x \\ a_2 = \frac{1}{\pi}[x]_0^\pi + \frac{1}{\pi}\left[\frac{1}{4}\sin{4x}\right]_0^\pi \\ a_2 = 1 + 0 = 1$$

So, it appears as if I've obtained:

$$a_m = \begin{cases} 0 & 0 \leq m < 2 \\ 1 & m = 2 \\ 0 & 2 < m \end{cases}$$

However, if I plug this in ($a_m = 0$ and $a_2 = 1$), then my Fourier equation simplifies down to literally $F(x) = \cos{2x}$ -- the summation disappears entirely since only the term with the coefficient of $a_2$ is non-zero.

On one hand, this makes sense -- although the Fourier series lets me represent any periodic function with an infinite combination of cosine and sine waves, it's economical to use only a single cosine if my original equation was literally just a cosine.

On the other, this seems completely wrong -- I know that $F(x)$ is supposed to equal $f(x)$, but having the two result in exactly the same equation feels bizarre, like I've gone in just one big circle. It also doesn't feel like I'm actually answering the question. If the question is asking me to find the Fourier series of $f$, it feels weird to just repeat back the original equation.

Have I misinterpreted the question, made a mathematical error, or am doing something else wrong? Or is this actually correct?

• Everything is as it should be. – mickep Feb 24 '15 at 8:21

The function $$\tilde f(x):=\cos(2x)\qquad(-\infty<x<\infty)$$ is the $2\pi$-periodic even extension of $f$, and $\cos(2x)$ is its Fourier series. Or have I missed something?