How many methods to tackle the integral $\int_{0}^{\frac{\pi}{4}} \frac{\sin x+\cos x}{9+16 \sin 2 x} d x ?$ $ \text{We are going to evaluate the integral}$
$\displaystyle \int_{0}^{\frac{\pi}{4}} \frac{\sin x+\cos x}{9+16 \sin 2 x} d x \tag*{} \\$
by letting $ y=\frac{\pi}{4}-x. $ Then
$$\begin{aligned} \displaystyle \int_{0}^{\frac{\pi}{4}} \frac{\sin x+\cos x}{9+16 \sin 2 x} d x \displaystyle &=\int_{\frac{\pi}{4}}^{0} \frac{\sin \left(\frac{\pi}{4}-y\right)+\cos \left(\frac{\pi}{4}-y\right)}{9+16 \sin 2\left[(\frac{\pi}{4}-y)\right]}(-d y) \\
\displaystyle &=\int_{0}^{\frac{\pi}{4}} \frac{\frac{1}{\sqrt{2}}(\cos y-\sin y)+\frac{1}{\sqrt{2}}(\cos y+\sin y)}{9+16 \cos 2 y} d y \\
\displaystyle &=\sqrt{2} \int_{0}^{\frac{\pi}{4}} \frac{\cos y}{9+16\left(1-2 \sin ^{2} y\right)} d y \\
\displaystyle &=\sqrt{2} \int_{0}^{\frac{1}{\sqrt 2} } \frac{d z}{25-32 z^{2}} \text { , where } z=\sin y\\
\displaystyle &=\frac{\sqrt{2}}{10} \int_{0}^{\frac{1}{\sqrt 2} }\left(\frac{1}{5-4 \sqrt{2}z}+\frac{1}{5+4 \sqrt{2} z}\right) d z \\
\displaystyle &=\frac{\sqrt{2}}{10(4 \sqrt{2})}\left[\ln \left|\frac{5+4 \sqrt{2} z}{5-4 \sqrt{2} z}\right|\right]_{0}^{\frac{1}{\sqrt 2} } \\
\displaystyle &=\frac{1}{40}\ln 9 \end{aligned}$$
 A: $$
\begin{aligned}
\int_{0}^{\frac{\pi}{4}} \frac{\sin x+\cos x}{9+16 \sin 2 x} d x =& \int_{0}^{\frac{\pi}{4}} \frac{d(\sin x-\cos x)}{5^{2}-4^{2}(\sin x-\cos x)^{2}} \\
=& \frac{1}{40}\left[\ln \left| \frac{4 (\sin x-\cos x)+5}{4(\sin x-\cos x)-5} \right|\right]_{0}^{\frac{\pi}{4}}\\
=& \frac{\ln 9}{40}
\end{aligned}
$$
A: This is similar to your original solution but a bit quicker using sum-to-product formula:$$\begin{aligned} \displaystyle \int_{0}^{\frac{\pi}{4}} \frac{\sin x+\cos x}{9+16 \sin 2 x} d x \displaystyle &=\sqrt2\int_{0}^{\frac{\pi}{4}} \frac{\sin \left(\frac{\pi}{4}+x\right)}{9+16 \sin 2x}d x \\
\displaystyle &=\sqrt2\int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{\sin y}{9-16 \cos 2 y} d y \\
\displaystyle &=-\sqrt{2} \int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{d(\cos y)}{9-16\left(2 \cos ^{2} y-1\right)}  \\
\end{aligned}$$Following with the substitution $z=\cos y$
A: Using the famous tangent half-angle substitution,
$$I=\int \frac{\sin (x)+\cos (x)}{9+16 \sin (2 x)}\,dx=\int \frac{-2 t^2+4 t+2}{9 t^4-64 t^3+18 t^2+64 t+9}\,dt$$
$$\frac{-2 t^2+4 t+2}{9 t^4-64 t^3+18 t^2+64 t+9}=\frac{-2 t^2+4 t+2}{\left(t^2-8 t+9\right) \left(9 t^2+8 t+1\right)}=$$
$$\frac{4-t}{20 \left(t^2-8 t+9\right)}+\frac{9 t+4}{20 \left(9 t^2+8 t+1\right)}$$
$$I=\frac{1}{40} \log \left(\left|\frac{9 t^2+8 t+1}{t^2-8 t+9}\right|\right)=\frac{1}{40} \log \left(\left|\frac{5-4 \cos (x)+4 \sin (x)}{5+4 \cos (x)-4 \sin
   (x)}\right|\right)$$  Plug your numbers.
A: Same solution, made slightly more general.
Let $a,b,c$ be real numbers such that
$$
c^2 = a^2 + b^2\ , \qquad a,c>0\ .
$$
Consider now the integral
$$
\begin{aligned}
J = J(a,b,c)
&:= 
\int_0^{\pi/4}
\frac{\sin x+\cos x}{a^2 + b^2 \sin 2x}\; dx
=
\int_0^{\pi/4}
\frac{\sqrt 2\cos y}{a^2 + b^2 \cos 2y}\; dy
=
\int_0^{\pi/4}
\frac{\sqrt 2\cos y}{c^2 - 2b^2 \sin^2y}\; dy
\\
&=
\int_0^1
\frac1{c^2 - b^2 s^2}\; ds
=
\frac 1{2c}
\int_0^1
\left(
\frac1{c - bs} + 
\frac1{c + bs}
\right)
\; ds
=\frac 1{2bc}\left[\log\frac{b+cs}{b-cs}\right]_0^1
\\
&=\frac 1{2bc}\log\frac{b+c}{b-c} 
\ .
\end{aligned}
$$
The passage from $dx$ to $dy$ uses the substitution
$y=\pi/4-x$, the term in $\sin 2x$ from the denominator becomes $\cos 2y$, and in the numerator $\sin x+\cos x=\sqrt 2\cos(\pi/4-x)=\sqrt 2\cos y$.
Then we have substituted $\sqrt 2\sin y=s$.
In our case, $a,b,c$ are $3,4,5$. So the answer is
$$
\frac 1{2\cdot4\cdot5}\log\frac{5+4}{5-4}
=\frac 1{40}\log 9
=\frac 1{20}\log 3
\ .
$$
