3.346 \(\int \frac{1}{(\sin (x)+\tan (x))^2} \, dx\)

Optimal. Leaf size=33 \[ -\frac{2}{5} \cot ^5(x)-\frac{\cot ^3(x)}{3}+\frac{2 \csc ^5(x)}{5}-\frac{2 \csc ^3(x)}{3} \]

[Out]

-Cot[x]^3/3 - (2*Cot[x]^5)/5 - (2*Csc[x]^3)/3 + (2*Csc[x]^5)/5

________________________________________________________________________________________

Rubi [A]  time = 0.126604, antiderivative size = 33, normalized size of antiderivative = 1., number of steps used = 11, number of rules used = 6, integrand size = 7, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.857, Rules used = {4397, 2711, 2607, 30, 2606, 14} \[ -\frac{2}{5} \cot ^5(x)-\frac{\cot ^3(x)}{3}+\frac{2 \csc ^5(x)}{5}-\frac{2 \csc ^3(x)}{3} \]

Antiderivative was successfully verified.

[In]

Int[(Sin[x] + Tan[x])^(-2),x]

[Out]

-Cot[x]^3/3 - (2*Cot[x]^5)/5 - (2*Csc[x]^3)/3 + (2*Csc[x]^5)/5

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 2711

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Dist[a^(2*
m), Int[ExpandIntegrand[(g*Tan[e + f*x])^p/Sec[e + f*x]^m, (a*Sec[e + f*x] - b*Tan[e + f*x])^(-m), x], x], x]
/; FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && ILtQ[m, 0]

Rule 2607

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2606

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rubi steps

\begin{align*} \int \frac{1}{(\sin (x)+\tan (x))^2} \, dx &=\int \frac{\cot ^2(x)}{(1+\cos (x))^2} \, dx\\ &=\int \left (\cot ^4(x) \csc ^2(x)-2 \cot ^3(x) \csc ^3(x)+\cot ^2(x) \csc ^4(x)\right ) \, dx\\ &=-\left (2 \int \cot ^3(x) \csc ^3(x) \, dx\right )+\int \cot ^4(x) \csc ^2(x) \, dx+\int \cot ^2(x) \csc ^4(x) \, dx\\ &=2 \operatorname{Subst}\left (\int x^2 \left (-1+x^2\right ) \, dx,x,\csc (x)\right )+\operatorname{Subst}\left (\int x^4 \, dx,x,-\cot (x)\right )+\operatorname{Subst}\left (\int x^2 \left (1+x^2\right ) \, dx,x,-\cot (x)\right )\\ &=-\frac{1}{5} \cot ^5(x)+2 \operatorname{Subst}\left (\int \left (-x^2+x^4\right ) \, dx,x,\csc (x)\right )+\operatorname{Subst}\left (\int \left (x^2+x^4\right ) \, dx,x,-\cot (x)\right )\\ &=-\frac{1}{3} \cot ^3(x)-\frac{2 \cot ^5(x)}{5}-\frac{2 \csc ^3(x)}{3}+\frac{2 \csc ^5(x)}{5}\\ \end{align*}

Mathematica [A]  time = 0.0158117, size = 57, normalized size = 1.73 \[ -\frac{7}{120} \tan \left (\frac{x}{2}\right )-\frac{1}{8} \cot \left (\frac{x}{2}\right )+\frac{1}{40} \tan \left (\frac{x}{2}\right ) \sec ^4\left (\frac{x}{2}\right )-\frac{11}{120} \tan \left (\frac{x}{2}\right ) \sec ^2\left (\frac{x}{2}\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(Sin[x] + Tan[x])^(-2),x]

[Out]

-Cot[x/2]/8 - (7*Tan[x/2])/120 - (11*Sec[x/2]^2*Tan[x/2])/120 + (Sec[x/2]^4*Tan[x/2])/40

________________________________________________________________________________________

Maple [A]  time = 0.041, size = 32, normalized size = 1. \begin{align*}{\frac{1}{40} \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{5}}-{\frac{1}{24} \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{3}}-{\frac{1}{8}\tan \left ({\frac{x}{2}} \right ) }-{\frac{1}{8} \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{-1}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(sin(x)+tan(x))^2,x)

[Out]

1/40*tan(1/2*x)^5-1/24*tan(1/2*x)^3-1/8*tan(1/2*x)-1/8/tan(1/2*x)

________________________________________________________________________________________

Maxima [A]  time = 0.996161, size = 61, normalized size = 1.85 \begin{align*} -\frac{\cos \left (x\right ) + 1}{8 \, \sin \left (x\right )} - \frac{\sin \left (x\right )}{8 \,{\left (\cos \left (x\right ) + 1\right )}} - \frac{\sin \left (x\right )^{3}}{24 \,{\left (\cos \left (x\right ) + 1\right )}^{3}} + \frac{\sin \left (x\right )^{5}}{40 \,{\left (\cos \left (x\right ) + 1\right )}^{5}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(sin(x)+tan(x))^2,x, algorithm="maxima")

[Out]

-1/8*(cos(x) + 1)/sin(x) - 1/8*sin(x)/(cos(x) + 1) - 1/24*sin(x)^3/(cos(x) + 1)^3 + 1/40*sin(x)^5/(cos(x) + 1)
^5

________________________________________________________________________________________

Fricas [A]  time = 2.13688, size = 109, normalized size = 3.3 \begin{align*} -\frac{\cos \left (x\right )^{3} + 2 \, \cos \left (x\right )^{2} + 8 \, \cos \left (x\right ) + 4}{15 \,{\left (\cos \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right )} \sin \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(sin(x)+tan(x))^2,x, algorithm="fricas")

[Out]

-1/15*(cos(x)^3 + 2*cos(x)^2 + 8*cos(x) + 4)/((cos(x)^2 + 2*cos(x) + 1)*sin(x))

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{1}{\left (\sin{\left (x \right )} + \tan{\left (x \right )}\right )^{2}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(sin(x)+tan(x))**2,x)

[Out]

Integral((sin(x) + tan(x))**(-2), x)

________________________________________________________________________________________

Giac [A]  time = 1.15399, size = 42, normalized size = 1.27 \begin{align*} \frac{1}{40} \, \tan \left (\frac{1}{2} \, x\right )^{5} - \frac{1}{24} \, \tan \left (\frac{1}{2} \, x\right )^{3} - \frac{1}{8 \, \tan \left (\frac{1}{2} \, x\right )} - \frac{1}{8} \, \tan \left (\frac{1}{2} \, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(sin(x)+tan(x))^2,x, algorithm="giac")

[Out]

1/40*tan(1/2*x)^5 - 1/24*tan(1/2*x)^3 - 1/8/tan(1/2*x) - 1/8*tan(1/2*x)