# Integrate $\int {{{\left( {\cot x - \tan x} \right)}^2}dx}$

\eqalign{ & \int {{{\left( {\cot x - \tan x} \right)}^2}dx} \cr & = {\int {\left( {{{\cos x} \over {\sin x}} - {{\sin x} \over {\cos x}}} \right)} ^2}dx \cr & = {\int {\left( {{{{{\cos }^2}x - {{\sin }^2}x} \over {\sin x\cos x}}} \right)} ^2}dx \cr & = \int {{{\left( {{{\cos 2x} \over {{1 \over 2}\sin 2x}}} \right)}^2}dx} \cr & = \int {{{\left( {2\cot 2x} \right)}^2}} \cr & = \int {4{{\cot }^2}2xdx} \cr & = \int {4\left( {{{\csc }^2}2x - 1} \right)dx} \cr & = \int {\left(4{{\csc }^2}2x - 4\right)dx} \cr & = 4 \times {{ - 1} \over 2}\cot 2x - 4x + C \cr & = - 2\cot 2x - 4x + C \cr}

Where have I gone wrong? I've tried to spot an error so many times yet I can't find it, I need another pair of eyes.. Thanks.

• everything checks out. You are fine. – Nana May 18 '13 at 2:40
• If you have a problem with checking your result against a result returned by a machine like Wolfram Alpha, simply input the difference between the two functions. If it is a constant, then you know the two functions are identical outside the constant of integration. – Jon Claus May 18 '13 at 4:33

Why do you think that you've gone wrong? Your answer is correct.

Edit. To show why the solution is the same as the one in your answers, we just need to show that $\tan x-\cot x=-2\cot 2x$. \begin{align*} &\tan x-\cot x+2\cot 2x \\ &=\frac{\sin x}{\cos x}-\frac{\cos x}{\sin x}+2\frac{\cos 2x}{\sin 2x} \\ &=\frac{2\cos x\cos 2x\sin x-\cos^2 x\sin 2x+\sin^2 x\sin 2x}{\cos x\sin x\sin 2x} \\ &=\frac{2\cos x(\cos^2 x-\sin^2 x)\sin x-\cos^2 x(2\sin x\cos x)+\sin^2 x(2\sin x\cos x)}{\cos x\sin x\sin 2x} \\ &=\frac{2\cos^3 x\sin x-2\cos x\sin^3 x-2\sin x\cos^3 x+2\cos x\sin^3 x}{\cos x\sin x\sin 2x} \\ &=0 \end{align*}

• The answer in the back of this book is: $- \cot x - 4x + \tan x + c$ – seeker May 18 '13 at 2:40
• @Assad They are the same solution since $\tan x-\cot x=-2\cot 2x$. Have you tried to show that they are equal? – Warren Moore May 18 '13 at 2:41
• Ah I see, I did not realise this... Thanks – seeker May 18 '13 at 2:44
• @Assad I've edited my answer with a proof of the equivalence for you as well. :) – Warren Moore May 18 '13 at 2:51

A cleaner way could be

$$\int (\cot x-\tan x)^2dx=\int(\cot^2x+\tan^2x-2\cot x\tan x)dx$$

$$=\int (\csc^2x-1+\sec^2x-1-2)dx$$

$$=\int \csc^2x dx+\int \sec^2x dx-4\int dx$$

$$=-(\cot x-\tan x)-4x+C$$

From another answer $\cot x-\tan x=2\cot2x$

$\tan x- \cot x = \frac{\sin x}{\cos x}-\frac{\cos x}{\sin x} = \frac{\sin^2 x - \cos^2 x}{\sin x \cos x} = \frac{-\cos 2x}{\sin x \cos x} = \frac{-2 \cos2x}{\sin 2x} = -2 \cot2x$

Therefore you answer $-\cot x -4x + \tan x +c$ is correct.