3.7 \(\int \cot ^2(x) (x-\tan (x)) \, dx\)

Optimal. Leaf size=13 \[ -\frac {x^2}{2}-x \cot (x) \]

[Out]

-1/2*x^2-x*cot(x)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 13, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {6742, 3475, 3720, 30} \[ -\frac {x^2}{2}-x \cot (x) \]

Antiderivative was successfully verified.

[In]

Int[Cot[x]^2*(x - Tan[x]),x]

[Out]

-x^2/2 - x*Cot[x]

Rule 30

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

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int \cot ^2(x) (x-\tan (x)) \, dx &=\int \left (-\cot (x)+x \cot ^2(x)\right ) \, dx\\ &=-\int \cot (x) \, dx+\int x \cot ^2(x) \, dx\\ &=-x \cot (x)-\log (\sin (x))-\int x \, dx+\int \cot (x) \, dx\\ &=-\frac {x^2}{2}-x \cot (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 13, normalized size = 1.00 \[ -\frac {x^2}{2}-x \cot (x) \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[x]^2*(x - Tan[x]),x]

[Out]

-1/2*x^2 - x*Cot[x]

________________________________________________________________________________________

fricas [A]  time = 0.43, size = 16, normalized size = 1.23 \[ -\frac {x^{2} \tan \relax (x) + 2 \, x}{2 \, \tan \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.91, size = 16, normalized size = 1.23 \[ -\frac {x^{2} \tan \relax (x) + 2 \, x}{2 \, \tan \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.02, size = 17, normalized size = 1.31 \[ \frac {-\frac {x^{2} \tan \relax (x )}{2}-x}{\tan \relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x-tan(x))/tan(x)^2,x)

[Out]

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

________________________________________________________________________________________

maxima [B]  time = 0.46, size = 144, normalized size = 11.08 \[ -\frac {x^{2} \cos \left (2 \, x\right )^{2} + x^{2} \sin \left (2 \, x\right )^{2} - 2 \, x^{2} \cos \left (2 \, x\right ) + x^{2} - {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \relax (x)^{2} + \sin \relax (x)^{2} + 2 \, \cos \relax (x) + 1\right ) - {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \relax (x)^{2} + \sin \relax (x)^{2} - 2 \, \cos \relax (x) + 1\right ) + 4 \, x \sin \left (2 \, x\right )}{2 \, {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )}} - \log \left (\sin \relax (x)\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*(x^2*cos(2*x)^2 + x^2*sin(2*x)^2 - 2*x^2*cos(2*x) + x^2 - (cos(2*x)^2 + sin(2*x)^2 - 2*cos(2*x) + 1)*log(
cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - (cos(2*x)^2 + sin(2*x)^2 - 2*cos(2*x) + 1)*log(cos(x)^2 + sin(x)^2 - 2*c
os(x) + 1) + 4*x*sin(2*x))/(cos(2*x)^2 + sin(2*x)^2 - 2*cos(2*x) + 1) - log(sin(x))

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 11, normalized size = 0.85 \[ -x\,\mathrm {cot}\relax (x)-\frac {x^2}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x - tan(x))/tan(x)^2,x)

[Out]

- x*cot(x) - x^2/2

________________________________________________________________________________________

sympy [A]  time = 0.18, size = 10, normalized size = 0.77 \[ - \frac {x^{2}}{2} - \frac {x}{\tan {\relax (x )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x-tan(x))/tan(x)**2,x)

[Out]

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

________________________________________________________________________________________