Compute $\int_{0}^{\sqrt{3}}\tan^{-1}\left(\frac{3x-x^3}{1-3x^2}\right)dx$.

definite integralsintegration

I used the "not" well known formula: $$\frac{3\tan\theta-\tan^3\theta}{1-3\tan^2\theta}=\tan(3\theta)$$
So letting $x=\tan\theta$ gives me the integral:
$$\int_{0}^{\frac{\pi}{3}}3\theta\sec^2\theta d\theta=\sqrt{3}\pi-\ln(8)$$
However, according to WolframAlpha, the answer is $\frac{\pi}{\sqrt{3}}-\ln(8)$.

What did I miss??

Best Answer

The substitution you used still works, you just have to be careful with the domain.

$$I = \int_0^\frac{\pi}{3} \arctan(\tan3\theta)\sec^2\theta\,d\theta$$

$$=\int_0^\frac{\pi}{6} 3\theta\sec^2\theta\,d\theta + \int_\frac{\pi}{6}^\frac{\pi}{3}\left(3\theta-\pi\right)\sec^2\theta\,d\theta$$

$$=\sqrt{3}\pi-\log 8 -\frac{2}{\sqrt3}\pi$$