What is the antiderivative of $\frac{1}{5-3\cos x}$? I'm having trouble deciding what the antiderivative of $f(x)=\frac{1}{5-3\cos x}$ is. On the one hand, it is tempting to say it is $F(x)=\frac{1}{2} \arctan (2\tan \frac{x}{2})$. However, this would make the Second Fundamental Theorem of Calculus invalid, since $f$ is integrable on $[0,2\pi]$ but apparently $\int_0^{2\pi} f(x) dx \neq F(2\pi)-F(0)=0$.
Clearly $f$ is continuous so it must have an antiderivative, what is it?
 A: Here's a graph of the antiderivative $F(x)$:

You can see the function is periodic and discontinuous. In particular it'll have jumps at $\pm \pi, \pm 3 \pi, \pm 5 \pi$, etc since those are the points where $\tan(\frac x 2)$ jumps from $+ \infty$ to $- \infty$.
The second part of the F.T.C. includes a requirement that $F$ must be continuous on the interval we care about. That means you can't just plug in $0$ and $2 \pi$, since those are not in the same "continuous segment" of $F$. Another way of saying this is: $F$ is not a valid antiderivative of $f$ on any interval that contains one of these discontinuities.
Instead, once you see where $F$ is continuous, you could rewrite your integral as $\int_{-\pi}^{\pi} f(x) dx$ (using the fact that your integrand is periodic) and then evaluate as
$$\lim_{x \to \pi^-} F(x) - \lim_{x \to -\pi^+} F(x) = \left( \frac \pi 4 \right) - \left( - \frac \pi 4 \right) = \frac \pi 2$$
which is the correct value for this definite integral.

If you don't want to use the "periodicity trick", then an alternate strategy is to "break the integral up into chunks so $F$ is continuous on each chunk".
$$
\begin{align}
\int_0^{2 \pi} f(x) dx &= \int_{0}^\pi f(x) dx + \int_\pi ^{2 \pi} f(x) dx \\
&= \left[\lim_{x \to 0^-} F(x) - \lim_{x \to -\pi^+} F(x) \right]
+ \left[\lim_{x \to \pi^-} F(x) - \lim_{x \to 0^+} F(x) \right] \\
&= \left[ \frac \pi 4 - 0 \right] + \left[ 0 - \left(-\frac \pi 4\right) \right] \\
&= \frac \pi 2.
\end{align}
$$
This takes a couple of extra steps, but it's also more straightforward: you don't need to rely on noticing $f$ is periodic, you just need to know where $F$ is discontinuous.
A: You can consider $F(x)=\frac{1}{2} \arctan (2\tan \frac{x}{2})$ as an antiderivative in the interval $(-\pi,\pi)$. Then with a little effort, extend it to an antiderivative in $\Bbb R$:
$$F(x) = \begin{cases}
\frac{1}{2} \arctan (2\tan \frac{x}{2}) + \frac{\pi}{2}\lfloor\frac{x}{2\pi}+\frac{1}{2}\rfloor \text{ if } x\not\in \pi\Bbb Z\\
\frac{x}{4} \text{ if } x \in \pi\Bbb Z
\end{cases}$$
See here
