Find $\int \frac{1}{\sin x+\cos x }\, dx$

Attempt to find the indefinite integral:

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

WolframAlpha gives an unsatisfactory answer (this is one of the integrals that couldn't give the best answer):

$$(-1-i)(-1)^{\frac{3}{4}}\operatorname{arctanh}\frac{\tan(\frac{x}{2})-1}{\sqrt{2}}+C$$

Substitution also does not appear to work.

• use the tan-half angle substitution – Dr. Sonnhard Graubner Feb 1 '17 at 6:18
• Actually that's what WolframAlpha did haha – Linus Choy Feb 1 '17 at 6:20
• Hint: what's $(-1)^\frac{3}{4}$? – user361424 Feb 1 '17 at 6:29
• That's the result the computer gave – Linus Choy Feb 1 '17 at 6:41
• Wolfram Alpha gave an unsimplified result from symbolic manipulation. Taking the principal value, $$(-1-i)(-1)^{\frac{3}{4}}=\sqrt{2}$$ or try a more general case of $$\int \frac{dx}{a\sin x+b\cos x}$$ See the result here – Ng Chung Tak Feb 1 '17 at 13:14

$$\int\frac{dx}{\sin x+\cos x}=\frac{\sqrt2}2\int\dfrac{dx}{\frac{\sqrt2}2\cos x+\frac{\sqrt2}2\sin x}=\frac{\sqrt2}2\int\sec(x-\frac{\pi}4)dx$$

Does this help?

• Yup exactly what I'm looking for. :P – Linus Choy Feb 1 '17 at 6:41

For $$I=\int\dfrac{dy}{A\sin2y+B\cos2y}=\int\dfrac{\sec^2y\ dy}{2A\tan y+B(1-\tan^2y)}$$

use Weierstrass substitution $t=\tan y$ to find $$I=\int\dfrac{dt}{2At+B(1-t^2)}=B\int\dfrac{dt}{B^2-A^2-(Bt+A)^2}$$

Here $2y=x$

It is a bit unclear if you ask for another suggestion, or how to complete the calculation with $u=\tan(x/2)$.

I suggest that you instead let $u=\cos x-\sin x$. You will end up with $$-\int\frac{1}{2-u^2}\,du,$$ which I suppose you can handle.

• Then when you differentiate u you will get $\frac{du}{dx}=-sinx-cosx$ which would lead to further complications which are quite unnecessary. – Linus Choy Feb 1 '17 at 6:39
• I don't think they are complicated nor unnecessary. But I respect that you don't like the solution I gave. – mickep Feb 1 '17 at 6:51

Hint $\int \frac{1+tan^2x/2}{2tanx/2 + 1-tan^2x/2}dx$ which is same as $\int \frac{sec^2x/2}{1+2tanx/2-tan^2x/2}dx$ Now put $tanx/2=t$ and proceed.

• Yup as mentioned WolframAlpha tried to use this half angle substitution and it gave the result shown above which is not satisfactory. – Linus Choy Feb 1 '17 at 14:12