# Integration of $\frac{1}{\sin x+\cos x}$

I'm given this $\int\frac{1}{\sin x+\cos x}dx$.

My attempt,

$\sin x+\cos x=R\cos (x-\alpha)$

$R\cos \alpha=1$ and $R\sin \alpha=1$

$R=\sqrt{1^2+1^2}=\sqrt{2}$,

$\tan\alpha=1$ $\alpha=\frac{\pi}{4}$

So, $\sin x+\cos x=\sqrt{2}\cos (x-\frac{\pi}{4})$

$\int\frac{1}{\sin x+\cos x}dx=\int \frac{1}{\sqrt{2}\cos (x-\frac{\pi}{4})}dx$

$=\frac{1}{\sqrt{2}}\int \sec (x-\frac{\pi}{4})dx$

$=\frac{1}{\sqrt{2}} \ln \left | \sec (x-\frac{\pi}{4})+\tan (x-\frac{\pi}{4}) \right |+c$

Am I correct? Is there another way to solve this integral? Thanks in advance.

• I think that what you did was the most efficient way. – Ivo Terek May 17 '15 at 22:21

Your computations are correct. Now, if you make the substitution $t = \tan\left(\frac{x}{2}\right)$, you get \begin{align} \cos x &= \frac{1-t^{2}}{1+t^{2}} \\ \sin x &= \frac{2t}{1+t^{2}} \\ dx &= \frac{2 \, dt}{1+t^{2}} \end{align} then \begin{align} \int \frac{dx}{\cos x + \sin x } &= -\int \frac{dt}{t^{2}-2t-1 } = \frac{1}{\sqrt{2}}\rm arctanh \left(\frac{t-1}{\sqrt{2}}\right)+C. \end{align}
Try using the substitution $t=\tan\frac x2$
Another method would be to multiply by $\cos x-\sin x$ on the top and bottom to get
$\displaystyle\int\frac{\cos x-\sin x}{\cos 2x} dx=\int\frac{\cos x}{1-2\sin^2 x} dx-\int\frac{\sin x}{2\cos^2 x-1} dx$, and then use
$\displaystyle\int\frac{1}{1-2u^2}du=\frac{\sqrt{2}}{4}\ln\bigg|\frac{1+\sqrt{2}u}{1-\sqrt{2}u}\bigg|+C=\frac{\sqrt{2}}{2}\tanh^{-1}(\sqrt{2}u)+C$ to find both terms.