Evaluate $\int\frac{3\cot3x-\cot x}{\tan x-3\tan3x}\,dx$

Solution 1:

$\int{\tan x/\tan(3x)}dx=\int{(1-3\tan^2x)/(3-\tan^2x)}dx$

Now, we express the numerator as $3-\tan^2x-2(1+\tan^2x)$ so that the integrand becomes $\int{1-2(\sec^2x/(3-\tan^2x))}dx$. Now, take $\tan x=t$ and simplify to get $\int{1-2/(3-t^2)}dt$. Now plugin the formulas to get the answer.

Solution 2:

Lets take $\int\tan(x)\cot(3x)\, dx$.

We write $\tan(x) \cot(3 x)$ as $\frac{\sin(4 x)-\sin(2 x)}{\sin(2 x)+\sin(4 x)}$ which leads to $\int\frac{\sin(4 x)-\sin(2 x)}{\sin(2 x)+\sin(4 x)}\, dx$

Expanding the integrand leads to:

$$ \int\frac{\sin(4 x)}{\sin(2 x)+\sin(4 x)}-\frac{\sin(2 x)}{\sin(2x)+\sin(4 x)}\, dx = \int\frac{2\cos(2x)}{2\cos(2 x)+1}-\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx $$

For the first integrand, we can substitute $u=2x$ and $du=2dx$ which leads to:

$$ \int\frac{\cos(u)}{2\cos(u)+1}\, du-\int\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx $$

Then substituting for the first integrand $s=\tan\frac{u}{2}$ and $ds=\frac{1}{2}du\sec^2\frac{u}{2}$. Then $\sin u=\frac{2s}{s^2+1}$ and $\cos u=\frac{1-s^2}{s^2+1}$ and $du=\frac{2ds}{s^2+1}$. Then we have:

$ 2\int\frac{s^2-1}{s^4-2s^2-3}\, ds-\int\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx= \int\frac{1}{s^2+1}\, ds-\frac{1}{2\sqrt{3}}\int\frac{1}{s+\sqrt{3}}\, ds-\frac{1}{2\sqrt{3}}\int\frac{1}{\sqrt{3}-s}\, ds-\int\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx $

The integral of $\frac{1}{s^2+1}$ is $\tan^{-1}(s)$ and for $\frac{1}{s+\sqrt{3}}$ we substitute $p=s+\sqrt{3}$ and $dp=ds$. Since the integral of $\frac{1}{p}$ is $\log p$ we have:

$$ \tan^{-1}(s)-\frac{\log(p)}{2\sqrt{3}}-\frac{1}{2\sqrt{3}}\int\frac{1}{\sqrt{3}-s}\, ds-\int\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx $$

For the integrand $\frac{1}{\sqrt{3}-s}$ we substitute $w=\sqrt{3}-s$ and $dw=-ds$. Thus our resulting integral is so far:

$ \tan^{-1}(s)-\frac{\log(p)}{2\sqrt{3}}+\frac{\log(w)}{2\sqrt{3}}-\int\frac{\sin(2x)}{\sin(2x)+\sin(4x)}\, dx = \tan^{-1}(s)-\frac{\log(p)}{2\sqrt{3}}+\frac{\log(w)}{2\sqrt{3}}-\int\frac{1}{2\cos(2x)+1}\, dx $

Now lets substitute $v=2x$ and $dv=2dx$:

$$ \tan^{-1}(s)-\frac{\log(p)}{2\sqrt{3}}+\frac{\log(w)}{2\sqrt{3}}-\frac{1}{2}\int\frac{1}{2\cos(v)+1}\, dv $$

After simplifying the second integrand and perform the resubstitutions we obtain:

$$ x-\frac{2 \tanh ^{-1}\left(\frac{\tan (x)}{\sqrt{3}}\right)}{\sqrt{3}} $$