I am trying to solve the integral:

$\displaystyle \int\frac{tan{^2}(x)}{1 + 2tan{^2}x} dx$

This is what I did:

$\displaystyle u = tan(x)$

$\displaystyle x = arctan(u)$

$\displaystyle dx = (1+u^2) du$

So that the integral is:

$\displaystyle \int\frac{u{^2}(1+u^2)}{1 + 2u{^2}} du$

Then I did polynomial division, and got that:

$\displaystyle \int\frac{u{^2}(1+u^2)}{1 + 2u{^2}} du$ =

$\displaystyle \int\frac{1}{2}u^2 + \frac{1}{4} -\frac{1}{4}\frac{1}{2u^2+1} du$

But the according to Wolfram, the answer that I should have got from the integral I started solving, is not the same as the answer to this new integral.

What mistake did I do?