# How to evaluate $\int \frac{\mathrm dx}{1+\sin x−\cos x}$?

Is there someone show me how I evaluate this integral:$$\int\frac{\mathrm{d}x}{1+\sin x−\cos x}$$

I used $t=\tan\frac{x}{2}$ but i didn't succeed .

Thank you for any help .

• This substitution always works because will transform the integral in a rational function. – user 1987 Jul 4 '15 at 16:21

$$\int\frac {\mathrm{dx}}{1+\sin x -\cos x}= \int\frac {\mathrm{dx}}{2\sin^2 \frac{x}{2}+2\sin \frac{x}{2} \cos \frac{x}{2}}\\= \frac{1}{2}\int\frac {\mathrm{dx}}{\sin^2 \frac{x}{2}+\sin \frac{x}{2} \cos \frac{x}{2}}= \frac{1}{2}\int\frac{\sec^2 \frac{x}{2}}{\tan^2 \frac{x}{2} +\tan \frac{x}{2}}\mathrm{dx}$$

put, $\tan \frac{x}{2} =t$

Hence $\displaystyle \int\frac{\mathrm{dt}}{t^2+t}$

$$= \int\frac{\mathrm{dt}}{t}- \int\frac{\mathrm{dt}}{t+1}= \log \frac{t}{t+1}+C$$ We must substitute $\tan \frac{x}{2}=t$ back into $\log \frac{t}{t+1}+C$ to get $\boxed{\log \tan \frac{x}{2}-\log\left(\tan \frac{x}{2}+1\right)+C}$ as the final answer .

• In your final answer, I think $1$ should be added to $\tan x/2$, not to $x/2$ itself. – Empy2 Jul 4 '15 at 16:26
• thank you ,i dident get attention for sec !!!! – Ani Fier Jul 4 '15 at 23:28

You can dot it directly : if $t=\tan(\frac x2)$, $\sin(x)=\frac{2t}{1+t^2}$, $\cos(x)=\frac{1-t^2}{1+t^2}$, $dt=\frac{2}{1+t^2}$, so $$I=\int\frac {{dx}}{1+\sin x -\cos x}= \int\frac{dt}{t(1+t)}=\int\Big(\frac{1}{t}-\frac{1}{t+1}\Big) dt$$ $$I=\log(t)-\log(1+t)+C=\log\frac{t}{1+t}+C$$

Hint: $$\int \frac{dx}{1+\sin x-\cos x}=\int \frac{\frac{dx}{1+\sin x}}{1+\frac{-\cos x}{1+\sin x}}=\int \frac{d \left(1+\frac{-\cos x}{1+\sin x} \right)}{1+\frac{-\cos x}{1+\sin x}}=\log\left(1+\frac{-\cos x}{1+\sin x}\right)+C$$