I am trying to integrate $\int \tan^2 x \ dx $ without the use of trig identities, although I know that using $ 1 + \tan^2 x \equiv \sec^2 x $ makes the question trivial.
Using the exponential form of tan(x) I arrived at
$$ -\int \dfrac{(e^{2ix}-1)^2}{(e^{2ix}+1)^2} \ dx $$
I have not studied complex integration, so I am wary of using substitutions of such as $ u = e^{2ix} + 1 $ because I do not know if they are valid.
Taking a look here would be great.
Note that $$\tan^2 x=\sum_{n=1}^{\infty}\frac{t_{n+1}}{(2n)!}x^{2n},$$ with $t_n$ being tangent numbers and defined as $\displaystyle t_n=\frac{2^{2n}(2^{2n}-1)|B_{2n}|}{2n}, n=1,2,...$. Therefore \begin{align} \int \tan^2x dx&=\sum_{n=1}^{\infty}\frac{t_{n+1}}{(2n)!}\int x^{2n}dx\\ &=\sum_{n=1}^{\infty}\frac{t_{n+1}}{(2n)!}\frac{x^{2n+1}}{2n+1}dx\\ &=\sum_{n=1}^{\infty}\frac{t_{n}}{(2n-1)!}x^{2n-1}dx-t_1 x\\ &=\sum_{n=1}^{\infty}\frac{t_{n}}{(2n-1)!}x^{2n-1}dx- x\\ &=\tan x -x \end{align}