<s>[INST] An intriguing definite integral: $\int_{\pi/4}^{\pi/2} \frac{x^2+8}{(x^2-16)\sin (x) + 8 x \cos(x)} \ dx$ I need some hints, suggestions for the following integral
$$\int_{\pi/4}^{\pi/2} \frac{x^2+8}{(x^2-16)\sin (x) + 8 x \cos(x)} \ dx$$
Since it's a high school problem, I thought of some variable change, integration by parts, but I can't see yet how to make them work. I don't know where I should start from. Thanks!
 [/INST] Let $u = 2\tan^{-1}\left(\frac{x}{4}\right) - x$. Then
$$ du = -\frac{x^2 + 8}{x^2 + 16}\,dx. $$
Now since
$$ \begin{align*}
\frac{x^2 + 8}{(x^2 - 16)\sin x + 8x \cos x} 
&= \frac{\frac{x^2 + 8}{x^2 + 16}}{\frac{8x}{16+x^2} \cos x - \frac{16-x^2}{16+x^2}\sin x} \\
&= \frac{\frac{x^2 + 8}{x^2 + 16}}{\sin\left(2\tan^{-1}\left(\frac{x}{4}\right)\right) \cos x - \cos\left(2\tan^{-1}\left(\frac{x}{4}\right)\right)\sin x} \\
&= \frac{\frac{x^2 + 8}{x^2 + 16}}{\sin\left(2\tan^{-1}\left(\frac{x}{4}\right) - x\right)} \\
&= -\frac{1}{\sin u}\frac{du}{dx},
\end{align*}$$
it remains to take integration by substitution.
</s>