# Integrate $\int\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}dx$

Solve the indefinite integral

$$I=\int\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}\;dx$$

My Attempt:

\begin{align} I&=\int\frac{1}{\sin x+\cos x+\frac{1}{\sin x \cos x}+\frac{\sin x +\cos x}{\sin x\cos x}}\;dx\\ \\ &=\int\frac{\sin x\cos x}{\left(\sin x+\cos x\right)\left(\sin x\cos x \right)+1+\left(\sin x+\cos x\right)}\;dx \end{align}

How can I complete the solution from here?

• Do you have any reason to think it has a nice answer? Commented Sep 18, 2013 at 5:14
• Yeah... Good luck Commented Dec 25, 2013 at 23:45

You want

\begin{align} \int\frac{dx}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x} &= \int\frac{dx}{\sin x+\cos x+\frac{\sin x}{\cos x} +\frac{\cos x}{\sin x}+\frac1{\sin x}+\frac1{\cos x}}\\ &= \int\frac{\sin x \cos x\ dx}{\sin^2 x \cos x+\cos^2 x \sin x+\sin^2 x +\cos^2 x+\cos x+\sin x}\\ &= \int\frac{\sin x \cos x\ dx}{\sin x \cos x(\sin x+ \cos x)+1+\cos x+\sin x}\\ &= \int\frac{\sin x \cos x\ dx}{(\sin x \cos x+1)(\sin x+ \cos x)+1}\\ \end{align}.

Applying substitutions $\sin x = \frac{2t}{1+t^2}, \cos x = \frac{1-t^2}{1+t^2}, dx = \frac{2 dt}{1+t^2}$, this becomes

\begin{align} \int\frac{\sin x \cos x\ dx}{(\sin x \cos x+1)(\sin x+ \cos x)+1} &=\int\frac{\frac{(2t)(1-t^2)(2dt)}{(1+t^2)^3}} {(\frac{(2t)(1-t^2)}{(1+t^2)^2}+1)(\frac{2t}{1+t^2}+ \frac{1-t^2}{1+t^2})+1}\\ &=\int\frac{(2t)(1-t^2)(2dt)} {((2t)(1-t^2)+(1+t^2)^2)(1+2t-t^2)+(1+t^2)^3}\\ &=\int\frac{4t(1-t^2)dt} {((2t-2t^3)+1+2t^2+t^4)(1+2t-t^2)+1+3t^2+3t^4+t^6}\\ &=\int\frac{4t(1-t^2)dt} {(1+2t+2t^2-2t^3+t^4)(1+2t-t^2)+1+3t^2+3t^4+t^6}\\ &=\int\frac{4t(1-t^2)dt} {2 (t+1) (2 t^4-3 t^3+3 t^2+t+1)} \quad \text{ (according to Wolfram Alpha)}\\ &=\int\frac{2t(1-t)dt} {2 t^4-3 t^3+3 t^2+t+1}\\ \end{align}.

According to Wolfram Alpha, that quartic can be factored as the product of two quadratics, but the coefficients look irrational.

I'll leave it at this.

If you can't see anything simpler: when you have a rational function of sin and cos, you can always use the tangent half-angle substitution $t = \tan (x/2)$. Then $$\sin x = \frac{2t}{1+t^2}, \cos x = \frac{1-t^2}{1+t^2}, dx = \frac{2 dt}{1+t^2}.$$ Substituting these converts your integral into the integral of a rational function of $t$, which can then be integrated by partial fractions.

• i tried that one doent give any answer Commented Sep 18, 2013 at 4:23
• I'd like a second opinion... Commented Sep 18, 2013 at 4:24

You can use Euler's identities and expand it in terms of complex exponents like (after some simplifications): $$\frac{1}{\sin x+\cos x+\tan x+\cot x+\csc x+\sec x}=\frac{e^{\mathrm i x} \left((1+\mathrm i) e^{2 \mathrm i x}-2 \mathrm i e^{\mathrm i x}+(\mathrm i-1)\right)}{e^{4 \mathrm i x}-(1+\mathrm i) e^{3 \mathrm i x}+6 \mathrm i e^{2 \mathrm i x}+(1-\mathrm i) e^{\mathrm i x}-1}$$ So $$\begin{eqnarray} \int\!\!\frac{1}{\sin x\!+\!\cos x\!+\!\tan x\!+\!\cot x\!+\!\csc x\!+\!\sec x}\!\mathrm dx&=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(1+\mathrm i) e^{2 \mathrm i x}-2 \mathrm i e^{\mathrm i x}+(\mathrm i-1)}{e^{4 \mathrm i x}-(1+\mathrm i) e^{3 \mathrm i x}+6 \mathrm i e^{2 \mathrm i x}+(1-\mathrm i) e^{\mathrm i x}-1}\!\!\mathrm de^{\mathrm i x}\!\!=\\ &=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(1+\mathrm i) t^{2}-2 \mathrm i t+(\mathrm i-1)}{t^{4}-(1+\mathrm i) t^{3}+6 \mathrm i t^{2}+(1-\mathrm i) t^{}-1} \!\!\mathrm dt&=&\\ &=&\frac{1}{\mathrm i}\!\!\int \!\! \frac{(t-t_{11})(t-t_{12})}{(t-t_{21})(t-t_{22})(t-t_{32})(t-t_{42})} \!\!\mathrm dt \end{eqnarray}$$ After that you can use partial fraction expansion to simplify the answer (Mathematica gives 4 distinct roots for denominator).

Try $$U$$ substitution $$x = 2 \arctan U$$

Substitute $$x=y+\dfrac\pi4$$ :

\begin{align*} I &= \int \frac{dx}{\sin x+\cos x+\csc x+\sec x+\tan x+\cot x} \\ &= \int \frac{dy}{\frac{\cos y+\sin y}{\sqrt2} + \frac{\cos y-\sin y}{\sqrt2} + \frac{\sqrt2}{\cos y+\sin y} + \frac{\sqrt2}{\cos y-\sin y} + \frac{\cos y+\sin y}{\cos y-\sin y} + \frac{\cos y-\sin y}{\sin y-\cos y}} \\ &= \int \frac{2\cos^2y-1}{2\sqrt2\,\cos^3y+\sqrt2\,\cos y+2} \, dy \\ \end{align*}

By inspection, $$\sqrt2 \, c \left(2c^2 + 1\right) + 2 = 0$$ at $$c=-\dfrac1{\sqrt2}$$, and thus we may simplify

$$I = \int \frac{\sqrt2\,\cos y+1}{2\cos^2y - \sqrt2 \, \cos y + 2} \, dy$$

Now substituting $$y=2\arctan z \implies \cos y = \dfrac{1-z^2}{1+z^2}$$ makes for an easier partial fraction expansion,

$$I = \frac{3\sqrt2-2}7 \int \frac{1-(3+2\sqrt2)z^2}{1+\frac{9+4\sqrt2}7 z^4} \, dz$$

The right side expands to

$$\int \frac{1-az^2}{1+b^2z^4}\,dz = \frac1{2ib} \int \left(\frac{a+ib}{1+ibz^2} - \frac{a-ib}{1-ibz^2}\right) \, dz$$

and this produces a combination of the $$\arctan$$ and $$\operatorname{artanh}$$ of a complex argument.