Problem with calculation this integral: $\int_0^\pi \frac{dx}{1+3\sin^2x}$

Question

Calculate this integral: $$\displaystyle\int_0^\pi \frac{dx}{1+3\sin^2x}$$


Solution

$$I=\displaystyle\int \frac{dx}{1+3\sin^2x}=\displaystyle\int \frac{dx}{\cos^2x+4\sin^2x}=\displaystyle\int \frac{\sec^2x\;dx}{1+4\tan^2x}$$ Let's apply substitution $u=2\tan x$, so $du=2\sec^2x\;dx$ $$I=\dfrac12\displaystyle\int \frac{du}{1+u^2}=\frac12\arctan(u)+c=\frac12\arctan(2\tan x)+c$$ In this case; $$\displaystyle\int_0^\pi \frac{dx}{1+3\sin^2x}=\left[\frac12\arctan(2\tan x)\right]_{x=0}^{x=\pi}=0$$.


But we know that: $$\frac{1}{1+3\sin^2 x} \ge \frac14$$ Therefore; $$\displaystyle\int_0^\pi \frac{dx}{1+3\sin^2x} \ge \displaystyle\int_0^\pi \frac{dx}{4}=\frac{\pi}4$$ On the other hand; $$0 \ge \frac{\pi}4$$ which is not true.

1) Where is the problem? (Why?) 2) How we can correct this mistake by applying the same substitution?


Solution 1:

The issue becomes evident once we look into the graph of the actual antiderivative and the answer you found:

$\hspace{7em}$enter image description here

The red line is your answer $x \mapsto \frac{1}{2}\arctan(2\tan x)$ while the gray dashed-line is the actual integral $x \mapsto \int_{0}^{x} d\theta/(1+3\sin^2\theta)$.

This discrepancy can be tracked down to the fact that your substitution $u = \tan\theta$ has discontinuity at $\theta = \pi/2$. In particular, $\tan\theta$ is not differentiable at $\theta = \pi/2$. Since the antiderivative technique is the reverse process of differentiation and differentiation fails at discontinuity, it is not surprising that anti-differentiation often fails at discontinuity.

There are some workarounds for this issue.

Reducing. One way is to manipulate your integral so that your substitution no longer suffers from this issue. Various symmetries can be exploited for this task. For instance, you can write $$ \int_{0}^{\pi}\frac{d\theta}{1+3\sin^2\theta} = \int_{-\pi/2}^{\pi/2}\frac{d\theta}{1+3\sin^2\theta} = 2 \int_{0}^{\pi/2}\frac{d\theta}{1+3\sin^2\theta} $$ and apply the substitution $u = \tan\theta$ to any of the last 2 integrals.

Gluing. Although your substitution does not work on all of $[0, \pi]$, it does work on each subintervals $[0,\pi/2)$ and $(\pi/2, \pi]$. So your answer remains valid on each of these intervals. This suggests that $$ \int_{0}^{x}\frac{d\theta}{1+3\sin^2\theta} = \begin{cases} \frac{1}{2}\arctan(2\tan x) + C_1, & x \in [0, \frac{\pi}{2}) \\ \frac{1}{2}\arctan(2\tan x) + C_2, & x \in (\frac{\pi}{2}, \pi] \end{cases} $$ Since the LHS is continuous on $[0,\pi]$, you can determine $C_1$ and $C_2$ so that the right-hand is also continuous at $x = \pi/2$.

Solution 2:

The problem is that $\tan{x}$ is not continuous at $x=\pi/2$, so the derivative doesn't exist and you can't substitute on this interval. There are several ways around this:

  1. Drawing the graph of $\tan{x}$ on $(0,\pi)$, we see it is initially positive, has a vertical asymptote at $x=\pi/2$, then returns from being very negative to $0$ at $x=\pi$. Therefore the substitution will work fine on $(0,\pi/2)$ and $(\pi/2,\pi)$ separately. This gives you $$ \left[ \frac{1}{2}\arctan{2\tan{x}} \right]_{0}^{\pi/2} + \left[ \frac{1}{2}\arctan{2\tan{x}} \right]_{-\pi/2}^{0} = \frac{1}{2}\left(\lim_{y \to \infty}\arctan{y} - \arctan{0} +\arctan{0}- \lim_{y \to -\infty}\arctan{y} \right) = \frac{\pi}{2}. $$

  2. $\sin{(\pi-x)} = \sin{x}$, so the integral is double the integral from $0$ to $\pi/2$, and as we noted, the substitution has no problem there.

  3. Use $t=\tan{\frac{1}{2}x}$. This will work since $t$ depends continuously on $x$. (This does give a nastier rational function, though.)

  4. Similar to 2., but shift the interval of integration to $(-\pi/2,\pi/2)$. Again, $\tan{x}$ is continuous on here, and we notice the calculation gives the same answer as 1.

Solution 3:

HINT: write $$ \int_0^{\pi}\frac{dx}{1+3\sin^2x}=\frac{1}{2}\int_0^{\pi/2}\frac{dx}{1+3\sin^2x}. $$ Then, the substitution you suggest is legitimate because $\tan x$ is monotone on $(0,\pi/2)$.