# Elementary definite integral problem

I was evaluating the elementary integral: $$\int_0^{2\pi} \sec^2\frac{x}{2}dx$$ Evaluating the expression and substituting limits, we get, $$2\bigg[\tan\frac{x}{2}\bigg]_0^{2\pi}=2\bigg[\tan \frac{2\pi}{2}-\tan\frac{0}{2}\bigg]=2\bigg[0-0\bigg]=0$$ This seems like a valid solution, except, when I run it on Wolfram or Integral Calculator, it says the integral is divergent.

Where am I going wrong? How is the integral divergent?

• The integrand is not defined at $\pi$... – TheSimpliFire Feb 18 '18 at 15:07
• You can see why it does diverge because at $x = \pi$ it's not defined. If you split the integral into $\int_0^{\pi} + \int_{\pi}^{2\pi}$ you will see it. – Von Neumann Feb 18 '18 at 15:08
• You could spot that the function $\sec^2x$, which is positive, can't have an integral which is zero. – Michael Feb 18 '18 at 15:10
• @TheSimpliFire Actually, it is defined at $\pi$... – José Carlos Santos Feb 18 '18 at 15:12
• @JoséCarlosSantos No it's not. The integrand is $\sec^2(x/2)$, not $\sec^2x$ :) – TheSimpliFire Feb 18 '18 at 15:14

Note that $\sec$ is not defined at $\pi$. So, your integral is really the sum of several improper integrals, the first one of which is$$\lim_{u\to\pi^-}\int_0^u\sec^2\left(\frac x2\right)\,\mathrm dx.$$This integral diverges.
The integral is not defined at $x = \pi$. You can however calculate the principal value:
$$\text{PV} = \lim_{\epsilon \to \pi} \left(\int_{0}^{\epsilon} + \int_{\epsilon}^{2\pi}\right) \sec^2\left(\frac{x}{2}\right)\ dx$$