# Integrate $\int_{0}^{\pi} \frac{1}{1+3^{\cos x}} dx.$

I am not able to solve the following integration, $$\int_{0}^{\pi} \frac{1}{1+3^{\cos x}} dx.$$ I have tried in different ways but most good one I think,
\begin{align*} \int_{0}^{\pi} \frac{1}{1+3^{\cos x}} dx &= \int_{0}^{\pi} \frac{\sin x}{\sin x (1+3^{\cos x})} \\ &= \int_{-1}^{1} \frac{dz}{\sqrt{1-z^2} (1+3^{z})}.\end{align*} Now how could I proceed. Please help me.

• Commented Feb 5, 2020 at 8:30

$$I=\int_{0}^{\pi} \frac{dx}{1+3^{\cos x}}$$ Use $$\int_{0}^{a} f(x) dx=\int_{0}^{a} f(a-x) dx.$$ $$I = \int_{0}^{\pi} \frac{dx}{1+3^{-\cos x}}.$$ Adding these two we get $$2I=\int_{0}^{\pi} 1 dx\implies I=\frac{\pi}{2}$$

• +1 elegant answer ........ Commented Feb 9, 2020 at 16:42

Just for the fun of it.

Dr Zafar Ahmed DSc provided the good solution.

For the fun of it, I did consider the more general problem of $$\int_{a}^{\pi-a} \frac{dx}{1+k^{\cos x}}$$

Expanding the integrand as a Taylor series built around $$x=\frac \pi 2$$ we have $$\frac{1}{1+k^{\cos x}}=\frac{1}{2}+\frac{\log (k)}{4} \left(x-\frac{\pi }{2}\right) -\frac{\log (k) \left(\log ^2(k)+2\right)}{48} \left(x-\frac{\pi }{2}\right)^3 +\frac{\log(k)\left(\log ^4(k)+5 \log ^2(k)+1\right)}{480} \left(x-\frac{\pi }{2}\right)^5 +O\left(\left(x-\frac{\pi }{2}\right)^7\right)$$ which, as expected, shows only odd powers of $$\left(x-\frac{\pi }{2}\right)$$.

As a result $$\int_{a}^{\pi-a} \frac{dx}{1+k^{\cos x}}= \frac{\pi }{2}-a\qquad \forall k >0$$