TITLE: Fourier representation for $\tan(x)$
QUESTION [5 upvotes]: Q: Which Fourier representation is suitable for $f(x) = \tan(x)$: Fourier trigonometric series, Fourier half-range expansion, or Fourier integral and why?
Well I searched and found that:
$\tan(x)$ cannot be expanded as a Fourier series since $\tan(x)$ not satisfies Dirichlet’s.
Isn't there any Fourier representation for $\tan(x)$?
Thanks ^_^

REPLY [6 votes]: In terms of generalized functions, there is a Fourier series for $\tan(x)$ on $(-\pi/2,\pi/2)$.  To see this, we proceed as follows.  
Let $f(x)=\tan(x)$ and let $F(x)\equiv \int_0^x f(t)\,dt$ for $0 \le x< \pi/2$ be an antiderivative of $f(x)$ on $[0,\pi/2)$.  Clearly, we have $F(x)=-\log(\cos(x))$.
Next, note that we can write
$$\begin{align}
\log(\cos(x))&=\log(e^{ix}+e^{-ix})-\log(2)\\\\
&=\log(1+e^{i2x})-\log(2)-ix\\\\
&=\sum_{n=1}^\infty \frac{(-1)^{n-1}e^{i2nx}}{n}-\log(2)-ix
\tag1
\end{align}$$
which after taking the real part of $(1)$ reveals
$$\int_0^x \tan(t)\,dt= -\sum_{n=1}^\infty \frac{(-1)^{n-1} \cos(2nx)}{n}\tag2$$
If we formally differentiate both sides of $(2)$ with respect to $x$, we arrive at the relationship
$$\tan(x)=2\sum_{n=1}^\infty (-1)^{n-1}\sin(2nx)\tag3$$
which is obviously incorrect in the context of real analysis since the series on the right-hand side of $(3)$ diverges for $x\in (0,\pi/2)$.  
We can assign, however, a meaning to $(3)$ in the context of generalized functions.  Recall that for any suitable test function $\phi$ that has compact support on $[0,\pi/2]$, we have 
$$\begin{align}
\int_0^{\pi/2} F(x)\phi'(x)\,dx&=-\int_0^{\pi/2}\tan(x)\phi(x)\,dx\\\\
&=-\int_0^{\pi/2} \sum_{n=1}\frac{(-1)^{n-1}}{n}\cos(2nx)\phi'(x)\,dx\\\\
&=-\sum_{n=1}\frac{(-1)^{n-1}}{n} \int_0^{\pi/2} \cos(2nx)\phi'(x)\,dx\\\\
&=-2\sum_{n=1}^{\infty}(-1)^{n-1}\int_0^{\pi/2} \sin(2nx)\phi(x)\,dx
\end{align}$$
Then, in distribution we can write
$$\tan(x)\sim 2\sum_{n=1}^\infty (-1)^{n-1}\sin(2nx)\tag4$$
where we interpret $(4)$ for to mean that for any suitable test function with compact support on $[0,\pi/2]$, we have 
$$\int_0^{\pi/2}\tan(x)\phi(x)\,dx=2\sum_{n=1}^\infty (-1)^{n-1}\int_0^{\pi/2}\sin(2nx)\phi(x)\,dx\tag 5$$
for $x\in[0,\pi/2)$
Finally, exploiting the symmetry and periodicity we see that $(5)$ holds for all periodic test functions that vanish at odd integral multiples of $\pi/2$.