Integrand size = 21, antiderivative size = 246 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=-\frac {\cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac {b n \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a}\right ) (a+b \tan (c+d x))^{1+n}}{a^2 d (1+n)}-\frac {b \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}}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b \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}}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)} \] Output:
-cot(d*x+c)*(a+b*tan(d*x+c))^(1+n)/a/d-b*n*hypergeom([1, 1+n],[2+n],(a+b*t an(d*x+c))/a)*(a+b*tan(d*x+c))^(1+n)/a^2/d/(1+n)-1/2*b*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)/(-b^2)^(1/ 2)/(a-(-b^2)^(1/2))/d/(1+n)+1/2*b*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)/(-b^2)^(1/2)/(a+(-b^2)^(1/2))/d /(1+n)
Result contains complex when optimal does not.
Time = 0.58 (sec) , antiderivative size = 190, normalized size of antiderivative = 0.77 \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=-\frac {(b+a \cot (c+d x)) \left (a^2 (-i a+b) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a-i b}\right )+(a-i b) \left (i a^2 \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {a+b \tan (c+d x)}{a+i b}\right )+2 (a+i b) \left (a (1+n) \cot (c+d x)+b n \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,1+\frac {b \tan (c+d x)}{a}\right )\right )\right )\right ) \tan (c+d x) (a+b \tan (c+d x))^n}{2 a^2 (a-i b) (a+i b) d (1+n)} \] Input:
Integrate[Cot[c + d*x]^2*(a + b*Tan[c + d*x])^n,x]
Output:
-1/2*((b + a*Cot[c + d*x])*(a^2*((-I)*a + b)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Tan[c + d*x])/(a - I*b)] + (a - I*b)*(I*a^2*Hypergeometric2F1 [1, 1 + n, 2 + n, (a + b*Tan[c + d*x])/(a + I*b)] + 2*(a + I*b)*(a*(1 + n) *Cot[c + d*x] + b*n*Hypergeometric2F1[1, 1 + n, 2 + n, 1 + (b*Tan[c + d*x] )/a])))*Tan[c + d*x]*(a + b*Tan[c + d*x])^n)/(a^2*(a - I*b)*(a + I*b)*d*(1 + n))
Time = 0.83 (sec) , antiderivative size = 250, normalized size of antiderivative = 1.02, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.619, Rules used = {3042, 4052, 25, 3042, 4136, 25, 27, 3042, 3966, 485, 2009, 4117, 75}
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 \cot ^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}{\tan (c+d x)^2}dx\) |
\(\Big \downarrow \) 4052 |
\(\displaystyle -\frac {\int -\cot (c+d x) (a+b \tan (c+d x))^n \left (b n \tan ^2(c+d x)-a \tan (c+d x)+b n\right )dx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\int \cot (c+d x) (a+b \tan (c+d x))^n \left (b n \tan ^2(c+d x)-a \tan (c+d x)+b n\right )dx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {(a+b \tan (c+d x))^n \left (b n \tan (c+d x)^2-a \tan (c+d x)+b n\right )}{\tan (c+d x)}dx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 4136 |
\(\displaystyle \frac {\int -a (a+b \tan (c+d x))^ndx+b n \int \cot (c+d x) (a+b \tan (c+d x))^n \left (\tan ^2(c+d x)+1\right )dx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {b n \int \cot (c+d x) (a+b \tan (c+d x))^n \left (\tan ^2(c+d x)+1\right )dx-\int a (a+b \tan (c+d x))^ndx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {b n \int \cot (c+d x) (a+b \tan (c+d x))^n \left (\tan ^2(c+d x)+1\right )dx-a \int (a+b \tan (c+d x))^ndx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {b n \int \frac {(a+b \tan (c+d x))^n \left (\tan (c+d x)^2+1\right )}{\tan (c+d x)}dx-a \int (a+b \tan (c+d x))^ndx}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 3966 |
\(\displaystyle \frac {b n \int \frac {(a+b \tan (c+d x))^n \left (\tan (c+d x)^2+1\right )}{\tan (c+d x)}dx-\frac {a b \int \frac {(a+b \tan (c+d x))^n}{\tan ^2(c+d x) b^2+b^2}d(b \tan (c+d x))}{d}}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 485 |
\(\displaystyle \frac {b n \int \frac {(a+b \tan (c+d x))^n \left (\tan (c+d x)^2+1\right )}{\tan (c+d x)}dx-\frac {a b \int \left (\frac {\sqrt {-b^2} (a+b \tan (c+d x))^n}{2 b^2 \left (\sqrt {-b^2}-b \tan (c+d x)\right )}+\frac {\sqrt {-b^2} (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))}{d}}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {b n \int \frac {(a+b \tan (c+d x))^n \left (\tan (c+d x)^2+1\right )}{\tan (c+d x)}dx-\frac {a b \left (\frac {(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 \sqrt {-b^2} (n+1) \left (a-\sqrt {-b^2}\right )}-\frac {(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 \sqrt {-b^2} (n+1) \left (a+\sqrt {-b^2}\right )}\right )}{d}}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 4117 |
\(\displaystyle \frac {\frac {b n \int \cot (c+d x) (a+b \tan (c+d x))^nd\tan (c+d x)}{d}-\frac {a b \left (\frac {(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 \sqrt {-b^2} (n+1) \left (a-\sqrt {-b^2}\right )}-\frac {(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 \sqrt {-b^2} (n+1) \left (a+\sqrt {-b^2}\right )}\right )}{d}}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
\(\Big \downarrow \) 75 |
\(\displaystyle \frac {-\frac {a b \left (\frac {(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 \sqrt {-b^2} (n+1) \left (a-\sqrt {-b^2}\right )}-\frac {(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 \sqrt {-b^2} (n+1) \left (a+\sqrt {-b^2}\right )}\right )}{d}-\frac {b n (a+b \tan (c+d x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {b \tan (c+d x)}{a}+1\right )}{a d (n+1)}}{a}-\frac {\cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d}\) |
Input:
Int[Cot[c + d*x]^2*(a + b*Tan[c + d*x])^n,x]
Output:
-((Cot[c + d*x]*(a + b*Tan[c + d*x])^(1 + n))/(a*d)) + (-((b*n*Hypergeomet ric2F1[1, 1 + n, 2 + n, 1 + (b*Tan[c + d*x])/a]*(a + b*Tan[c + d*x])^(1 + n))/(a*d*(1 + n))) - (a*b*((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*Sqrt[-b^2]*(a - Sqrt[-b^2])*(1 + 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*Sqrt[-b^2]*(a + Sqrt[-b^2])*(1 + n))))/d)/a
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((c + d*x )^(n + 1)/(d*(n + 1)*(-d/(b*c))^m))*Hypergeometric2F1[-m, n + 1, n + 2, 1 + d*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] && !IntegerQ[n] && (IntegerQ[m] || GtQ[-d/(b*c), 0])
Int[((c_) + (d_.)*(x_))^(n_)/((a_) + (b_.)*(x_)^2), x_Symbol] :> Int[Expand Integrand[(c + d*x)^n, 1/(a + b*x^2), x], x] /; FreeQ[{a, b, c, d, n}, x] & & !IntegerQ[2*n]
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d Su bst[Int[(a + x)^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c , d, n}, x] && NeQ[a^2 + b^2, 0]
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 + 1)*((c + d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(a^2 + b^2)*(b*c - a*d))), x] + Simp[1 /((m + 1)*(a^2 + b^2)*(b*c - a*d)) Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[a*(b*c - a*d)*(m + 1) - b^2*d*(m + n + 2) - b*(b*c - a*d)*(m + 1)*Tan[e + f*x] - b^2*d*(m + n + 2)*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] && LtQ[m, -1] && (LtQ[n, 0] || Integ erQ[m]) && !(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A/f Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]
Int[(((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2))/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[1/(a^2 + b^2) Int[(c + d*Tan[e + f*x])^ n*Simp[b*B + a*(A - C) + (a*B - b*(A - C))*Tan[e + f*x], x], x], x] + Simp[ (A*b^2 - a*b*B + a^2*C)/(a^2 + b^2) Int[(c + d*Tan[e + f*x])^n*((1 + Tan[ e + f*x]^2)/(a + b*Tan[e + f*x])), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] & & !GtQ[n, 0] && !LeQ[n, -1]
\[\int \cot \left (d x +c \right )^{2} \left (a +b \tan \left (d x +c \right )\right )^{n}d x\]
Input:
int(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
Output:
int(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2} \,d x } \] Input:
integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="fricas")
Output:
integral((b*tan(d*x + c) + a)^n*cot(d*x + c)^2, x)
\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{n} \cot ^{2}{\left (c + d x \right )}\, dx \] Input:
integrate(cot(d*x+c)**2*(a+b*tan(d*x+c))**n,x)
Output:
Integral((a + b*tan(c + d*x))**n*cot(c + d*x)**2, x)
\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2} \,d x } \] Input:
integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="maxima")
Output:
integrate((b*tan(d*x + c) + a)^n*cot(d*x + c)^2, x)
\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int { {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2} \,d x } \] Input:
integrate(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x, algorithm="giac")
Output:
integrate((b*tan(d*x + c) + a)^n*cot(d*x + c)^2, x)
Timed out. \[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int {\mathrm {cot}\left (c+d\,x\right )}^2\,{\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^n \,d x \] Input:
int(cot(c + d*x)^2*(a + b*tan(c + d*x))^n,x)
Output:
int(cot(c + d*x)^2*(a + b*tan(c + d*x))^n, x)
\[ \int \cot ^2(c+d x) (a+b \tan (c+d x))^n \, dx=\int \cot \left (d x +c \right )^{2} \left (a +\tan \left (d x +c \right ) b \right )^{n}d x \] Input:
int(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x)
Output:
int(cot(d*x+c)^2*(a+b*tan(d*x+c))^n,x)