<s>[INST] Trig function integral I'm trying to solve
$$\int_{0}^{\pi}\frac{dx}{cos^2(x)-a^2}, \hspace{5mm} 0<a<1$$
There are numerous examples of similar integrals but non with the condiction that $0<a<1$, say $a = 0.5$. Since the function is even one can expand the domain of integration to $2\pi$ and use the residuum theorem, but zeros lie on the unit circle making that method useless. Numerical integration in Mathematica or Fortran is also problematic and filled with errors.
So, does anyone have a clue how to solve this? I encountered this integral while calculating renormalization of energy dispersion in graphene due to electron-phonon interaction.
 [/INST] The Cauchy principal value of the integral is $0$.

We have
$$F(a) = 2\int_0^{\pi/2} \dfrac{dx}{\cos^2(x)-a^2} = 2 \int_0^{\pi/2} \dfrac{\sec^2(x)dx}{1-a^2\sec^2(x)}$$
Setting $\tan(x) = t$, we obtain
\begin{align}
F(a) & = 2 \int_0^{\infty} \dfrac{dt}{1-a^2-a^2t^2} = \dfrac2{a^2} \int_0^{\infty} \dfrac{dt}{\left(\dfrac{1-a^2}{a^2}\right)-t^2}
\end{align}
Note that since $a^2 < 1$, we set $b^2 = \dfrac{1-a^2}{a^2}$, where $b \in \mathbb{R}^+$. We have
\begin{align}
F(a) & = \dfrac2{a^2} \int_0^{\infty} \dfrac{dt}{b^2-t^2}
\end{align}
We will interpret $F(a)$ as the Cauchy principal value of the integral, i.e.,
\begin{align}
\dfrac{a^2F(a)}2 & = \lim_{\delta \to 0^+} \left(\int_0^{b-\delta} \dfrac{dt}{b^2-t^2} + \int_{b+\delta}^{\infty} \dfrac{dt}{b^2-t^2} \right)
\end{align}
We have
\begin{align}
\int_0^{b-\delta} \dfrac{dt}{b^2-t^2} + \int_{b+\delta}^{\infty} \dfrac{dt}{b^2-t^2} & = \dfrac1{2b}\ln\left(\dfrac{b+t}{b-t}\right)_0^{b-\delta} + \left.\dfrac1{2b}\ln\left(\dfrac{t+b}{t-b}\right) \right \vert_{b+\delta}^{\infty}\\
& = \dfrac1{2b}\left(\ln\left(\dfrac{2b-\delta}{\delta}\right)-\ln(1) + \ln(1) - \ln\left(\dfrac{2b+\delta}{\delta}\right)\right)\\
& = \dfrac1{2b}\ln\left(\dfrac{2b-\delta}{2b+\delta}\right)
\end{align}
Hence, we obtain
$$\dfrac{a^2F(a)}2 = \lim_{\delta \to 0^+} \dfrac1{2b}\ln\left(\dfrac{2b-\delta}{2b+\delta}\right)=0$$
</s>