$$\int_0^{\pi} \frac{(\sec x)^2}{2+(\tan x)^2} dx $$
I have made the substitution of of $\tan x=u$ but that makes the lower limit and upper limit both equal to $0$ since $\tan \pi=0$ and my result becomes $0$.
What mistake am I making here?
$$\int_0^{\pi} \frac{(\sec x)^2}{2+(\tan x)^2} dx $$
I have made the substitution of of $\tan x=u$ but that makes the lower limit and upper limit both equal to $0$ since $\tan \pi=0$ and my result becomes $0$.
What mistake am I making here?
The substitution is not valid. In fact $\tan x$ is not even finite at $\pi/2$. Instead, just split the integral into integral from $0$ to $\pi/2$ and the one from $\pi/2$ to $\pi$. In each of the terms make the substitution $u=\tan x$. [$\tan x$ is one-to-one in each of the intervals $(0,\pi/2)$ and $(\pi/2, \pi)$]. We get $\int_0^{\infty} \frac 1 {2+y{2}} dy+ \int_{-\infty} ^{0} \frac 1 {2+y{2}} dy$. Can you finish?
The integral to be calculated is
$$i=\int_0^{\pi} \frac{(\sec x)^2}{2+(\tan x)^2}\, dx $$
Before we think about substitutions we simplify the integrand:
$$\frac{(\sec x)^2}{2+(\tan x)^2} =\frac{(\sec x)^2}{1+(1+(\tan x)^2)}=\frac{(\sec x)^2}{1+\frac{1}{\cos(x)^2}}=\frac{1}{1+\cos(x)^2}$$
As the integrand is symmetric about $x=\frac{\pi}{2}$ we can write
$$i = 2 \int_0^{\frac{\pi}{2}} \frac{1}{1+\cos(x)^2}\, dx$$
Substituting $x=\operatorname{arctan}(t), x\in(0,\frac{\pi}{2}) \to t \in (0,\infty), dx=\frac{dt}{1+t^2}, \cos(x) = \frac{1}{\sqrt{1+t^2}}$ the integral becomes
$$i = \int_0^{\infty } \frac{2}{t^2+2} \, dt=\frac{\pi }{\sqrt{2}}$$