Integration of $\int \frac{dx}{a+f^2(x)}$ I want to solve a integral of the form:
$$
\int \frac{dx}{a+f^2(x)}  
$$
in my particular case I got
$$
\int \frac{dx}{5+\cos^2(x)}
$$
in my case I followed this process:
$$
\int \frac{dx}{5+\cos^2(x)} \\
let \ t = tg(\frac{x}{2}) => 
dx = \frac{2dt}{1+t^2}\\
\int \frac{dx}{5+\cos^2(x)} = \int \frac{\frac{2\,dt}{1+t^2}}{5+(\frac{1-t^2}{1+t^2})^2}\\
$$
Expanding the denominator
$$
5+(\frac{1-t^2}{1+t^2})^2 = \frac{5(1+t^2)^2+(1-t^2)^2}{(1+t^2)^2}
$$
Rewriting all:
$$
\int \frac{2\,dt}{1+t^2} \frac{(1+t^2)^2}{5(1+t^2)^2+(1-t^2)^2} = \\
2 \int \frac{(1+t^2)}{5(1+t^2)^2+(1-t^2)^2}dt
$$
Now I am stuck, I can try to expand the denominator again, but then I cannot divide it for the numerator, something like this:
$$
2 \int \frac{1+t^2}{5(1+2t^2+t^4)+(1-2t^2+t^4)} \,dt = \\
2 \int \frac{1+t^2}{5+10t^2+5t^4+1-2t^2+t^4} \,dt = \\
2 \int \frac{1+t^2}{6t^4+8t^2+6} \,dt = \\
\int \frac{1+t^2}{3t^4+4t^2+3}\, dt
$$
But now I really don't know how to move next...
 A: Let $f$ be the function such that for all real number $x$, $f(x) = \frac{1}{5+\cos^{2}(x)}$. The primitive you want to compute is 
$$ \int f(x) \, dx $$ 
Since $f(x) \, dx$ is invariant under the change of variables $x \rightarrow \pi+x$, the change of variables $t=\tan(x)$ might lead to more simple computations. Let's work with this change of variables. We have : $dt = (1+t^{2})dx$. So,
$$
\begin{align*}
\int \frac{1}{5+\cos^{2}(x)} \, dx &= \int \frac{1}{5 + \frac{1}{t^{2}+1}} \frac{1}{1+t^{2}} \, dt \\
&= \int \frac{1}{5(t^{2}+1)+1} \, dt \\
&= \int \frac{1}{5t^{2}+6} \, dt \\
\end{align*}
$$
And (if I'm not mistaken) :
$$ \int \frac{1}{5t^2+6} \, dt = \frac{1}{\sqrt{30}} \arctan \left( \frac{\sqrt{5}}{\sqrt{6}} t \right)$$
So, the result is :

$$ \int \frac{1}{5+\cos^{2}(x)} \, dx = \frac{1}{\sqrt{30}} \arctan \left( \frac{\sqrt{5}}{\sqrt{6}} \tan(x) \right) $$

A: You've now got a ratio of polynomials. The next step is to factor the denominator into linear and irreducible quadratic factors. Your denominator has the form $3u^2 + 4u + 3$, where $u = t^2$, and that quadratic has two non-real roots, so you're in the "product of irreducible quadratics" case. I can't, off the top of my head, factor your quadratic, but let's suppose that it factors into something of the form $s(x) r(x)$, where each is an irreducible quadratic. Then your overall integrand, 
$$
\frac{p(x)}{s(x) r(x)} 
$$
can be broken into a sum of the form
$$
\frac{A}{s(x)} + \frac{Bx + C}{s(x)} + \frac{D}{r(x)} + \frac{Ex + F}{r(x)}
$$
where $Bx + C$ is a multiple of $s'(x)$, so that term produces a ln in the integral; the first term, after completing the square in the denominator and doing a tangent substitution, produces an arctan term. The same approach goes for the 3rd and 4th terms. 
Look in your test under "method of partial fractions" (and be sure that your algebra up to this point is rock-solid...you don't want to do all that work for nothing!)
A: I you want a solution of $\displaystyle \int\frac{1}{5+\cos^2 x}dx$
$\bf{Solution::}$ Divide both $\bf{N_{r}}$ abd $\bf{D_{r}}$ by $\cos^2 x$, we get $\displaystyle \int\frac{\sec^2 x}{5\sec^2 x+1}dx = \int\frac{\sec^2 x}{6+5\tan^2 x}dx$
Now Let $\sqrt{5}\tan x= t$, Then $\displaystyle \sec^2 xdx = \frac{1}{\sqrt{5}}dt$
So $\displaystyle \int\frac{1}{\left(\sqrt{6}\right)^2+t^2}dt = \frac{1}{\sqrt{30}}\tan^{-1}\left(\frac{t}{\sqrt{6}}\right)+\mathbb{C}$
So $\displaystyle \int\frac{1}{5+\cos^2 x}dx = \frac{1}{\sqrt{30}}\tan^{-1}\left(\frac{\sqrt{5}\tan x}{\sqrt{6}}\right)+\mathbb{C}$
