Different ways of evaluating $\int_{0}^{\pi/2}\frac{\cos(x)}{\sin(x)+\cos(x)}dx$

My friend showed me this integral (and a neat way he evaluated it) and I am interested in seeing a few ways of evaluating it, especially if they are "often" used tricks.

I can't quite recall his way, but it had something to do with an identity for phase shifting sine or cosine, like noting that $\cos(x+\pi/2)=-\sin(x)$ we get: $$I=\int_{0}^{\pi/2}\frac{\cos(x)}{\sin(x)+\cos(x)}dx=\int_{\pi/2}^{\pi}\frac{-\sin(x)}{-\sin(x)+\cos(x)}dx\\$$ Except for as I have tried, my signs don't work out well. The end result was finding $$2I=\int_{0}^{\pi/2}dx\Rightarrow I=\pi/4$$ Any help is appreciated! Thanks.

• It seems better to make the change of variable $x \to \pi/2-x$. Jun 18 '16 at 20:52
• @OlivierOloa oops right, I'll fix it. Have any other ideas for how to integrate the above? Jun 18 '16 at 20:53
• @OlivierOloa yes, thank you! I will try to use that for mine and provide an answer Jun 18 '16 at 20:57
• Also related: math.stackexchange.com/questions/180744/… Jun 18 '16 at 21:02

$$\int_{0}^{a}{\frac{f(x)}{f(x)+f(a-x)}}dx=\frac{a}{2}$$ let $f(x)=\sin x$ and $a=\frac\pi2$

• Is there a name for this formula? Where can I find more? Jun 18 '16 at 21:06
• No there is not Jun 18 '16 at 21:08
• @qbert The formula arises from another one: $\int_{0}^{a}\mathrm{F}\left(x\right)\,\mathrm{d}x = \int_{0}^{a}\mathrm{F}\left(a - x\right)\,\mathrm{d}x$ which sometimes we say "by reflection in the mirror" especially by people that computes MonteCarlo integrals. By adding ( to the original one ) and dividing by two we usually arrives to an integrand which is somehow smooth which the MC-people like a lot because it can reduce computing time. Jun 19 '16 at 2:31

Let

$$I=\int_0^{\pi/2}\frac{\cos x}{\sin x+\cos x}\ dx$$

and

$$J=\int_0^{\pi/2}\frac{\sin x}{\sin x+\cos x}\ dx$$

then

$$I+J=\frac{\pi}{2}\tag1$$

and

\begin{align} I-J&=\int_0^{\pi/2}\frac{\cos x-\sin x}{\sin x+\cos x}\ dx\\[10pt] &=\int_0^{\pi/2}\frac{1}{\sin x+\cos x}\ d(\sin x+\cos x)\\[10pt] &=0\tag2 \end{align}

Hence, $$I=J=\frac\pi4$$by linear combinations $(1)$ and $(2)$.

• You might also be interested in seeing the general method Jun 18 '16 at 22:54
• I came back to this question, and you're answer, and the link you provided is really fantastic, and quite general Jul 7 '16 at 2:40

Hint: Substitute $2i\sin(x)=e^{ix}-e^{-ix}$ and $2\cos(x)=e^{ix}+e^{-ix}$

$$I=\int_{0}^{\pi/2}\frac{2\cos(x)}{2\sin(x)+2\cos(x)}dx=\int_{0}^{\pi/2}\frac{e^{ix}+e^{-ix}}{\frac{e^{ix}-e^{-ix}}{i}+e^{ix}+e^{-ix}}dx$$

Now substitute $u=e^{ix} \implies du = ie^{ix}dx=iudx$

$$I=\int\frac{u+1/u}{\frac{u-1/u}{i}+u+1/u}\frac{du}{iu}$$

Alternative method: $$I=\int_{0}^{\pi/2}\frac{\cos(x)}{\sin(x)+\cos(x)}dx=\int_{0}^{\pi/2}\frac{1}{\tan(x)+1}dx$$

Substitute: $u=\tan(x) \implies du=(1+\tan^2(x))dx=(1+u^2)dx$

$$I=\int\frac{1}{u+1}\frac{du}{1+u^2}$$

• Ah I love it when complex makes integration easy. Thanks! Jun 18 '16 at 21:01
• Added second method. Jun 18 '16 at 21:24

You're integrating on $[0, \pi/2]$ so replacing $x$ by $\pi/2 -x$ we see that $$I=\int_0^{\pi/2} \frac{\sin{x}}{\cos{x}+\sin{x}}dx.$$ Now sum this integral with the initial expression and notice that $2I=\pi/2$ hence...