I am trying to solve the definite integral given below.
$ I = \int_{0}^\pi \frac{1}{cos^2x + 4sin^2x} dx $
Shown below is the plot of the integrand function (as shown on wolfram alpha). It doesn't show any discontinuity in$[0,\pi]$ interval. The correct answer here is $\pi/2$. However, I am getting different answers when I take different approaches (summarized below). I am looking for the correct way to solve such problems.
Common part of the solution
On simplifying the integrand further, we get $ I = \int_{0}^\pi \frac{sec^2x}{1 + 4tan^2x} dx $. This modified integrand does seem to have a discontinuity at $\pi/2$. However, I am not sure about this, as the plot of this modified integrand, as shown on wolfram alpha, is the same as that of the original integrand.
First approach
Try to find the indefinite integral $F(x)$ = $\int \frac{sec^2x}{1 + 4tan^2x} dx$.
Put $tanx = t$. On solving we get,
$F(t)$ = $\int \frac{dt}{1 + 4t^2} dt$ = $\frac{1}{4}\int \frac{dt}{(\frac{1}{2})^2 + t^2} dt$ = $\frac{1}{2} arctan(2t) + C$.
Hence $F(x)$ = $\frac{1}{2} arctan(2tanx) + C$
Now $I = [F(x)] \Big|_0^\pi$ = $[\frac{1}{2} arctan(2tanx)] \Big|_0^\pi$ = $0$
If I understand right, this approach is incorrect as $tanx$ is not defined at $\pi/2$ (which is in the interval $[0,\pi]$).
Second approach
As the integrand seems to have a discontinuity at $\pi/2$, break the given interval.
$I$ = $\lim_{l \to \frac{\pi-}{2}}$ $\int_{0}^l \frac{sec^2x}{1 + 4tan^2x} dx$ + $\lim_{m \to \frac{\pi+}{2}}$ $\int_{m}^\pi \frac{sec^2x}{1 + 4tan^2x} dx$
Hence,
$I$ = $\lim_{l \to \frac{\pi-}{2}}$ $[\frac{1}{2} arctan(2tanx)] \Big|_0^l$ + $\lim_{m \to \frac{\pi+}{2}}$ $[\frac{1}{2} arctan(2tanx)] \Big|_m^\pi$
on solving,
$I = \frac{1}{2}[arctan(+\infty) - arctan(0)] + \frac{1}{2}[arctan(0) - arctan(-\infty)]$
$ = \frac{1}{2}[\frac{\pi}{2} - 0] + \frac{1}{2}[0 - \frac{\pi}{2}] = 0$
So this approach also seems incorrect.
Third approach
Using property $\int_{0}^{2a} f(x)dx = 2 \int_{0}^a f(x)dx$, when $f(2a-x) = f(x)$
We get $I = 2 \int_{0}^\frac{\pi-}{2} \frac{sec^2x}{1 + 4tan^2x} dx = [arctan(2tanx)] \Big|_0^\frac{\pi-}{2} = [arctan(-\infty) - arctan(0)] = \pi/2$
This approach seems to be giving the correct answer
Fourth approach
This builds on top of the third approach. Divide the interval $[0,\frac{\pi}{2}]$ further into $[0,\frac{\pi}{4}]$ and $[\frac{\pi}{4},\frac{\pi}{2})$ and modify the second integrand as shown below.
$I$ = $\int_{0}^\pi \frac{1}{cos^2x + 4sin^2x} dx$ = $2\int_{0}^\frac{\pi}{2} \frac{1}{cos^2x + 4sin^2x} dx$
Hence, $I$ = $2[\int_{0}^{\frac{\pi}{4}} \frac{1}{cos^2x + 4sin^2x} dx + \int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{1}{cos^2x + 4sin^2x} dx]$
$ = 2[\int_{0}^{\frac{\pi}{4}} \frac{sec^2x}{1 + 4tan^2x} dx + \int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{-cosec^2x}{cot^2x + 4} dx]$
None of the integrands in the above expression has any discontinuity in their respective intervals. On solving it, we get $\pi/2$ as the answer. The textbook which I am following takes this approach.
I have the following three questions.
Questions
As far as I understand, the original integrand does not have any discontinuity in the interval $[0,\pi]$. However, the modified integrands-the ones involving $tanx$ and $cotx$ terms-do have discontinuities at $\pi/2$ and $0$ respectively. Is this understanding correct?
Why did the third approach work while the second one fail despite both seemingly attempting to take care of the discontinuity at $\pi/2$ by breaking the interval into subintervals?
Are there any general working rules to keep in mind while solving such problems?
P.S. I am not a formal student. Trying to self-learn basic concepts. I apologize if I may be missing something quite basic or if this question does not appear well researched.
