# Why does this Fourier series have a finite number of terms?

I am learning about Fourier series in class and the basic form of a Fourier Series is

$$a_{0}+\sum_{n=1}^{\infty} [a_{n}\cos(nx)+b_{n}\sin(nx)]$$

so a fourier series should have an infinity number of terms.

I was reading the book and it says that the fourier series of $\cos^{2}(3x)$ is $\frac{1}{2}+\frac{1}{2}\cos(6x)$. I am assuming the $\frac{1}{2}$ is the $a_{0}$ term. If this is the fourier series, why does it not have an infiniti number of terms like the form above? Why does it only stop at one term after the $\frac{1}{2}$ term?

-
A Fourier series, though represented as an infinite sum, doesn’t necessarily have to contain infinitely many non-zero coefficients. It can be that only a finite number of coefficients are non-zero. –  Haskell Curry Jan 25 '13 at 7:10
Any finite sum is a (somewhat trivial) special case of a series. –  Jyrki Lahtonen Feb 23 '13 at 14:48
The FT of sin($x$) has only a single nonzero coefficient. –  alancalvitti Feb 23 '13 at 15:12

Well, you can still think of it as having an infinite number of terms, just that most terms are zero.

For a similar example, consider the Taylor series of $1 + x + x^2$. Since everything past the second derivative is zero, all the coefficients of terms with power greater than $2$ are zero, so the series expansion is just the function itself. A similar thing is happening with the Fourier transform: $\cos^2(3x)$ is orthogonal to the terms whose coefficients are not $a_0$ and $a_6$, so their contribution to the Fourier decomposition is zero.

-

It doesn't stop. They are just all zero. $a_n = 0$. So you can write $\frac{1}{2} + \frac{1}{2}cos(6x) + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 \dots$ if you want.

-
I wonder if $\tfrac12 + 0 + 0 + 0 + 0 + 0 + \tfrac12 \cos(6x) + 0 + 0 + 0 + \cdots$ gets the point across better. OP also sounds slightly uncertain about sigma notation. –  Erick Wong Jan 25 '13 at 13:15

One 'practical' reason could be, that the function, you are trying to approximate using a sinusoidal series is itself a sinusoidal function. So it is not an approximation but an exact description. cos^2 3x = 1/2 + cos 6x/2 (using the trig identity).

The same thing happens with polynomial functions, when you try to approximate them with Taylor series. (Taylor series approximation is nothing but, trying to approximate a function using a polynomial.)

-

Let's say you want to expand a function $f$ using whatever basis functions (call them $b_n$). Then if your $f$ is already a linear combination of a finite number of $f_n$'s you expansion will be finite too. It works both ways. Finite linear combination means finite expansion and finite expansion means finite linear combination.

In the case of fourier series, the basis functions are sines and cosines. Since you are getting only a finite expansion, then your function is made up of a bunch of (finite number of) sines and cosines. It doesn't matter what it may "look" like.

Same thing happens with Taylor expansion. When using Taylor expansions, the basis functions are $1,x,x^2,x^3,x^4,...$ so if a function had a finite Taylor expansion then it itself must be a polynomial. And its true, polynomials (and only polynomials) have a finite Taylor expansion. Just for giggles, try $f(x)=\cos(3\arccos(x))$. You will see that it has a finite Taylor expansion and hence it is a polynomial.

-

A related problem. Notice that, $b_n=0$, since the integrand $\sin(nx)\cos^{2}(3x)$ is an odd function on the interval $[-\pi,\pi]$. For $a_n$, we have

$$a_n = \frac{2}{\pi}\,{\frac {\sin \left( \pi \,n \right) \left( {n}^{2}-18 \right) }{n \left( {n}^{2}-36 \right) }}.$$

From the above, you can see that $a_n=0,\forall n\neq 6$. To Find $a_6$, just take the limit of the above expression as $n \to 6.$

See here for formulas for $a_n$ and $b_n$.

-
$\lim\limits_{n\to0}a_n=1$ –  robjohn Jun 3 '13 at 22:55

Because your function is actually a finite linear combination of terms like those appearing in Fourier series. There is no magic involved: if you compute all coefficients you will find that most are zero. The series has infinitely many terms, but all but a finite number of them vanish.

For a simpler example, try to find the Fourier series of $\cos(17x)$.

-

The fourier decomposition of the function $$f(x) = a_{0}+\sum_{n=1}^{\infty} [a_{n}\cos(nx)+b_{n}\sin(nx)]$$ is just the original function $$a_{0}+\sum_{n=1}^{\infty} [a_{n}\cos(nx)+b_{n}\sin(nx)].$$

If the sequences $a_n$, $b_n$ are always zero after finitely many nonzero terms then you will have a finite decomposition, exactly as in your example.

Functions of this type are called "trigonometric polynomials".

-