<s>[INST] Riemann integral on trigonometric functions I have to calculate Riemann integral of function $g:[0;\pi/4]\rightarrow\mathbb{R}$ (on interval $[0;\pi/4]$) given as $g(x)=\frac{\tan(x)}{(\cos(x)^2-4)}$. Function $g$ is continous on interval $[0;\pi/4]$ so it is enough to calculate $\int_0^{\frac{\pi}{4}}{\frac{\tan(x)}{(\cos(x)^2-4)}}$. How to do that?
 [/INST] Hint: let $t=\tan(\frac{x}{2})$, then
$$\sin(x) = \frac{2t}{1+t^2}, \cos(x) = \frac{1-t^2}{1+t^2}$$
and
$$x=2\arctan(t) \implies dx = \frac{2 dt}{1+t^2}$$
so
$$\begin{aligned}
&\int \frac{\tan(x)}{(\cos(x)^2-4)} dx = \int \frac{\sin(x)}{\cos(x)(\cos(x)-2)(\cos(x)+2)} dx\\
&= \int \frac{2t}{1+t^2} \cdot \frac{1+t^2}{1-t^2} \cdot \frac{1}{\frac{1-t^2}{1+t^2} - 2} \cdot \frac{1}{\frac{1-t^2}{1+t^2} + 2} \cdot \frac{2 dt}{1+t^2}\\
&\ldots
\end{aligned}$$
</s>