Calculating Fourier series of $\cos^2(t)$ gives unexpected result

1.1k Views Asked by At

As I understand it:

$\cos^2(t)$ is even because it is a product of two even functions $\cos(t)$.

The Fourier series and Fourier cosine series of an even function is the same link.

So in the fourier series expansion $\cos^2(t)={a_0 \over 2}+\sum_{n=1}^\infty(a_n\cos(n \omega t) + b_n \sin(n \omega t))$, I expect $a_n\neq 0$ and $b_n=0$.

I try to get the the coefficients with wolfram alpha like this:

$a_n$ with FourierCosCoefficient[$\cos(t)^2,t,n$] gives zero link

$b_n$ with FourierSinCoefficient[$\cos(t)^2,t,n$] gives non-zero link

Which of my assumptions are wrong?

(I also got $a_n=0$ when calculating by hand so the question is not primarily about wolfram alpha but about the relation between Fourier series, Fourier cosine series, and even functions)

3

There are 3 best solutions below

2
On

It is clear that, for each $n\in\mathbb N$,$$\int_{-\pi}^\pi\cos^2(t)\sin(nt)\,\mathrm dt=0,$$since $t\mapsto\cos^2(t)\sin(nt)$ is an odd function.

On the other hand,$$a_0=\frac1\pi\int_{-\pi}^\pi\cos^2(t)\,\mathrm dt=1\neq0.$$It turns out that $a_1=0$, but $a_2=\frac12\neq0$.

1
On

The simplest way to find the Fourier series of this function is to write it as $\frac {1+\cos(2t)} 2$. This expression is in fact the Fourier series!.

1
On

Just read the documentation: https://reference.wolfram.com/language/ref/FourierSinCoefficient.html

The command FourierSinCoefficient does not compute the coefficients $b_n$ in the full Fourier series, but the coefficients in the Fourier sine series (= the full Fourier series of the odd extension of the function in question).