# Compute $\int_0^{\pi/2}\frac{\cos{x}}{2-\sin{2x}}dx$

How can I evaluate the following integral?

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

I tried it with Wolfram Alpha, it gave me a numerical solution: $0.785398$.
Although I immediately know that it is equal to $\pi /4$, I fail to obtain the answer with pen and paper.
I tried to use substitution $u=\tan{x}$, but I failed because the upper limit of the integral is $\pi/2$ and $\tan{\pi/2}$ is undefined.
So how are we going to evaluate this integral? Thanks.

• You can try the substitution $u = \tan \frac{x}{2}$. This always transforms a rational trigonometric expression into a rational function which you can integrate using partial fractions. – levap Jun 10 '16 at 13:01
• @levap The disadvantage is that the integral will become very ugly. – Mc Cheng Jun 10 '16 at 13:02
• @McCheng Yeah, I know. This is why I did not post it as an answer... In any case I don't find much point in finding clever tricks to calculate integrals that can be reduced to a form from which an algorithmic (admittedly ugly) procedure can be followed. – levap Jun 10 '16 at 13:05
• $\int_0^a f(x)dx = \int_0^a f(x-a)dx$ – Jester Tran Jun 10 '16 at 13:21
• @levap Undeniably, the result may look good. Like this one: math.stackexchange.com/questions/1820970/… – Mc Cheng Jun 10 '16 at 14:28

Hint:

Knowing that $\sin2x=2\sin x\cos x$ and $\sin^2x+\cos^2x=1$. The integral can be expressed as

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

then use substitution $x\mapsto\frac{\pi}{2}-x$, we have

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

Add the two $I$'s and let $u=\sin x-\cos x$.

• Doing so, you will get $$2I=\int_{-1}^{1}\frac{du}{1+u^2}$$ – Sophie Agnesi Jun 10 '16 at 13:12

I write simplify. $$=\int\frac{d\sin(x-\pi /4)}{ 2 \sin^2(x-\pi/4) +1 }$$ Before it, use $u=\pi/2$ to get numerator $\sin x$ and $\cos x$ is same value.

Here is a step by step approach. :)

\begin{align} I &= \int_0^{\pi/2}\frac{\cos{x}}{2-\sin{2x}}dx \\ &= \int_0^{\pi/2}\frac{\cos{x}}{2-2 \sin x \cos x}dx \\ &= \int_0^{\pi/2}\frac{\cos{x}}{1+\cos^2 x -2 \sin x \cos x + \sin^2 x}dx \\ &= \int_0^{\pi/2}\frac{\cos{x}}{1+(\cos x - \sin x)^2}dx \\ &= \frac{1}{2} \left( \int_0^{\pi/2}\frac{\cos{x}}{1+(\cos x - \sin x)^2}dx + \int_0^{\pi/2}\frac{\sin{x}}{1+(\cos x - \sin x)^2}dx \right) \\ &= \frac{1}{2} \int_0^{\pi/2}\frac{\cos{x} + \sin{x}}{1+(\cos x - \sin x)^2}dx \\ &= -\frac{1}{2} \int_0^{\pi/2}\frac{d(\cos{x} - \sin{x})}{1+(\cos x - \sin x)^2}\\ &= -\frac{1}{2}\arctan(\cos{x}-\sin{x})|_{0}^{\frac{\pi}{2}} \\ &= \frac{\pi}{4} \end{align}

### Hint:

1) $\sin 2x=2\sin x \cos x$

2) $\sin x =\frac {2t}{1+t^2}$

$\cos x =\frac {1-t^2}{1+t^2}$

$dx=\frac{2dt}{1+t^2}$

Use $$I=\int_a^bf(x)dx=\int_a^bf(a+b-x)dx$$

and $$2I=\int_a^bf(x)dx+\int_a^bf(a+b-x)dx=\int_a^b\left(f(x)+f(a+b-x)\right)dx$$

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

As $\int(\cos x+\sin x)\ dx=\sin x-\cos x,$

let $\sin x-\cos x=u\implies u^2=1-\sin2x$

Can you take it from here?

• It is essentially the Sophie Agnesi's answer. – Marco Cantarini Jun 11 '16 at 10:06