Evaluate {eq}\displaystyle \int ( \tan x + \cot x )^2 \ dx {/eq}

Question:

Evaluate {eq}\displaystyle \int ( \tan x + \cot x )^2 \ dx {/eq}

Integration of {eq}{\tan ^2}x {/eq}:

The integration of the trigonometric function {eq}{\tan ^2}x {/eq} is found out by simplifying the given function {eq}{\tan ^2}x {/eq} as {eq}{\tan ^2}x = {\sec ^2}x - 1 {/eq}. Now, we can directly find out the integration of {eq}f\left( x \right) = {\sec ^2}x - 1 {/eq} as follows {eq}\int {f\left( x \right)} = \int {\left( {{{\sec }^2}x - 1} \right)dx} = {\tan}x - x + C {/eq} where {eq}C {/eq} is the integrating constant.

The given integral is,

{eq}\int {{{\left( {\tan x + \cot x} \right)}^2}} {/eq}

Simplifying the trigonometric function,

{eq}\begin{align*} {\left( {\tan x + \cot x} \right)^2} &= {\tan ^2}x + {\cot ^2}x + 2\tan x\cot x\\ &= {\tan ^2}x + {\cot ^2}x + 2\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\left( {\tan x\cot x = 1} \right)\\ &= \left( {{{\sec }^2}x - 1} \right) + \left( {{{\csc }^2}x - 1} \right) + 2\\ &= {\sec ^2}x + {\csc ^2}x \end{align*} {/eq}

The given integral can also be written as,

{eq}\int {{{\left( {\tan x + \cot x} \right)}^2}} = \int {\left( {{{\sec }^2}x + {{\csc }^2}x\;} \right)dx} {/eq}

Now, integrating the above integral with respect to x as,

{eq}\begin{align*} \int {{{\left( {\tan x + \cot x} \right)}^2}} dx &= \int {\left( {{{\sec }^2}x + {{\csc }^2}x\;} \right)dx} \\ &= \tan x - \cot x + C \end{align*} {/eq}

Thus, {eq}\int {{{\left( {\tan x + \cot x} \right)}^2}} dx = \tan x - \cot x + C {/eq}