3.696 \(\int \frac{\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx\)

Optimal. Leaf size=33 \[ x-\tan ^{-1}\left (\frac{-2 \cos ^2(x)+\sin (x) \cos (x)+1}{\cos ^2(x)+2 \sin (x) \cos (x)+2}\right ) \]

[Out]

x - ArcTan[(1 - 2*Cos[x]^2 + Cos[x]*Sin[x])/(2 + Cos[x]^2 + 2*Cos[x]*Sin[x])]

________________________________________________________________________________________

Rubi [A]  time = 0.0422412, antiderivative size = 33, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.176, Rules used = {4342, 617, 204} \[ x-\tan ^{-1}\left (\frac{-2 \cos ^2(x)+\sin (x) \cos (x)+1}{\cos ^2(x)+2 \sin (x) \cos (x)+2}\right ) \]

Antiderivative was successfully verified.

[In]

Int[Sec[x]^2/(2 + 2*Tan[x] + Tan[x]^2),x]

[Out]

x - ArcTan[(1 - 2*Cos[x]^2 + Cos[x]*Sin[x])/(2 + Cos[x]^2 + 2*Cos[x]*Sin[x])]

Rule 4342

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

Rule 617

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[(a*c)/b^2]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + (2*c*x)/b], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rubi steps

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

Mathematica [A]  time = 0.0438872, size = 31, normalized size = 0.94 \[ 2 \left (\frac{1}{4} \tan ^{-1}(\sec (x) (\sin (x)+\cos (x)))-\frac{1}{4} \tan ^{-1}\left (\frac{\cos (x)}{\sin (x)+\cos (x)}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]^2/(2 + 2*Tan[x] + Tan[x]^2),x]

[Out]

2*(-ArcTan[Cos[x]/(Cos[x] + Sin[x])]/4 + ArcTan[Sec[x]*(Cos[x] + Sin[x])]/4)

________________________________________________________________________________________

Maple [A]  time = 0.06, size = 6, normalized size = 0.2 \begin{align*} \arctan \left ( 1+\tan \left ( x \right ) \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)^2/(2+2*tan(x)+tan(x)^2),x)

[Out]

arctan(1+tan(x))

________________________________________________________________________________________

Maxima [A]  time = 1.44625, size = 7, normalized size = 0.21 \begin{align*} \arctan \left (\tan \left (x\right ) + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="maxima")

[Out]

arctan(tan(x) + 1)

________________________________________________________________________________________

Fricas [A]  time = 2.04943, size = 117, normalized size = 3.55 \begin{align*} -\frac{1}{2} \, \arctan \left (-\frac{3 \, \cos \left (x\right )^{2} + 6 \, \cos \left (x\right ) \sin \left (x\right ) + 1}{2 \,{\left (2 \, \cos \left (x\right )^{2} - \cos \left (x\right ) \sin \left (x\right ) - 1\right )}}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="fricas")

[Out]

-1/2*arctan(-1/2*(3*cos(x)^2 + 6*cos(x)*sin(x) + 1)/(2*cos(x)^2 - cos(x)*sin(x) - 1))

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)**2/(2+2*tan(x)+tan(x)**2),x)

[Out]

Integral(sec(x)**2/(tan(x)**2 + 2*tan(x) + 2), x)

________________________________________________________________________________________

Giac [A]  time = 1.09298, size = 7, normalized size = 0.21 \begin{align*} \arctan \left (\tan \left (x\right ) + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="giac")

[Out]

arctan(tan(x) + 1)