# What's $\int \frac{1}{2+\cos 2x}dx$ on earth?

Let's consider a problem, which is to find the indefinite integral $$I(x):=\displaystyle \int \frac{1}{2+\cos 2x}dx.$$ Since the integrand $$f(x):=\dfrac{1}{2+\cos 2x}$$ is continuous over $$(-\infty,+\infty)$$, hence $$I(x)$$ exists necessarily, accoring to the following theorem:

every function continuous over the given interval $$I$$ has its anti-derivative,namely indefinite integral over $$I$$.

Ok, now let's find it. The steps may be not so complicated. \begin{align*} I(x)&=\int \frac{1}{2+\cos 2x}dx\\ &=\frac{1}{2}\int\frac{1}{2+\cos 2x}d(2x)~~~&\textit{2x=u}\\ &=\frac{1}{2}\int\frac{1}{2+\cos u}d(u)\\ &=\frac{1}{2}\int\frac{\sec^2(u/2)}{\tan^2(u/2)+3}du~~~&\textit{(\tan(u/2))/\sqrt{3}=v}\\ &=\frac{1}{\sqrt{3}}\int\frac{1}{v^2+1}dv\\ &=\frac{1}{\sqrt{3}}\arctan v+C\\ &=\frac{1}{\sqrt{3}}\arctan \frac{\tan x}{\sqrt{3}}+C. \end{align*} The result comes out! Is it true? The WA outputs the same result! The problem seems to be done like this. But wait,wait,please scrutinize the form of the obtained indefinite integral. It is not continuous at every $$x=2k\pi\pm \dfrac{\pi}{2}(k=0,\pm 1,\pm 2,\cdots).$$ But, we know that

Every indefinite integral is necessarily continuous at the corresponding inteval.

What's $$\displaystyle \int \frac{1}{2+\cos 2x}dx$$ on earth?

• “it has infinity discontinuity at those points” – no, it has left and right limits $\pm \frac{2}{\pi \sqrt 3}$ at those points. Jun 2 '19 at 7:26
• @MartinR yes, you're right! but the problem is still there. Jun 2 '19 at 7:30
• What interval are you talking about? Remember that when using integration by substitution one has to be careful with the integration bounds. How are you addressing that in your second substitution? Jun 2 '19 at 7:31
• That's not a good idea. Your integrand is at least $1/3$, so such an integral does not converge. Jun 2 '19 at 7:39
• You have found antiderivatives on each interval $(k\pi - \frac \pi 2, k \pi +\frac\pi 2)$, which can be continuously extended to the closed intervals. By adding suitable integration constants you can stitch these together to an antiderivative on $\Bbb R$. (Nobody says that an antiderivative must have a “closed” or “nice” formula). Jun 2 '19 at 7:47

The primitive $$F$$ of $$\frac1{2+\cos x}$$ such that $$F(0)=0$$ is the map$$x\mapsto\begin{cases}\frac1{\sqrt3}\arctan\left(\frac{\tan x}{\sqrt3}\right)&\text{ if }x\in\left[0,\frac\pi2\right)\\\frac\pi{2\sqrt3}&\text{ if }x=\frac\pi2\\\frac1{\sqrt3}\arctan\left(\frac{\tan x}{\sqrt3}\right)+\frac\pi{\sqrt3}&\text{ if }x\in\left(\frac\pi2,\frac{3\pi}2\right)\\\frac{3\pi}{2\sqrt3}&\text{ if }x=\frac{3\pi}2\\\frac1{\sqrt3}\arctan\left(\frac{\tan x}{\sqrt3}\right)+\frac{2\pi}{\sqrt3}&\text{ if }x\in\left(\frac{3\pi}2,\frac{5\pi}2\right)\\\vdots\end{cases}$$and, of course, if $$x<0$$, then $$F(x)=-F(-x)$$.
But you don't need all of this if all you want is to compute $$\int_{-\infty}^\infty\frac{\mathrm dx}{2+\cos x}$$. Since $$(\forall x\in\mathbb R):f(x)\geqslant\frac13$$, that integral is equal to $$\infty$$.
• how would you prove that $F'(x) = f(x)\,\forall x\in\mathbb{R}$? I know one way is to use the definition of a derivative when $x= \dfrac{(2k+1)\pi}{2},k\in\mathbb{Z},$ but that appears wayyy too tedious. I was wondering if there was another way? Or maybe another function that is much easier to differentiate?
• Let $\varphi(x)=\int_0^x\frac{\mathrm dt}{2+\cos t}$. Then $\varphi$ is a primitive of $\frac1{2+\cos x}$ and $\varphi(0)=0$. Since, on $\left(-\frac\pi2,\frac\pi2\right)$, $F$ is also a primitive of $\frac1{2+\cos x}$ and since $F(0)=0$, $\varphi=F$ on $\left(-\frac\pi2,\frac\pi2\right)$. But then$$\lim_{x\to\frac\pi2^-}\varphi(x)=\lim_{x\to\frac\pi2^-}F(x)=\frac\pi{2\sqrt3}.$$Applying the same argument on $\left(\frac\pi2,\frac{3\pi}2\right)$, you get that $F$ and $\varphi$ are equal there and that $\varphi\left(\frac{3\pi}2\right)=\frac{3\pi}{2\sqrt3}$. And so on. Feb 5 '20 at 9:02