$$I=\int\frac{1}{2+\cos\theta}d\theta$$
When trying to solve this integral my calculus-book states that we can use the following substitution:
$$x=\tan(\theta/2)$$$$\cos\theta=\frac{1-x^2}{1+x^2}$$$$d\theta=\frac{2dx}{1+x^2}$$
This substitution results in this easier to solve integral:
$$I=\int\frac{2}{3+x^2}dx$$
My question is about the validity of this substitution for values where $x$ does not exist, for example at $\theta=\pi$, at which $\tan(\theta/2)$ is not defined.
I don't understand how the substitution can be valid in general while $x$ is not defined for all values of $\theta$.
first find out the final function after integration. you notice that if you put θ= pi in the function the answer is not undefined.