Integration by Substitution with $~ t=\tan^{}\left( \frac{ \theta_{} }{ 2 } \right) ~$ The angle was halved I've been encountering the problem of the below integration.
$$  \int_{0 }^{2\pi  } \frac{  d\theta   }{  R+ r \cdot \cos^{}\left(\theta_{} \right)   }  \tag{1}   $$
The official description states that the above integration formula can be calculated using substitution of integration.
$$  t=\tan^{}\left( \frac{  \theta_{}   }{  2  }  \right)  $$
$$ \therefore ~~  \int_{0 }^{2\pi  } \frac{  d\theta   }{  R+ r \cdot \cos^{}\left(\theta_{} \right)   } = \frac{  2\pi   }{  \sqrt{ R ^{2} -r ^{2}  }   }    $$
Currently I can't derive the above RHS.
I think firstly find out the form of result of calculations of indefinite integral of eqn1 is wiser way.
What I tried so far are as below.
$$  t= \tan^{}\left( \frac{  \theta_{}   }{  2  }  \right)  $$
$$  \frac{  \theta_{}   }{  2  }= \tan^{-1} \left( t \right) ~~ \leftarrow~~ \text{Thought that this approach won't work}  $$
$$  \frac{  dt  }{  d\theta   } = \sec^{2}\left( \frac{  \theta_{}   }{  2  }  \right) \cdot \frac{1}{2}  $$
$$  \frac{  2dt  }{  d\theta   } = \sec^{2}\left( \frac{  \theta_{}   }{  2  }  \right)   $$
$$  \frac{  d\theta   }{  2 dt  } =\sec^{-2}\left( \frac{  \theta_{}   }{  2  }   \right)  $$
$$  \frac{  d\theta   }{  2 dt  } = \left( \sec^{}\left( \frac{  \theta_{}   }{  2  }  \right)    \right)^{-2}  $$
$$  \frac{  d\theta   }{  2 dt  } = \left( \cos^{-1}\left( \frac{  \theta_{}   }{  2  }  \right)    \right)^{-2}  $$
$$  \frac{  d\theta   }{  2 dt  } =  \cos^{2}\left( \frac{  \theta_{}   }{  2  }  \right)     $$
$$  d\theta = 2 dt \cdot \cos^{2}\left(\frac{  \theta_{}   }{  2  } \right)  $$
First things to first, the equation1 has $~ \cos^{}\left(\theta_{} \right)  ~$ however how can I handle $~  t=\tan^{}\left( \frac{  \theta_{}   }{  2  }  \right)   ~$ ??
 A: The goal with the $t=\tan\frac{\theta}{2}$ substitution is to find all trig functions in terms of $t$. Of course with any integral substitution, the first thing is to find $\frac{dt}{d\theta}$.
$$\frac{dt}{d\theta}=\frac{1}{2}\sec^2\frac{\theta}{2}$$
$$\frac{dt}{d\theta}=\frac{t^2+1}{2}$$
Since we also have a $\cos\theta$ term in our integrand, we need to find $\cos\theta$ in terms of $t$. We start with
$$\cos\theta=2\cos^2\frac{\theta}{2}-1$$
$$\cos\theta=\frac{2}{\sec^2\frac{\theta}{2}}-1$$
$$\cos\theta=\frac{2}{t^2+1}-1$$
$$\cos\theta=\frac{1-t^2}{t^2+1}$$
As for the bounds of the resulting integral, we can split the bounds in half, apply the substitution, and then merge the two bounds. This gives us a bounds of $t\in (-\infty,\infty)$, providing that both halves are finite. Our integral is now
$$\int_{-\infty}^\infty \frac{2}{t^2+1}\cdot\frac{1}{R+\frac{1-t^2}{t^2+1}r}\, dt$$
$$=\int_{-\infty}^\infty 2\cdot\frac{1}{(R-r)t^2+(R+r)}\, dt$$
$$=\frac{2}{R+r}\int_{-\infty}^\infty \frac{dt}{\frac{R-r}{R+r}t^2+1}$$
$$=\frac{2}{\sqrt{R^2-r^2}}\left[\tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)\right]_{-\infty}^\infty$$
As long as $R>r$, then we can see that
$$\lim_{t\to\infty} \tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)=\frac{\pi}{2}$$
$$\lim_{t\to -\infty} \tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)=-\frac{\pi}{2}$$
Hence, our integral evaluates to
$$=\boxed{\frac{2\pi}{\sqrt{R^2-r^2}}}$$
A: Hints:

