Solve $I = \int_0^\frac{\pi}{2}{\frac{\cos x}{\cos x + \sin x}}dx$ $$I = \int_0^\frac{\pi}{2}g(x)\,dx = \int_0^\frac{\pi}{2}{\frac{\cos x}{\cos x + \sin x}}\,dx$$ 
This is part of a 3-part exercise where I was given $f, g:[0,\frac{\pi}{2}] \to \mathbb R \,\,\, $, $\,\,f(x)=\frac{\sin x}{\cos x+\sin x} \,\,\,$ , $\,\,g(x)=\frac{\cos x}{\sin x+\cos x} $ 
And these are the two things that I had to prove previously:    
$(1)$ $\int_0^\frac{\pi}{2}\big({f(x)+g(x)\big)}dx = \frac{\pi}{2}$
$(2)$ $h:[0,\frac{\pi}{2}] \to \mathbb R\,\,\, $,  $\,\,h(x)=\ln(\sin x + \cos x)$ is a primitive of $g-f$ 
I am sure that I need to use one or both of the relations above to solve this integral but I can't figure it out. I can see that $(1)$ is equivalent to $\int_0^\frac{\pi}{2}{g(x)} \, dx = \frac{\pi}{2} - \int_0^\frac{\pi}{2}f(x) \, dx $
I tried to solve the integral using u-sub and integration by parts and also tried to rewrite the integral using trigonometric identities but I had no succes so I am certain we need to make use of $(1)$ or/and $(2)$.
 A: Let $I = \int_0^{\frac{\pi}{2}}\frac{\cos(x)}{\sin(x)+\cos(x)}dx$.
Note that $\int_0^{\frac{\pi}{2}}\frac{\cos(x)-\sin(x)}{\sin(x)+\cos(x)}dx = [\ln(\sin(x)+\cos(x))]_0^{\frac{\pi}{2}}=0$.
Hence $I = \int_0^{\frac{\pi}{2}}\frac{\sin(x)}{\sin(x)+\cos(x)}dx$.
Next up,
$\int_0^{\frac{\pi}{2}}\frac{\sin(x)+\cos(x)}{\sin(x)+\cos(x)}dx = \frac{\pi}{2}$.
Hence $2I = \frac{\pi}{2}$, and $I = \frac{\pi}{4}$
A: This solution is the same as solutions above but with more details.
Start with $x\to \frac{\pi}{2}-x$ to have
$$I=\int_0^{\pi/2}\frac{\cos x}{\cos x+\sin x}\ dx=-\int_{\pi/2}^0\frac{\cos(\frac{\pi}{2}-x)}{\cos(\frac{\pi}{2}-x)+\sin(\frac{\pi}{2}-x)}\ dx=\int_0^{\pi/2}\frac{\sin x}{\sin x+\cos x}\ dx$$
Add the integral to both sides,
$$\Longrightarrow I+I=\int_0^{\pi/2}\frac{\cos x+\sin x}{\cos x+\sin x}\ dx=\int_0^{\pi/2}dx=\frac{\pi}{2}\Longrightarrow I=\frac{\pi}{4}$$
A: \begin{align}
& \frac{\cos x}{\sin x + \cos x} \, dx = \frac{\sin u}{ \cos u + \sin u} (-du) \\[12pt]
\text{where } & u = \frac \pi 2 - x, \\[6pt]
\text{ so that } & \cos x = \sin u \text{ and } \sin x = \cos u.
\end{align}
And as $x$ goes from $0$ to $\pi,$ $u$ goes from $\pi$ to $0.$
So the integrals of of $f$ and $g$ are equal to each other.
A: You have found the primitive of $g - f$, and the primitive of $g + f = 1$ is obvious. Now write it as follows:
$$
\int_0^\frac{\pi}{2} g(x) \; \mathrm{d}x = \frac{1}{2}\int_0^\frac{\pi}{2} (g(x) + f(x)) \; \mathrm{d}x + \frac{1}{2}\int_0^\frac{\pi}{2} (g(x) - f(x)) \; \mathrm{d}x
$$
