# How to calculate: $\int_{-7 \pi}^{2 \pi} \frac{1}{2 \sin(x) - \cos(x) + 5} dx$

How to calculate the value of this Riemann integral?

$$\int_{-7 \pi}^{2 \pi} \frac{1}{2 \sin(x) - \cos(x) + 5} dx$$

I used the universal trigonometric substitution and found the following antiderivative of the integrand function:

$$\int\frac{1}{2 \sin(x) - \cos(x) + 5} dx = \frac{\arctan \left( \frac{3 \tan \left( \frac{x}{2} \right) }{\sqrt{5}} + 1 \right) }{\sqrt{5}} + const$$

We cannot simply use the Newton-Leibniz formula by simply substituting $$- 7\pi$$ and $$2 \pi$$, because $$\tan \left(-\frac{7\pi}{2} \right)$$ is not defined. I don’t quite understand what needs to be done in this case.

However, I can add that universal trigonometric substitution works for $$\forall x \in (-\pi + 2\pi k, \pi + 2\pi k), k \in \mathbb{Z}$$. And for the original integral, the boundaries of integration do not coincide with $$\forall x \in (-\pi + 2\pi k, \pi + 2\pi k), k \in \mathbb{Z}$$, and this introduces me further more at a dead end.

I would be grateful for any hints and solutions to this task! Also, if you know any web site that explains how to calculate Riemann integrals in such situations, then please leave a link to them in the comments.

Actually, it should be$$\frac1{\sqrt5}\arctan\left(\frac{3\tan\left(\frac x2\right)+1}{\sqrt5}\right).$$Anyway, since the function that you want to integrate is periodic wih period $$2\pi$$, your integral is equal to$$4\int_{-\pi}^\pi\frac1{2\sin(x)-\cos(x)+5}\,\mathrm dx+\int_\pi^{2\pi}\frac1{2\sin(x)-\cos(x)+5}\,\mathrm dx.\label{a}\tag1$$Now, since\begin{align}\int_{-\pi}^\pi\frac1{2\sin(x)-\cos(x)+5}\,\mathrm dx&=\left[\frac1{\sqrt5}\arctan\left(\frac{3\tan\left(\frac x2\right)+1}{\sqrt5}\right)\right]_{x=-\pi}^{x=\pi}\\&=\frac1{\sqrt5}\left(\frac\pi2-\left(-\frac\pi2\right)\right)\\&=\frac\pi{\sqrt5}\end{align}and\begin{align}\int_\pi^{2\pi}\frac1{2\sin(x)-\cos(x)+5}\,\mathrm dx&=\left[\frac1{\sqrt5}\arctan\left(\frac{3\tan\left(\frac x2\right)+1}{\sqrt5}\right)\right]_{x=\pi}^{x=2\pi}\\&=\frac1{\sqrt5}\left(\arctan\left(\frac1{\sqrt5}\right)-\left(-\frac\pi2\right)\right)\\&=\frac{2\arctan\left(\frac1{\sqrt5}\right)}{2\sqrt5},\end{align}the integral \eqref{a} is equal to$$\frac{2\arctan\left(\frac1{\sqrt5}\right)+9\pi}{2\sqrt5}.$$
The Newton-Leibniz formula can still be applied if a continuous primitive is utilized as below \begin{align} &\int_{-7 \pi}^{2 \pi} \frac{1}{2 \sin x - \cos x + 5} \ dx\\ =& \ \frac1{2\sqrt5}\left( x+2\cot^{-1}\frac{5+2\sqrt5 -\cos x+2\sin x} {\sin x+2\cos x}\right)\bigg|_{-7\pi}^{2\pi}\\ =&\ \frac1{2\sqrt5} \left(9\pi +2\cot^{-1}{\sqrt5}\right) \end{align}