5

This is my first step with Fourier series and I'm stuck at the beginning. So my solution:

The function $f(x)=\cos^2x$ is an even function. Thus I use formulas:

$a_0 = \frac{2}{\pi} \int _0 ^\pi \cos^2x\,\text dx$ (1)

$a_n = \frac{2}{\pi}\int _0^\pi \cos^2x \cos nx\,\text dx$ (2)

My solution of the first one:

$$a_0 = \frac{2}{\pi} \int _0 ^\pi \cos^2x\,\text dx = \frac{1}{\pi} \int _0 ^\pi(1 + \cos2x)\,\text dx = \left.\frac {1}{\pi} \left(x + \frac{1}{2}\sin2x\right) \right|_0^\pi = 1$$

With the second part I have a problem:

$$a_n = \frac{2}{\pi} \int _0 ^\pi \cos^2x \cos nx\,\text dx = \frac{1}{\pi} \int _0 ^\pi (\cos nx + \cos 2x \cos nx)\,\text dx= \frac{1}{\pi}\int _0^\pi (\cos nx + \frac{1}{2}(\cos (n+2)x + \cos (n-2)x))\,\text dx =\left. \frac{1}{\pi} \left(\frac {\sin nx}{n} + \frac {\sin(n+2)x}{2(n+2)} + \frac {\sin(n-2)x}{2(n-2)}\right)\right|_0^\pi = 0 $$

It doesn't look like $0$ is the right answer. Furthermore I'm suspicious of $(n-2)$ in the denominator it seems there isn't $a_2$ in the series.

abiessu
  • 8,115
flipback
  • 411
  • 9
    It may simplify things to recognize that $$\cos^2 x = \frac{1}{2} + \frac{1}{2}\cos(2x)$$ is a Fourier series representation of $\cos^2 x$. –  Apr 21 '15 at 02:59
  • 4
    If you want to use the brute-force integral calculation as you are doing, note that your final expression is incorrect if $n=2$ or $n=-2$. (You are essentially saying that $\int \cos(0x) = \sin(0x)/0$ in those cases.) You have to handle these cases separately. –  Apr 21 '15 at 03:07
  • If $n=2$, what is the integral of $\cos ((n-2)x)$? – Mark Viola Apr 21 '15 at 04:05

1 Answers1

6

Thanks Bungo's comment, I've found the solution.

As I've showed above I have $a_0=1$ and $a_n=0$ for $n \neq 2$. So I need to find $a_2$ to solve my problem:

$$ a_2 = \frac{2}{\pi}\int _0^\pi \cos^2 x \cos2x \,\text dx = \frac{1}{2}$$

Thus I have this Fourier series, that is equal to a famous trigonometrical formula:

$$ \cos^2x = \frac{1}{2} + \frac{1}{2} \cos2x $$

flipback
  • 411