# Definite integral $\int_0^{\pi/4} \frac{\sin x+\cos x}{\sin 2x+ \cos 2x}dx$

I am trying to evaluate the integral $$\int_0^{\pi/4} \frac{\sin x+\cos x}{\sin 2x+ \cos 2x}dx$$ Although it appears normal, I have trouble solving it. I tried the standard half angle substitution $$t=\tan\frac x2$$ for the trigonometric integrand, which resulted in a high order rational function and I was unable to reduce it. I would like to know how to proceed, or find out other ways to tackle the integral.

• Have you tried the substitution $t=\frac \pi 4-x$ Commented May 8 at 15:05
• Use kings rule. Commented May 8 at 15:18
• This isn't as easy as it looks... traditional methods fail after kings rule ....i strongly believe that it has something to do with beta functions Commented May 8 at 15:24

Shift the integration to the symmetric domain $$(-\frac\pi8,\frac\pi8)$$ with the variable change $$x=t+\frac\pi8$$ and drop the odd part of the resulting integrand, i.e.

\begin{align} &\int_0^{\pi/4} \frac{\sin x+\cos x}{\sin 2x+ \cos 2x} \overset{x=t+\frac\pi8}{dx}\\ =&\ \cos\frac\pi8 \int_{-\pi/8}^{\pi/8} \frac{\cos t}{ \cos 2t}dt = 2 \cos\frac\pi8 \int_{0}^{\pi/8} \frac{d(\sin t) }{ 1-2\sin^2 t}\\ =&\ \sqrt{1+\frac1{\sqrt2}} \tanh^{-1} \sqrt{1-\frac1{\sqrt2}} \end{align}

This can also be done like $$\int_0^\fracπ4 \frac{\frac{\sin x}{\sqrt 2}+\frac{\cos x}{\sqrt 2}}{\frac{\sin 2x}{\sqrt 2}+\frac{\cos 2x}{\sqrt 2}}dx\\ \implies \int_0^\fracπ4 \frac{\sin(x+\frac{π}{4})}{\sin(2x+\frac{π}{4})}dx$$ Take $$2x+\fracπ4=u\implies du=2dx$$ $$\implies \int_\fracπ4^\frac{3π}{4} \frac{\sin(\frac{u}{2}+\frac{π}{8})}{2\sin u}du= \int_\fracπ4^\frac{3π}{4} \frac{(\sin\frac{u}{2}\cos\frac{π}{8}+\cos\frac{u}{2}\sin\frac{π}{8})}{4\sin \frac{u}{2} \cos \frac{u}{2}}du$$ $$\frac14\int_\fracπ4^\frac{3π}{4}\cos\fracπ8\sec \frac{u}{2}+\sin\fracπ8\csc\frac{u}{2} du$$ You can continue on your own from here :)

Let $$x=\arctan y=\arctan\dfrac{1-z^2}{2z}$$ (i.e. Euler substitution):

\begin{align*} I &= \int_0^\tfrac\pi4 \frac{\sin x+\cos x}{\sin(2x)+\cos(2x)} \, dx \\ &= \sqrt2 \int_0^1 \frac{dy}{\sqrt{1+y^2} \left(1+2y-y^2\right)} \\ &= \frac12 \int_0^1 \left(\frac1{1+\sqrt2-y} - \frac1{1-\sqrt2-y}\right) \, \frac{dy}{\sqrt{1+y^2}} \\ &= \int_{\sqrt2-1}^1 \left(\frac1{1+2\left(\sqrt2-1\right)z-z^2} - \frac1{1-2\left(\sqrt2+1\right)z-z^2}\right) \, dz \end{align*}

Can you continue from here?

