\(\int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx\) [880]

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 = 23, antiderivative size = 206 \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\frac {a^2 b d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac {a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}-\frac {b \left (3 a^2-b^2\right ) d^2 (d \cot (e+f x))^{-2+n} \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-2+n),\frac {n}{2},-\cot ^2(e+f x)\right )}{f (2-n)}-\frac {a \left (a^2-3 b^2\right ) d (d \cot (e+f x))^{-1+n} \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-1+n),\frac {1+n}{2},-\cot ^2(e+f x)\right )}{f (1-n)} \] Output:

a^2*b*d^2*(1-2*n)*(d*cot(f*x+e))^(-2+n)/f/(1-n)/(2-n)+a^2*d^2*(d*cot(f*x+e 
))^(-2+n)*(b+a*cot(f*x+e))/f/(1-n)-b*(3*a^2-b^2)*d^2*(d*cot(f*x+e))^(-2+n) 
*hypergeom([1, -1+1/2*n],[1/2*n],-cot(f*x+e)^2)/f/(2-n)-a*(a^2-3*b^2)*d*(d 
*cot(f*x+e))^(-1+n)*hypergeom([1, -1/2+1/2*n],[1/2+1/2*n],-cot(f*x+e)^2)/f 
/(1-n)
 

Mathematica [A] (verified)

Time = 0.63 (sec) , antiderivative size = 141, normalized size of antiderivative = 0.68 \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\frac {(d \cot (e+f x))^n \left (-b \left (-3 a^2+b^2\right ) (-1+n) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-2+n),\frac {n}{2},-\cot ^2(e+f x)\right )+a \left (a (-3 b (-1+n)-a (-2+n) \cot (e+f x))+\left (a^2-3 b^2\right ) (-2+n) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (-1+n),\frac {1+n}{2},-\cot ^2(e+f x)\right )\right )\right ) \tan ^2(e+f x)}{f (-2+n) (-1+n)} \] Input:

Integrate[(d*Cot[e + f*x])^n*(a + b*Tan[e + f*x])^3,x]
 

Output:

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

Rubi [A] (verified)

Time = 1.02 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.01, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.478, Rules used = {3042, 4156, 3042, 4049, 3042, 4113, 3042, 4021, 3042, 3957, 278}

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 (a+b \tan (e+f x))^3 (d \cot (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x))^3 (d \cot (e+f x))^ndx\)

\(\Big \downarrow \) 4156

\(\displaystyle d^3 \int (d \cot (e+f x))^{n-3} (b+a \cot (e+f x))^3dx\)

\(\Big \downarrow \) 3042

\(\displaystyle d^3 \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-3} \left (b-a \tan \left (e+f x+\frac {\pi }{2}\right )\right )^3dx\)

\(\Big \downarrow \) 4049

