How find this integral $\int_{0}^{\pi}\frac{2t+2\cos{x}}{t^2+2t\cos{x}+1}dx$?

Find this follow integral $$F(t)=\int_{0}^{\pi}\dfrac{2t+2\cos{x}}{t^2+2t\cos{x}+1}dx$$ where $t\in R$

my try: $$F(t)=\int_{0}^{\frac{\pi}{2}}\dfrac{2t+2\cos{x}}{t^2+2t\cos{x}+1}dx+\int_{\frac{\pi}{2}}^{\pi}\dfrac{2t+2\cos{x}}{t^2+2t\cos{x}+1}dx=I_{1}+I_{2}$$ where $$I_{2}=\int_{0}^{\frac{\pi}{2}}\dfrac{2t-2\cos{x}}{t^2-2t\cos{x}+1}dx$$ then \begin{align*}I_{1}+I_{2}&=2\int_{0}^{\frac{\pi}{2}}\dfrac{(t+\cos{x})(t^2-2t\cos{x}+1)+(t-\cos{x})(t^2+2t\cos{x}+1)}{(t^2+1)^2-(2t\cos{x})^2}dx\\ &=4t\int_{0}^{\frac{\pi}{2}}\dfrac{t^2-2\cos^2{x}+1}{-4t^2\cos^2{x}+(t^2+1)^2}dt \end{align*} then I fell very ugly, have other methods? Thank you

2 Answers

I think this is the best way to look at it as it's the most intuitive: $$2 \Re\left(\frac{1}{t+e^{i x}}\right)=\frac{1}{t+e^{i x}}+\frac{1}{t+e^{-i x}}=\frac{2 t+ 2 \cos (x))}{t^2+2 t \cos (x)+1}$$ So, we have: $$F(t)=\int_{0}^{\pi}\dfrac{2t+2\cos{x}}{t^2+2t\cos{x}+1}dx=\int_{0}^{\pi}2 \Re\left(\frac{1}{t+e^{i x}}\right) dx=2 \Re \left( \int_{0}^{\pi} \frac{1}{t+e^{i x}} dx\right)=\frac{2 \pi}{t}$$ And of course, I assume that $|t| > 1$ to avoid any singularities.

Any integral of a function that is rational in $\sin(x)$ and $\cos(x)$ can be transfored to an integral of a rational function using Weierstrass substitution. You might try that and see what happens.

\begin{align} \int_0^\pi\frac{2t+2\cos x}{t^2+2t\cos(x)+1}\,dx &=\int_0^\infty\frac{2t+2\frac{1-u^2}{1+u^2}}{t^2+2t\frac{1-u^2}{1+u^2}+1}\,\frac{1}{1+u^2}\,du\\ &=\int_0^\infty\frac{2t(1+u^2)+2(1-u^2)}{(t^2+1)(1+u^2)^2+2t(1-u^4)}\,du\\ &=\int_0^\infty\frac{(2t+2)+(2t-2)u^2}{(t^2+1)(1+u^2)^2+2t(1-u^4)}\,du\\ &=\int_0^\infty\frac{(2t+2)+(2t-2)u^2}{u^4(t^2-2t+1)+u^2(2t^2+2)+(t^2+2t+1)}\,du\end{align}

Since the denominator is quadratic in $u^2$, it's possible to factor it into linear factors in terms of $t$ and then use partial fraction decomposition to get an antiderivative.