# Transform the function $f(x) =\tan^2 x$ into Fourier series for $-\frac{\pi}{2}\leq x \leq \frac{\pi}{2}$

I am stuck with this problem. Firstly the boundaries make me worry, because I get that the integral is infinity, and while calculating $a_n$ i have to solve the integral $\int \tan^2x cos 4nx dx$ which seems impossible. Any tips on how to solve this problem?

• This post is related. Aug 11, 2017 at 13:51

The framework of Fourier-series with trigonometric basis functions only works in $L^2$, ie. the space of square integrable functions. This means that you can write a function as a Fourier-series iff its square is integrable.
However, $\tan(x)^2\notin L^2$. Take $x$ near $\frac \pi 2$: There, to the first order, $\sin x \approx 1$, and $\cos x\approx -x+\pi/2$. Therefore, locally $\tan(x)^2=\left(\frac{\sin x}{\cos x}\right)^2\approx \frac 1{(-x+\pi/2)^2}$. The singularity on the r.h.s. is obviously not square integrable, and so $\tan(x)^2$ isn't either.