\(\int \frac {1}{(a+b \cos ^2(x))^2} \, dx\) [64]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-1)]
Maxima [A] (verification not implemented)
Giac [A] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 65 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=-\frac {(2 a+b) \arctan \left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )} \] Output:

-1/2*(2*a+b)*arctan((a+b)^(1/2)*cot(x)/a^(1/2))/a^(3/2)/(a+b)^(3/2)-1/2*b* 
cos(x)*sin(x)/a/(a+b)/(a+b*cos(x)^2)
 

Mathematica [A] (verified)

Time = 5.17 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.08 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=-\frac {(-2 a-b) \arctan \left (\frac {\sqrt {a} \tan (x)}{\sqrt {a+b}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \sin (2 x)}{2 a (a+b) (2 a+b+b \cos (2 x))} \] Input:

Integrate[(a + b*Cos[x]^2)^(-2),x]
 

Output:

-1/2*((-2*a - b)*ArcTan[(Sqrt[a]*Tan[x])/Sqrt[a + b]])/(a^(3/2)*(a + b)^(3 
/2)) - (b*Sin[2*x])/(2*a*(a + b)*(2*a + b + b*Cos[2*x]))
 

Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.700, Rules used = {3042, 3663, 25, 27, 3042, 3660, 218}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\left (a+b \sin \left (x+\frac {\pi }{2}\right )^2\right )^2}dx\)

\(\Big \downarrow \) 3663

\(\displaystyle -\frac {\int -\frac {2 a+b}{b \cos ^2(x)+a}dx}{2 a (a+b)}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {2 a+b}{b \cos ^2(x)+a}dx}{2 a (a+b)}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {(2 a+b) \int \frac {1}{b \cos ^2(x)+a}dx}{2 a (a+b)}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {(2 a+b) \int \frac {1}{b \sin \left (x+\frac {\pi }{2}\right )^2+a}dx}{2 a (a+b)}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

\(\Big \downarrow \) 3660

\(\displaystyle -\frac {(2 a+b) \int \frac {1}{(a+b) \cot ^2(x)+a}d\cot (x)}{2 a (a+b)}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

\(\Big \downarrow \) 218

\(\displaystyle -\frac {(2 a+b) \arctan \left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\)

Input:

Int[(a + b*Cos[x]^2)^(-2),x]
 

Output:

-1/2*((2*a + b)*ArcTan[(Sqrt[a + b]*Cot[x])/Sqrt[a]])/(a^(3/2)*(a + b)^(3/ 
2)) - (b*Cos[x]*Sin[x])/(2*a*(a + b)*(a + b*Cos[x]^2))
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3660
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = 
FreeFactors[Tan[e + f*x], x]}, Simp[ff/f   Subst[Int[1/(a + (a + b)*ff^2*x^ 
2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]
 

rule 3663
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Simp[(-b)*C 
os[e + f*x]*Sin[e + f*x]*((a + b*Sin[e + f*x]^2)^(p + 1)/(2*a*f*(p + 1)*(a 
+ b))), x] + Simp[1/(2*a*(p + 1)*(a + b))   Int[(a + b*Sin[e + f*x]^2)^(p + 
 1)*Simp[2*a*(p + 1) + b*(2*p + 3) - 2*b*(p + 2)*Sin[e + f*x]^2, x], x], x] 
 /; FreeQ[{a, b, e, f}, x] && NeQ[a + b, 0] && LtQ[p, -1]
 
Maple [A] (verified)

Time = 0.31 (sec) , antiderivative size = 60, normalized size of antiderivative = 0.92

method result size
default \(-\frac {b \tan \left (x \right )}{2 \left (a +b \right ) a \left (a \tan \left (x \right )^{2}+a +b \right )}+\frac {\left (2 a +b \right ) \arctan \left (\frac {a \tan \left (x \right )}{\sqrt {\left (a +b \right ) a}}\right )}{2 \left (a +b \right ) a \sqrt {\left (a +b \right ) a}}\) \(60\)
risch \(-\frac {i \left (2 a \,{\mathrm e}^{2 i x}+{\mathrm e}^{2 i x} b +b \right )}{\left (a +b \right ) a \left ({\mathrm e}^{4 i x} b +4 a \,{\mathrm e}^{2 i x}+2 \,{\mathrm e}^{2 i x} b +b \right )}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-b a}+b \sqrt {-a^{2}-b a}}{b \sqrt {-a^{2}-b a}}\right )}{2 \sqrt {-a^{2}-b a}\, \left (a +b \right )}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-b a}+b \sqrt {-a^{2}-b a}}{b \sqrt {-a^{2}-b a}}\right ) b}{4 \sqrt {-a^{2}-b a}\, \left (a +b \right ) a}+\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i a^{2}+2 i a b -2 a \sqrt {-a^{2}-b a}-b \sqrt {-a^{2}-b a}}{b \sqrt {-a^{2}-b a}}\right )}{2 \sqrt {-a^{2}-b a}\, \left (a +b \right )}+\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i a^{2}+2 i a b -2 a \sqrt {-a^{2}-b a}-b \sqrt {-a^{2}-b a}}{b \sqrt {-a^{2}-b a}}\right ) b}{4 \sqrt {-a^{2}-b a}\, \left (a +b \right ) a}\) \(401\)

