# Solve integral $\int\frac{dx}{\sin x+ \cos x+\tan x +\cot x}$

I need to find:

$$\int\frac{1}{\sin x+ \cos x+\tan x +\cot x}\ dx$$

My attempts:

I have tried the conventional substitutions. I have tried the $$\tan(x/2)$$ substitutions, tried to solve it by quadratic but nothing has worked so far.

• What makes you think a closed form solution is possible? Maybe for a definite integral a statement can be made, but I'm guessing if a closed form exists, it will be very labor intensive. Commented Oct 9, 2017 at 19:18
• the integral looks terrible Commented Oct 9, 2017 at 19:20
• The integral is equivalent to $\int\frac{sc}{s^2c+c^2s+1}\,\mathrm{d}x$ with $s=\sin(x),c=\cos(x)$, which according to WolframAlpha has a really ugly, complicated solution. wolframalpha.com/input/…
– Jam
Commented Oct 9, 2017 at 19:22
• I need to know how to proceed from that step. It may be tedious but if I at least know what to do, then I am satisfied. Commented Oct 9, 2017 at 19:26
• Here's a similar one: math.stackexchange.com/questions/497127/… Commented Oct 9, 2017 at 21:41

Let $$t=x-\frac\pi4$$ and recognize $$2\sin x\cos x= 2\cos^2t-1$$ $$I= \int\frac{dx}{\sin x+ \cos x+\tan x +\cot x} =\frac1{\sqrt2}\int \frac{\cos^2t-\frac12}{\cos^3t-\frac12\cos t+\frac1{\sqrt2}}dt$$ Factorize the denominator ($$y=\cos t$$) $$y^3-\frac12y+\frac1{\sqrt2} =(y+a)\left(y-\frac {a-ib}2 \right) \left(y-\frac {a+ib}2 \right)$$ where $$a$$ given below is the real root and $$b =\frac12\sqrt{\frac3{\sqrt2a}-\frac12}$$ $$a= \bigg(\frac1{2\sqrt2}+\frac16\sqrt{\frac{13}3}\bigg)^{1/3}+ \bigg(\frac1{2\sqrt2}-\frac16\sqrt{\frac{13}3}\bigg)^{1/3} \overset{\cdot}=1.0758$$

Then, partially-fractionalize the integrand \begin{align} I&= \frac1{3+\sqrt2a}\int \frac{\frac1{\sqrt2}}{\cos t+a} +\Re \frac{a+\sqrt2 -i \frac{a^2}b}{\cos t +\frac{ib-a}2}\ dt\\ \end{align} and apply the known integral $$\int \frac{1}{\cos t+p}dt=\frac2{\sqrt{p^2-1}}\tan^{-1}\frac{\tan\frac t2}{\sqrt{\frac{p+1}{p-1}}}$$ to obtain \begin{align}I &= \frac1{3+\sqrt2a}\bigg(\frac{\sqrt2}{\sqrt{a^2-1}}\tan^{-1}\frac{\tan\frac t2}{\sqrt{\frac{a+1}{a-1}}} +4\Re \frac{a+\sqrt2-i\frac{a^2}b}{\sqrt{(ib-a)^2-4}}\tan^{-1}\frac{\tan\frac t2}{\sqrt{\frac{ib-a+2}{ib-a-2}}} \bigg) \end{align}

Partial Solution

\begin{aligned} &\int\frac{\mathrm{d}x}{\sin(x)+\cos(x)+\tan(x)+\cot(x)} \\&=\int\frac{sc}{s^2c+c^2s+1}\,\mathrm{d}x\quad * \\&=\int sc\sum_{n\geq0}(-1)^n(s^2c+c^2s)^n\,\mathrm{d}x\quad\text{(Binomial series)}** \\&=\int sc\sum_{n\geq0}(-1)^n\left(\sum_{0\leq k\leq n}\binom{n}{k}(s^2c)^{k}(c^2s)^{n-k}\right)\mathrm{d}x\quad\text{(Binomial theorem)} \\&=\sum_{n\geq0}\,\sum_{0\leq k\leq n}(-1)^n\binom{n}{k}\int s^{n+k+1}c^{2n-k+1}\,\mathrm{d}x \end{aligned}

Then the integral in the last expression can be computed iteratively, for $a,b\in\mathbb{N}$, as:

$$\int s^{a}c^{b}\,\mathrm{d}x =-\frac{s^{a-1}c^{b+1}}{a+b}+\frac{a-1}{a+b}\int s^{a-2}c^{b}\,\mathrm{d}x$$

This solves the integral as a series but doesn't give a closed form and still has the caveat of infinite terms.

* $s=\sin(x),c=\cos(x)$

** The series is the expansion of $\big((s^2c+c^2s)+1\big)^{-1}$, which converges since $|s^2c+c^2s|<1$.

The iterative algorithm for $\int s^ac^b\,\mathrm{d}x$ is here, on Wikipedia.