\(\displaystyle d^3 \left (\frac {\int (d \cot (e+f x))^{n-3} \left (a^2 b d (1-2 n) \cot ^2(e+f x)-a \left (a^2-3 b^2\right ) d (1-n) \cot (e+f x)+b d \left (b^2 (1-n)-a^2 (2-n)\right )\right )dx}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^3 \left (\frac {\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-3} \left (a^2 b d (1-2 n) \tan \left (e+f x+\frac {\pi }{2}\right )^2+a \left (a^2-3 b^2\right ) d (1-n) \tan \left (e+f x+\frac {\pi }{2}\right )+b d \left (b^2 (1-n)-a^2 (2-n)\right )\right )dx}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 4113

\(\displaystyle d^3 \left (\frac {\int (d \cot (e+f x))^{n-3} \left (-b \left (3 a^2-b^2\right ) d (1-n)-a \left (a^2-3 b^2\right ) d \cot (e+f x) (1-n)\right )dx+\frac {a^2 b (1-2 n) (d \cot (e+f x))^{n-2}}{f (2-n)}}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^3 \left (\frac {\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-3} \left (a \left (a^2-3 b^2\right ) d (1-n) \tan \left (e+f x+\frac {\pi }{2}\right )-b \left (3 a^2-b^2\right ) d (1-n)\right )dx+\frac {a^2 b (1-2 n) (d \cot (e+f x))^{n-2}}{f (2-n)}}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 4021

\(\displaystyle d^3 \left (\frac {-b d (1-n) \left (3 a^2-b^2\right ) \int (d \cot (e+f x))^{n-3}dx-a (1-n) \left (a^2-3 b^2\right ) \int (d \cot (e+f x))^{n-2}dx+\frac {a^2 b (1-2 n) (d \cot (e+f x))^{n-2}}{f (2-n)}}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^3 \left (\frac {-b d (1-n) \left (3 a^2-b^2\right ) \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-3}dx-a (1-n) \left (a^2-3 b^2\right ) \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2}dx+\frac {a^2 b (1-2 n) (d \cot (e+f x))^{n-2}}{f (2-n)}}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

\(\Big \downarrow \) 3957

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

\(\Big \downarrow \) 278

\(\displaystyle d^3 \left (\frac {-\frac {b (1-n) \left (3 a^2-b^2\right ) (d \cot (e+f x))^{n-2} \operatorname {Hypergeometric2F1}\left (1,\frac {n-2}{2},\frac {n}{2},-\cot ^2(e+f x)\right )}{f (2-n)}-\frac {a \left (a^2-3 b^2\right ) (d \cot (e+f x))^{n-1} \operatorname {Hypergeometric2F1}\left (1,\frac {n-1}{2},\frac {n+1}{2},-\cot ^2(e+f x)\right )}{d f}+\frac {a^2 b (1-2 n) (d \cot (e+f x))^{n-2}}{f (2-n)}}{d (1-n)}+\frac {a^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{d f (1-n)}\right )\)

Input:

Int[(d*Cot[e + f*x])^n*(a + b*Tan[e + f*x])^3,x]
 

Output:

d^3*((a^2*(d*Cot[e + f*x])^(-2 + n)*(b + a*Cot[e + f*x]))/(d*f*(1 - n)) + 
((a^2*b*(1 - 2*n)*(d*Cot[e + f*x])^(-2 + n))/(f*(2 - n)) - (b*(3*a^2 - b^2 
)*(1 - n)*(d*Cot[e + f*x])^(-2 + n)*Hypergeometric2F1[1, (-2 + n)/2, n/2, 
-Cot[e + f*x]^2])/(f*(2 - n)) - (a*(a^2 - 3*b^2)*(d*Cot[e + f*x])^(-1 + n) 
*Hypergeometric2F1[1, (-1 + n)/2, (1 + n)/2, -Cot[e + f*x]^2])/(d*f))/(d*( 
1 - n)))
 

Defintions of rubi rules used

rule 278
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( 
c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( 
-b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] &&  !IGtQ[p, 0] && (ILtQ[p, 0 
] || GtQ[a, 0])
 

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

rule 3957
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d   Subst[Int 
[x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && 
!IntegerQ[n]
 

rule 4021
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 
2 + d^2, 0] &&  !IntegerQ[2*m]
 

rule 4049
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c 
+ d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Simp[1/(d*(m + n - 1)) 
 Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n 
- 1) - b^2*(b*c*(m - 2) + a*d*(1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[ 
e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2, x], x], 
x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2 
, 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || I 
ntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])) 
)
 

rule 4113
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + 
 b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Si 
mp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && 
NeQ[A*b^2 - a*b*B + a^2*C, 0] &&  !LeQ[m, -1]
 

rule 4156
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x 
_)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p)   Int[(d*Cot[e + f*x])^(m - n*p 
)*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && 
  !IntegerQ[m] && IntegersQ[n, p]
 
Maple [F]

\[\int \left (d \cot \left (f x +e \right )\right )^{n} \left (a +b \tan \left (f x +e \right )\right )^{3}d x\]

Input:

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)
 

Output:

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)
 

Fricas [F]

\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \] Input:

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="fricas")
 

Output:

integral((b^3*tan(f*x + e)^3 + 3*a*b^2*tan(f*x + e)^2 + 3*a^2*b*tan(f*x + 
e) + a^3)*(d*cot(f*x + e))^n, x)
 

Sympy [F]

\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int \left (d \cot {\left (e + f x \right )}\right )^{n} \left (a + b \tan {\left (e + f x \right )}\right )^{3}\, dx \] Input:

integrate((d*cot(f*x+e))**n*(a+b*tan(f*x+e))**3,x)
 

Output:

Integral((d*cot(e + f*x))**n*(a + b*tan(e + f*x))**3, x)
 

Maxima [F]

\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \] Input:

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="maxima")
 

Output:

integrate((b*tan(f*x + e) + a)^3*(d*cot(f*x + e))^n, x)
 

Giac [F]

\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \] Input:

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="giac")
 

Output:

integrate((b*tan(f*x + e) + a)^3*(d*cot(f*x + e))^n, x)
 

Mupad [F(-1)]

Timed out. \[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int {\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n\,{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^3 \,d x \] Input:

int((d*cot(e + f*x))^n*(a + b*tan(e + f*x))^3,x)
 

Output:

int((d*cot(e + f*x))^n*(a + b*tan(e + f*x))^3, x)
 

Reduce [F]

\[ \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx=\int \left (d \cot \left (f x +e \right )\right )^{n} \left (\tan \left (f x +e \right ) b +a \right )^{3}d x \] Input:

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)
 

Output:

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)