How can I evaluate the following integral?


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.

  • $\begingroup$ 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. $\endgroup$ – levap Jun 10 '16 at 13:01
  • $\begingroup$ @levap The disadvantage is that the integral will become very ugly. $\endgroup$ – Mc Cheng Jun 10 '16 at 13:02
  • $\begingroup$ @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. $\endgroup$ – levap Jun 10 '16 at 13:05
  • $\begingroup$ $\int_0^a f(x)dx = \int_0^a f(x-a)dx$ $\endgroup$ – Jester Tran Jun 10 '16 at 13:21
  • $\begingroup$ @levap Undeniably, the result may look good. Like this one: math.stackexchange.com/questions/1820970/… $\endgroup$ – Mc Cheng Jun 10 '16 at 14:28


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

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

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

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

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

  • 3
    $\begingroup$ Doing so, you will get $$2I=\int_{-1}^{1}\frac{du}{1+u^2}$$ $\endgroup$ – 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}$$



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}$



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?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.