\(\int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx\) [658]

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

Optimal result

Integrand size = 21, antiderivative size = 272 \[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=-\frac {\left (\sqrt {-b^2} \left (1+\frac {a^2}{b^2}-n\right )-a n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{4 \left (1+\frac {a^2}{b^2}\right ) b \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b \left (\sqrt {-b^2} \left (1+\frac {a^2}{b^2}-n\right )+a n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{4 \left (a^2+b^2\right ) \left (a+\sqrt {-b^2}\right ) d (1+n)}+\frac {\cos ^2(c+d x) (b+a \tan (c+d x)) (a+b \tan (c+d x))^{1+n}}{2 \left (a^2+b^2\right ) d} \] Output:

-1/4*((-b^2)^(1/2)*(1+a^2/b^2-n)-a*n)*hypergeom([1, 1+n],[2+n],(a+b*tan(d* 
x+c))/(a-(-b^2)^(1/2)))*(a+b*tan(d*x+c))^(1+n)/(1+a^2/b^2)/b/(a-(-b^2)^(1/ 
2))/d/(1+n)+1/4*b*((-b^2)^(1/2)*(1+a^2/b^2-n)+a*n)*hypergeom([1, 1+n],[2+n 
],(a+b*tan(d*x+c))/(a+(-b^2)^(1/2)))*(a+b*tan(d*x+c))^(1+n)/(a^2+b^2)/(a+( 
-b^2)^(1/2))/d/(1+n)+1/2*cos(d*x+c)^2*(b+a*tan(d*x+c))*(a+b*tan(d*x+c))^(1 
+n)/(a^2+b^2)/d
 

Mathematica [A] (verified)

Time = 0.87 (sec) , antiderivative size = 225, normalized size of antiderivative = 0.83 \[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\frac {(a+b \tan (c+d x))^{1+n} \left (-\frac {\left (\sqrt {-b^2} \left (a^2-b^2 (-1+n)\right )-a b^2 n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right )}{\left (a-\sqrt {-b^2}\right ) (1+n)}+\frac {\left (a^2 \sqrt {-b^2}+\left (-b^2\right )^{3/2} (-1+n)+a b^2 n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right )}{\left (a+\sqrt {-b^2}\right ) (1+n)}+2 b \cos ^2(c+d x) (b+a \tan (c+d x))\right )}{4 b \left (a^2+b^2\right ) d} \] Input:

Integrate[Cos[c + d*x]^2*(a + b*Tan[c + d*x])^n,x]
 

Output:

((a + b*Tan[c + d*x])^(1 + n)*(-(((Sqrt[-b^2]*(a^2 - b^2*(-1 + n)) - a*b^2 
*n)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Tan[c + d*x])/(a - Sqrt[-b^2 
])])/((a - Sqrt[-b^2])*(1 + n))) + ((a^2*Sqrt[-b^2] + (-b^2)^(3/2)*(-1 + n 
) + a*b^2*n)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Tan[c + d*x])/(a + 
Sqrt[-b^2])])/((a + Sqrt[-b^2])*(1 + n)) + 2*b*Cos[c + d*x]^2*(b + a*Tan[c 
 + d*x])))/(4*b*(a^2 + b^2)*d)
 

Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 293, normalized size of antiderivative = 1.08, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 3987, 27, 496, 25, 657, 2009}

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 \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (c+d x))^n}{\sec (c+d x)^2}dx\)

\(\Big \downarrow \) 3987