Input:

int(1/(a+b*cos(x)^2)^2,x,method=_RETURNVERBOSE)
 

Output:

-1/2*b/(a+b)/a*tan(x)/(a*tan(x)^2+a+b)+1/2*(2*a+b)/(a+b)/a/((a+b)*a)^(1/2) 
*arctan(a*tan(x)/((a+b)*a)^(1/2))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 131 vs. \(2 (53) = 106\).

Time = 0.12 (sec) , antiderivative size = 326, normalized size of antiderivative = 5.02 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=\left [-\frac {4 \, {\left (a^{2} b + a b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) + {\left ({\left (2 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a^{2} + a b\right )} \sqrt {-a^{2} - a b} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{3} - a \cos \left (x\right )\right )} \sqrt {-a^{2} - a b} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right )}{8 \, {\left (a^{5} + 2 \, a^{4} b + a^{3} b^{2} + {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )}}, -\frac {2 \, {\left (a^{2} b + a b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) + {\left ({\left (2 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a^{2} + a b\right )} \sqrt {a^{2} + a b} \arctan \left (\frac {{\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a}{2 \, \sqrt {a^{2} + a b} \cos \left (x\right ) \sin \left (x\right )}\right )}{4 \, {\left (a^{5} + 2 \, a^{4} b + a^{3} b^{2} + {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )}}\right ] \] Input:

integrate(1/(a+b*cos(x)^2)^2,x, algorithm="fricas")
 

Output:

[-1/8*(4*(a^2*b + a*b^2)*cos(x)*sin(x) + ((2*a*b + b^2)*cos(x)^2 + 2*a^2 + 
 a*b)*sqrt(-a^2 - a*b)*log(((8*a^2 + 8*a*b + b^2)*cos(x)^4 - 2*(4*a^2 + 3* 
a*b)*cos(x)^2 + 4*((2*a + b)*cos(x)^3 - a*cos(x))*sqrt(-a^2 - a*b)*sin(x) 
+ a^2)/(b^2*cos(x)^4 + 2*a*b*cos(x)^2 + a^2)))/(a^5 + 2*a^4*b + a^3*b^2 + 
(a^4*b + 2*a^3*b^2 + a^2*b^3)*cos(x)^2), -1/4*(2*(a^2*b + a*b^2)*cos(x)*si 
n(x) + ((2*a*b + b^2)*cos(x)^2 + 2*a^2 + a*b)*sqrt(a^2 + a*b)*arctan(1/2*( 
(2*a + b)*cos(x)^2 - a)/(sqrt(a^2 + a*b)*cos(x)*sin(x))))/(a^5 + 2*a^4*b + 
 a^3*b^2 + (a^4*b + 2*a^3*b^2 + a^2*b^3)*cos(x)^2)]
 

Sympy [F(-1)]

Timed out. \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=\text {Timed out} \] Input:

integrate(1/(a+b*cos(x)**2)**2,x)
 

Output:

Timed out
 

Maxima [A] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.11 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=-\frac {b \tan \left (x\right )}{2 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2} + {\left (a^{3} + a^{2} b\right )} \tan \left (x\right )^{2}\right )}} + \frac {{\left (2 \, a + b\right )} \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{2 \, \sqrt {{\left (a + b\right )} a} {\left (a^{2} + a b\right )}} \] Input:

integrate(1/(a+b*cos(x)^2)^2,x, algorithm="maxima")
 

Output:

-1/2*b*tan(x)/(a^3 + 2*a^2*b + a*b^2 + (a^3 + a^2*b)*tan(x)^2) + 1/2*(2*a 
+ b)*arctan(a*tan(x)/sqrt((a + b)*a))/(sqrt((a + b)*a)*(a^2 + a*b))
 

Giac [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.06 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=\frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )} {\left (2 \, a + b\right )}}{2 \, {\left (a^{2} + a b\right )}^{\frac {3}{2}}} - \frac {b \tan \left (x\right )}{2 \, {\left (a \tan \left (x\right )^{2} + a + b\right )} {\left (a^{2} + a b\right )}} \] Input:

integrate(1/(a+b*cos(x)^2)^2,x, algorithm="giac")
 

Output:

1/2*(pi*floor(x/pi + 1/2)*sgn(a) + arctan(a*tan(x)/sqrt(a^2 + a*b)))*(2*a 
+ b)/(a^2 + a*b)^(3/2) - 1/2*b*tan(x)/((a*tan(x)^2 + a + b)*(a^2 + a*b))
 

Mupad [B] (verification not implemented)

Time = 1.02 (sec) , antiderivative size = 52, normalized size of antiderivative = 0.80 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=\frac {\mathrm {atan}\left (\frac {\sqrt {a}\,\mathrm {tan}\left (x\right )}{\sqrt {a+b}}\right )\,\left (2\,a+b\right )}{2\,a^{3/2}\,{\left (a+b\right )}^{3/2}}-\frac {b\,\mathrm {tan}\left (x\right )}{2\,a\,\left (a+b\right )\,\left (a\,{\mathrm {tan}\left (x\right )}^2+a+b\right )} \] Input:

int(1/(a + b*cos(x)^2)^2,x)
 

Output:

(atan((a^(1/2)*tan(x))/(a + b)^(1/2))*(2*a + b))/(2*a^(3/2)*(a + b)^(3/2)) 
 - (b*tan(x))/(2*a*(a + b)*(a + b + a*tan(x)^2))
 

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 386, normalized size of antiderivative = 5.94 \[ \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx=\frac {2 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )-\sqrt {b}}{\sqrt {a}}\right ) \sin \left (x \right )^{2} a b +\sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )-\sqrt {b}}{\sqrt {a}}\right ) \sin \left (x \right )^{2} b^{2}-2 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )-\sqrt {b}}{\sqrt {a}}\right ) a^{2}-3 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )-\sqrt {b}}{\sqrt {a}}\right ) a b -\sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )-\sqrt {b}}{\sqrt {a}}\right ) b^{2}+2 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )+\sqrt {b}}{\sqrt {a}}\right ) \sin \left (x \right )^{2} a b +\sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )+\sqrt {b}}{\sqrt {a}}\right ) \sin \left (x \right )^{2} b^{2}-2 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )+\sqrt {b}}{\sqrt {a}}\right ) a^{2}-3 \sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )+\sqrt {b}}{\sqrt {a}}\right ) a b -\sqrt {a}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {x}{2}\right )+\sqrt {b}}{\sqrt {a}}\right ) b^{2}+\cos \left (x \right ) \sin \left (x \right ) a^{2} b +\cos \left (x \right ) \sin \left (x \right ) a \,b^{2}}{2 a^{2} \left (\sin \left (x \right )^{2} a^{2} b +2 \sin \left (x \right )^{2} a \,b^{2}+\sin \left (x \right )^{2} b^{3}-a^{3}-3 a^{2} b -3 a \,b^{2}-b^{3}\right )} \] Input:

int(1/(a+b*cos(x)^2)^2,x)
 

Output:

(2*sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) - sqrt(b))/sqrt(a))*sin( 
x)**2*a*b + sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) - sqrt(b))/sqrt 
(a))*sin(x)**2*b**2 - 2*sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) - s 
qrt(b))/sqrt(a))*a**2 - 3*sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) - 
 sqrt(b))/sqrt(a))*a*b - sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) - 
sqrt(b))/sqrt(a))*b**2 + 2*sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)*tan(x/2) 
+ sqrt(b))/sqrt(a))*sin(x)**2*a*b + sqrt(a)*sqrt(a + b)*atan((sqrt(a + b)* 
tan(x/2) + sqrt(b))/sqrt(a))*sin(x)**2*b**2 - 2*sqrt(a)*sqrt(a + b)*atan(( 
sqrt(a + b)*tan(x/2) + sqrt(b))/sqrt(a))*a**2 - 3*sqrt(a)*sqrt(a + b)*atan 
((sqrt(a + b)*tan(x/2) + sqrt(b))/sqrt(a))*a*b - sqrt(a)*sqrt(a + b)*atan( 
(sqrt(a + b)*tan(x/2) + sqrt(b))/sqrt(a))*b**2 + cos(x)*sin(x)*a**2*b + co 
s(x)*sin(x)*a*b**2)/(2*a**2*(sin(x)**2*a**2*b + 2*sin(x)**2*a*b**2 + sin(x 
)**2*b**3 - a**3 - 3*a**2*b - 3*a*b**2 - b**3))