\begin{align} I&=\int_0^{\pi/4}\dfrac{\sin x+\cos x}{\sin2x+\cos2x}\ dx\\ &=\int_0^{\pi/4}\dfrac{\sqrt2\cos x}{\cos2x+\sin2x}\ dx \tag{King’s rule}\\ &=\frac12 \int_0^{\pi/4}\dfrac{\sin x+(1+\sqrt2)\cos x}{\cos2x+\sin2x}\ dx\tag{I=\frac{I+I}2}\\ &= \frac12 \int_0^{\pi/4}\dfrac{\sin x+\cot\frac\pi8\cdot\cos x}{\cos2x+\sin2x}\ dx\\ &= \frac1{2\sin\frac\pi8} \int_0^{\pi/4}\dfrac{\cos (x-\frac\pi8)}{\cos2x+\sin2x}\ dx\\ &= \frac1{2\sin\frac\pi8} \int_0^{\pi/4}\dfrac{\cos (x-\frac\pi8)}{\sqrt2\cos(2x-\frac\pi4)}\ dx\\ &= \frac1{2\sqrt2\sin\frac\pi8} \int_0^{\pi/4}\dfrac{\cos (x-\frac\pi8)}{\cos(2(x-\frac\pi8))}\ d(x-\frac\pi8)\\ &= \frac1{2\sqrt2\sin\frac\pi8} \int_{-\pi/8}^{\pi/8}\dfrac{\cos x}{\cos2x}\ dx\tag{x-\frac\pi8\to x }\\ &= \frac1{2\sqrt2\sin\frac\pi8} \int_{-\pi/8}^{\pi/8}\dfrac{\cos x}{(\cos x+\sin x) (\cos x-\sin x)}\ dx\\ &= \frac1{4\sqrt2\sin\frac\pi8} \int_{-\pi/8}^{\pi/8}\left(\dfrac{1}{\cos x+\sin x}+\frac1{\cos x-\sin x}\right)\ dx\\ &= \frac1{2\sqrt2\sin\frac\pi8} \int_{-\pi/8}^{\pi/8}\dfrac{1}{\cos x+\sin x}\ dx\tag{symmetry}\\ &= \frac1{4\sin\frac\pi8} \int_{-\pi/8}^{\pi/8}\dfrac{1}{\sin (x+\frac\pi4)}\ dx\\ &= \frac1{4\sin\frac\pi8} \ln \left| \tan \left( \frac{\pi}{4} + \frac{x+\frac\pi4}{2} \right) \right|\bigg|_{-\pi/8}^{\pi/8}\\ &= \frac1{4\sin\frac\pi8} \ln \left|\frac{ \tan \left( \frac{7\pi}{16} \right)}{\tan \left( \frac{5\pi}{16} \right)}\right|\\ &\approx0.791575 .\end{align}

Also, $$I= \frac1{4\sin\frac\pi8} \ln \left|\frac{ \tan \left( \frac{7\pi}{16} \right)}{\tan \left( \frac{5\pi}{16} \right)}\right|=\frac{\ln (-1+2\sqrt2+2\sqrt{2-\sqrt2})}{2\sqrt{2-\sqrt2}}.$$

Hint:

$$I=\int_0^{\pi/4}\dfrac{\sin x+\cos x}{\sin2x+\cos2x}\ dx=\int_0^{\pi/4}\dfrac{\sqrt2\cos x}{\cos2x+\sin2x}\ dx$$

$$I+I=?$$

Now setting $$\dfrac\pi4=2y,\sqrt2+1=\csc2y+\cot2y=\cdots=\cot y$$

$$\implies (\sqrt2+1)\cos x+\sin x=\cot y\cos x+\sin x=\dfrac{\cos\left(x-y\right)}{\sin y}$$

$$\sin2x+\cos2x=\sqrt2\cos2\left(x-y\right)=\sqrt2\left(2\cos^2(x-y)-1\right)$$

• I’m getting $\int_0^{\pi/4}\dfrac{\sqrt2\cos x}{\cos2x+\sin2x}\ dx$ instead of $\int_0^{\pi/4}\dfrac{\sqrt2\sin x}{\cos2x+\sin2x}\ dx$.
– Aig
Commented May 8 at 17:30
• @Aig same here. Commented May 8 at 17:45