*

*The function is even, relative to the oy axis $ \Rightarrow$ we can change the limits of integration $ 2\int_{0}^{\pi} \dfrac{d \theta}{r(\frac{R}{r}+\cos(\theta))}$

*Replacement $$ \theta =\arccos(t)$$
Then:

$$  d\theta = -\frac{dt}{\sqrt{1-t^{2}}}$$
$$ \cos(\arccos(t))=t $$
The integral is simplified to the form:
$$ -2\int_{0}^{\pi}\frac{\frac{dt}{\sqrt{1-t^{2}}}}{r(\frac{R}{r}+t)}$$
Finally, you can use the Chebyshev substitution!
enter link description here
A: Try to solve the problem using the following two equations:
\begin{equation}
\cos(2x)= 2\cos^2(x)-1, \\
\cos^2(x)= \frac{1}{1+ \tan^2(x)}. 
\end{equation}
It would be better if you would work on the problem by yourself now, however, I'll write a detailed answer below this line. If you don't want to read it then don't scroll further.

We want to calculate
$$
\int _0^{2\pi}\frac{d\theta}{R+ r\cos\theta}. 
$$
Set
$$
t= \tan\left(\frac\theta2 \right),
$$
then $\theta= 2\arctan(t)$, and hence
$$
d \theta= \frac{2}{1+t^2}d t. 
$$
Moreover,
$$
\cos\theta= \cos(2\arctan t)= 2\cos^2(\arctan t)-1 = \frac{2}{1+ \tan^2(\arctan t)}-1= \frac{2}{1+t^2}-1= \frac{1-t^2}{1+t^2}.
$$
Putting these together we have
\begin{equation}
\int _0^{2\pi}\frac{d\theta}{R+ r\cos\theta}= 2\int _0^{\pi}\frac{d\theta}{R+ r\cos\theta}= 2\int_0^{+\infty} \frac{\frac{2}{1+t^2}}{R+ r\frac{1-t^2}{1+t^2}} dt= 2\int_0^{\infty} \frac{2}{R(1+t^2)+r (1-t^2)}dt=  4\int_0^\infty\frac{dt}{(R+r)+ t^2(R-r)}= \frac{4}{R+r}\int_0^\infty\frac{dt}{1+ \frac{R-r}{R+r}t^2}= \frac{4}{\sqrt{R+r}\sqrt{R-r}}\int_0^\infty \frac{du}{1+u^2}= \frac{4}{\sqrt{R^2-r^2}}[\arctan u]\Big|_0^{+\infty}= \frac{2\pi}{\sqrt{R^2-r^2}},
\end{equation}
where we used the substitution $u= \frac{\sqrt{R-r}}{\sqrt{R+r}}t$.
A: Note that:
$$\cos(\theta)=\cos(2\frac{\theta}2)=\cos^2(\frac{\theta}2)-\sin^2(\frac{\theta}2)=\frac{\cos^2(\frac{\theta}2)-\sin^2(\frac{\theta}2)}{\cos^2(\frac{\theta}2)+\sin^2(\frac{\theta}2)}$$
Simplify by $\displaystyle{\cos^2(\frac{\theta}2)}$:
$$\cos(\theta)=\displaystyle{\frac{1-\tan^2(\frac{\theta}2)}{1+\tan^2(\frac{\theta}2)}}$$.
With the above, the integrand becomes:
$$\displaystyle{\frac{1}{R+r\cdot\frac{1-\tan^2(\frac{\theta}2)}{1+\tan^2(\frac{\theta}2)}}=\frac{1+\tan^2(\frac{\theta}2)}{R(1+\tan^2(\frac{\theta}2))+r(1-\tan^2(\frac{\theta}2))}}$$
Substitute $t=\tan(\frac{\theta}2)$. It follows that $dt=\frac12(1+\tan^2(\frac{\theta}2))d\theta$ and the integral becomes:
$$2\cdot2\int_0^\infty\frac{1}{R(1+t^2)+r(1-t^2)}dt$$ which you should be able to easily solve.
