# Compute $\int \frac{\cos(x)}{\cos(x)+\sin(x)}dx.$

Compute $$\int \frac{\cos(x)}{\cos(x)+\sin(x)}dx.$$

I tried several thing as $x=2\arctan(u)$, or simplify by $\cos(x)$ and make the substitution $u=\tan(x)$, but I can't conclude. Is there a special trick here ?

• $2\cos x=(\cos x+\sin x)+(-\sin x+\cos x)$ Nov 3 '17 at 18:10

Method 1

Your second idea is good. You get $$\int \frac{1}{1+\tan(x)}dx,$$ and by setting $x=\arctan(u)$ you get $$\int \frac{1}{1+u}\cdot \frac{1}{1+u^2}du.$$ A decomposition in simple element will allow you to conclude.

Method 2

If you look for a trick :

$$\frac{\cos(x)}{\cos(x)+\sin(x)}=\frac{1}{2}\cdot \frac{\cos(x)+\sin(x)+\cos(x)-\sin(x)}{\cos(x)+\sin(x)}=\frac{1}{2}\left(1+\frac{\cos(x)-\sin(x)}{\cos(x)+\sin(x)}\right).$$

And as you can remark, $$\frac{\cos(x)-\sin(x)}{\cos(x)+\sin(x)}$$ is of the form $\frac{u'}{u}$.

• I particularly like method 2. I was trying to make that work but you beat me to it. Nov 3 '17 at 18:15

Hint

Following one the changes you suggest you get

$$\int \frac{\cos x}{\cos x+\sin x}dx=\int \frac{1}{1+\tan x}dx\underbrace{=}_{t=\tan x}\int\dfrac{dt}{(t+1)(t^2+1)}.$$