3.2.78 \(\int \frac {1}{\cot (x)+\tan (x)} \, dx\) [178]

Optimal. Leaf size=8 \[ \frac {\sin ^2(x)}{2} \]

[Out]

1/2*sin(x)^2

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 8, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {267} \begin {gather*} -\frac {1}{2} \cos ^2(x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Cot[x] + Tan[x])^(-1),x]

[Out]

-1/2*Cos[x]^2

Rule 267

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(a + b*x^n)^(p + 1)/(b*n*(p + 1)), x] /; FreeQ
[{a, b, m, n, p}, x] && EqQ[m, n - 1] && NeQ[p, -1]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.00, size = 8, normalized size = 1.00 \begin {gather*} -\frac {1}{2} \cos ^2(x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(Cot[x] + Tan[x])^(-1),x]

[Out]

-1/2*Cos[x]^2

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 7, normalized size = 0.88

method result size
default \(-\frac {\left (\cos ^{2}\left (x \right )\right )}{2}\) \(7\)
risch \(-\frac {\cos \left (2 x \right )}{4}\) \(7\)
parallelrisch \(-\frac {\cos \left (2 x \right )}{4}-\frac {1}{4}\) \(9\)
norman \(-\frac {1}{2 \left (1+\tan ^{2}\left (x \right )\right )}\) \(11\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(tan(x)+cot(x)),x,method=_RETURNVERBOSE)

[Out]

-1/2*cos(x)^2

________________________________________________________________________________________

Maxima [A]
time = 0.39, size = 10, normalized size = 1.25 \begin {gather*} -\frac {1}{2 \, {\left (\tan \left (x\right )^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(tan(x)+cot(x)),x, algorithm="maxima")

[Out]

-1/2/(tan(x)^2 + 1)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 16 vs. \(2 (6) = 12\).
time = 0.58, size = 16, normalized size = 2.00 \begin {gather*} \frac {\tan \left (x\right )^{2} - 1}{4 \, {\left (\tan \left (x\right )^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(tan(x)+cot(x)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.29, size = 10, normalized size = 1.25 \begin {gather*} - \frac {1}{2 \tan ^{2}{\left (x \right )} + 2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(tan(x)+cot(x)),x)

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.47, size = 6, normalized size = 0.75 \begin {gather*} -\frac {1}{2} \, \cos \left (x\right )^{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(tan(x)+cot(x)),x, algorithm="giac")

[Out]

-1/2*cos(x)^2

________________________________________________________________________________________

Mupad [B]
time = 0.12, size = 6, normalized size = 0.75 \begin {gather*} \frac {{\sin \left (x\right )}^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(cot(x) + tan(x)),x)

[Out]

sin(x)^2/2

________________________________________________________________________________________

Chatgpt [A] valid for real x
time = 1.00, size = 6, normalized size = 0.75 \begin {gather*} -\frac {\cos \left (2 x \right )}{4} \end {gather*}

Antiderivative was successfully verified.

[In]

int(1/(tan(x)+cot(x)),x)

[Out]

-1/4*cos(2*x)

________________________________________________________________________________________