3.1.70 \(\int \frac {2}{(\cos (x)-\sin (x))^2} \, dx\) [70]

Optimal. Leaf size=8 \[ \frac {2}{-1+\cot (x)} \]

[Out]

2/(-1+cot(x))

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 13, normalized size of antiderivative = 1.62, number of steps used = 2, number of rules used = 2, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {12, 3154} \begin {gather*} \frac {2 \sin (x)}{\cos (x)-\sin (x)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[2/(Cos[x] - Sin[x])^2,x]

[Out]

(2*Sin[x])/(Cos[x] - Sin[x])

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3154

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-2), x_Symbol] :> Simp[Sin[c + d*x]/(a*d*
(a*Cos[c + d*x] + b*Sin[c + d*x])), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {gather*} \begin {aligned} \text {Integral} &=2 \int \frac {1}{(\cos (x)-\sin (x))^2} \, dx\\ &=\frac {2 \sin (x)}{\cos (x)-\sin (x)}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 13, normalized size = 1.62 \begin {gather*} \frac {2 \sin (x)}{\cos (x)-\sin (x)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[2/(Cos[x] - Sin[x])^2,x]

[Out]

(2*Sin[x])/(Cos[x] - Sin[x])

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 9, normalized size = 1.12

method result size
default \(-\frac {2}{\tan \left (x \right )-1}\) \(9\)
risch \(\frac {2}{{\mathrm e}^{2 i x}-i}\) \(13\)
parallelrisch \(\frac {2 \sin \left (x \right )}{\cos \left (x \right )-\sin \left (x \right )}\) \(14\)
norman \(-\frac {4 \tan \left (\frac {x}{2}\right )}{\tan ^{2}\left (\frac {x}{2}\right )+2 \tan \left (\frac {x}{2}\right )-1}\) \(23\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(2/(cos(x)-sin(x))^2,x,method=_RETURNVERBOSE)

[Out]

-2/(tan(x)-1)

________________________________________________________________________________________

Maxima [A]
time = 0.40, size = 8, normalized size = 1.00 \begin {gather*} -\frac {2}{\tan \left (x\right ) - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(2/(cos(x)-sin(x))^2,x, algorithm="maxima")

[Out]

-2/(tan(x) - 1)

________________________________________________________________________________________

Fricas [A]
time = 0.57, size = 15, normalized size = 1.88 \begin {gather*} \frac {\cos \left (x\right ) + \sin \left (x\right )}{\cos \left (x\right ) - \sin \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(2/(cos(x)-sin(x))^2,x, algorithm="fricas")

[Out]

(cos(x) + sin(x))/(cos(x) - sin(x))

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 22 vs. \(2 (5) = 10\).
time = 0.48, size = 22, normalized size = 2.75 \begin {gather*} - \frac {4 \tan {\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 2 \tan {\left (\frac {x}{2} \right )} - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(2/(cos(x)-sin(x))**2,x)

[Out]

-4*tan(x/2)/(tan(x/2)**2 + 2*tan(x/2) - 1)

________________________________________________________________________________________

Giac [A]
time = 0.52, size = 8, normalized size = 1.00 \begin {gather*} -\frac {2}{\tan \left (x\right ) - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(2/(cos(x)-sin(x))^2,x, algorithm="giac")

[Out]

-2/(tan(x) - 1)

________________________________________________________________________________________

Mupad [B]
time = 0.20, size = 13, normalized size = 1.62 \begin {gather*} \frac {2\,\sin \left (x\right )}{\cos \left (x\right )-\sin \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(2/(cos(x) - sin(x))^2,x)

[Out]

(2*sin(x))/(cos(x) - sin(x))

________________________________________________________________________________________

Chatgpt [F] Failed to verify
time = 1.00, size = 7, normalized size = 0.88 \begin {gather*} -2 \arctan \left (\cos \left (x \right )-1\right ) \end {gather*}

Warning: Unable to verify antiderivative.

[In]

int(2/(cos(x)-sin(x))^2,x)

[Out]

-2*arctan(cos(x)-1)

________________________________________________________________________________________