\(\displaystyle \frac {\int \frac {b^4 (a+b \tan (c+d x))^n}{\left (\tan ^2(c+d x) b^2+b^2\right )^2}d(b \tan (c+d x))}{b d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {b^3 \int \frac {(a+b \tan (c+d x))^n}{\left (\tan ^2(c+d x) b^2+b^2\right )^2}d(b \tan (c+d x))}{d}\)

\(\Big \downarrow \) 496

\(\displaystyle \frac {b^3 \left (\frac {\left (a b \tan (c+d x)+b^2\right ) (a+b \tan (c+d x))^{n+1}}{2 b^2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}-\frac {\int -\frac {(a+b \tan (c+d x))^n \left (a^2-b n \tan (c+d x) a+b^2 (1-n)\right )}{\tan ^2(c+d x) b^2+b^2}d(b \tan (c+d x))}{2 b^2 \left (a^2+b^2\right )}\right )}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {b^3 \left (\frac {\int \frac {(a+b \tan (c+d x))^n \left (a^2-b n \tan (c+d x) a+b^2 (1-n)\right )}{\tan ^2(c+d x) b^2+b^2}d(b \tan (c+d x))}{2 b^2 \left (a^2+b^2\right )}+\frac {\left (a b \tan (c+d x)+b^2\right ) (a+b \tan (c+d x))^{n+1}}{2 b^2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\)

\(\Big \downarrow \) 657

\(\displaystyle \frac {b^3 \left (\frac {\int \left (\frac {\left (a n b^2+\sqrt {-b^2} \left (a^2+b^2 (1-n)\right )\right ) (a+b \tan (c+d x))^n}{2 b^2 \left (\sqrt {-b^2}-b \tan (c+d x)\right )}+\frac {\left (\sqrt {-b^2} \left (a^2+b^2 (1-n)\right )-a b^2 n\right ) (a+b \tan (c+d x))^n}{2 b^2 \left (b \tan (c+d x)+\sqrt {-b^2}\right )}\right )d(b \tan (c+d x))}{2 b^2 \left (a^2+b^2\right )}+\frac {\left (a b \tan (c+d x)+b^2\right ) (a+b \tan (c+d x))^{n+1}}{2 b^2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {b^3 \left (\frac {\frac {\left (\sqrt {-b^2} \left (a^2+b^2 (1-n)\right )+a b^2 n\right ) (a+b \tan (c+d x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right )}{2 b^2 (n+1) \left (a+\sqrt {-b^2}\right )}-\frac {\left (\sqrt {-b^2} \left (a^2+b^2 (1-n)\right )-a b^2 n\right ) (a+b \tan (c+d x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right )}{2 b^2 (n+1) \left (a-\sqrt {-b^2}\right )}}{2 b^2 \left (a^2+b^2\right )}+\frac {\left (a b \tan (c+d x)+b^2\right ) (a+b \tan (c+d x))^{n+1}}{2 b^2 \left (a^2+b^2\right ) \left (b^2 \tan ^2(c+d x)+b^2\right )}\right )}{d}\)

Input:

Int[Cos[c + d*x]^2*(a + b*Tan[c + d*x])^n,x]
 

Output:

(b^3*(((a + b*Tan[c + d*x])^(1 + n)*(b^2 + a*b*Tan[c + d*x]))/(2*b^2*(a^2 
+ b^2)*(b^2 + b^2*Tan[c + d*x]^2)) + (-1/2*((Sqrt[-b^2]*(a^2 + b^2*(1 - n) 
) - a*b^2*n)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Tan[c + d*x])/(a - 
Sqrt[-b^2])]*(a + b*Tan[c + d*x])^(1 + n))/(b^2*(a - Sqrt[-b^2])*(1 + n)) 
+ ((Sqrt[-b^2]*(a^2 + b^2*(1 - n)) + a*b^2*n)*Hypergeometric2F1[1, 1 + n, 
2 + n, (a + b*Tan[c + d*x])/(a + Sqrt[-b^2])]*(a + b*Tan[c + d*x])^(1 + n) 
)/(2*b^2*(a + Sqrt[-b^2])*(1 + n)))/(2*b^2*(a^2 + b^2))))/d
 

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 496
Int[((c_) + (d_.)*(x_))^(n_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[ 
(-(a*d + b*c*x))*(c + d*x)^(n + 1)*((a + b*x^2)^(p + 1)/(2*a*(p + 1)*(b*c^2 
 + a*d^2))), x] + Simp[1/(2*a*(p + 1)*(b*c^2 + a*d^2))   Int[(c + d*x)^n*(a 
 + b*x^2)^(p + 1)*Simp[b*c^2*(2*p + 3) + a*d^2*(n + 2*p + 3) + b*c*d*(n + 2 
*p + 4)*x, x], x], x] /; FreeQ[{a, b, c, d, n}, x] && LtQ[p, -1] && IntQuad 
raticQ[a, 0, b, c, d, n, p, x]
 

rule 657
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( 
x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 
2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 3987
Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ 
), x_Symbol] :> Simp[1/(b*f)   Subst[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), 
 x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b^2, 
0] && IntegerQ[m/2]
 
Maple [F]

\[\int \cos \left (d x +c \right )^{2} \left (a +b \tan \left (d x +c \right )\right )^{n}d x\]

Input:

int(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
 

Output:

int(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
 

Fricas [F]

\[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cos \left (d x + c\right )^{2} \,d x } \] Input:

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="fricas")
 

Output:

integral((b*tan(d*x + c) + a)^n*cos(d*x + c)^2, x)
 

Sympy [F]

\[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{n} \cos ^{2}{\left (c + d x \right )}\, dx \] Input:

integrate(cos(d*x+c)**2*(a+b*tan(d*x+c))**n,x)
 

Output:

Integral((a + b*tan(c + d*x))**n*cos(c + d*x)**2, x)
 

Maxima [F]

\[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cos \left (d x + c\right )^{2} \,d x } \] Input:

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="maxima")
 

Output:

integrate((b*tan(d*x + c) + a)^n*cos(d*x + c)^2, x)
 

Giac [F]

\[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cos \left (d x + c\right )^{2} \,d x } \] Input:

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="giac")
 

Output:

integrate((b*tan(d*x + c) + a)^n*cos(d*x + c)^2, x)
 

Mupad [F(-1)]

Timed out. \[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int {\cos \left (c+d\,x\right )}^2\,{\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^n \,d x \] Input:

int(cos(c + d*x)^2*(a + b*tan(c + d*x))^n,x)
 

Output:

int(cos(c + d*x)^2*(a + b*tan(c + d*x))^n, x)
 

Reduce [F]

\[ \int \cos ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int \left (\tan \left (d x +c \right ) b +a \right )^{n} \cos \left (d x +c \right )^{2}d x \] Input:

int(cos(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
 

Output:

int((tan(c + d*x)*b + a)**n*cos(c + d*x)**2,x)