\(\int x \cos ^2(x) \cot ^2(x) \, dx\) [487]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [B] (verified)
Fricas [A] (verification not implemented)
Sympy [B] (verification not implemented)
Maxima [F(-2)]
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 33 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=-\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)+\log (\sin (x))-\frac {1}{2} x \cos (x) \sin (x) \] Output:

-3/4*x^2-1/4*cos(x)^2-x*cot(x)+ln(sin(x))-1/2*x*cos(x)*sin(x)
 

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=-\frac {3 x^2}{4}-\frac {1}{8} \cos (2 x)-x \cot (x)+\log (\sin (x))-\frac {1}{4} x \sin (2 x) \] Input:

Integrate[x*Cos[x]^2*Cot[x]^2,x]
 

Output:

(-3*x^2)/4 - Cos[2*x]/8 - x*Cot[x] + Log[Sin[x]] - (x*Sin[2*x])/4
 

Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {4908, 3042, 3791, 15, 4203, 15, 25, 3042, 25, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int x \cos ^2(x) \cot ^2(x) \, dx\)

\(\Big \downarrow \) 4908

\(\displaystyle \int x \cot ^2(x)dx-\int x \cos ^2(x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int x \tan \left (x+\frac {\pi }{2}\right )^2dx-\int x \sin \left (x+\frac {\pi }{2}\right )^2dx\)

\(\Big \downarrow \) 3791

\(\displaystyle -\frac {\int xdx}{2}+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx-\frac {1}{4} \cos ^2(x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 15

\(\displaystyle \int x \tan \left (x+\frac {\pi }{2}\right )^2dx-\frac {x^2}{4}-\frac {\cos ^2(x)}{4}-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 4203

\(\displaystyle -\int xdx-\int -\cot (x)dx-\frac {x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 15

\(\displaystyle -\int -\cot (x)dx-\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 25

\(\displaystyle \int \cot (x)dx-\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 3042

\(\displaystyle \int -\tan \left (x+\frac {\pi }{2}\right )dx-\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \tan \left (x+\frac {\pi }{2}\right )dx-\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)-\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 3956

\(\displaystyle -\frac {3 x^2}{4}-\frac {\cos ^2(x)}{4}-x \cot (x)+\log (\sin (x))-\frac {1}{2} x \sin (x) \cos (x)\)

Input:

Int[x*Cos[x]^2*Cot[x]^2,x]
 

Output:

(-3*x^2)/4 - Cos[x]^2/4 - x*Cot[x] + Log[Sin[x]] - (x*Cos[x]*Sin[x])/2
 

Defintions of rubi rules used

rule 15
Int[(a_.)*(x_)^(m_.), x_Symbol] :> Simp[a*(x^(m + 1)/(m + 1)), x] /; FreeQ[ 
{a, m}, x] && NeQ[m, -1]
 

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3791
Int[((c_.) + (d_.)*(x_))*((b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> 
 Simp[d*((b*Sin[e + f*x])^n/(f^2*n^2)), x] + (-Simp[b*(c + d*x)*Cos[e + f*x 
]*((b*Sin[e + f*x])^(n - 1)/(f*n)), x] + Simp[b^2*((n - 1)/n)   Int[(c + d* 
x)*(b*Sin[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n, 
 1]
 

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

rule 4203
Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symb 
ol] :> Simp[b*(c + d*x)^m*((b*Tan[e + f*x])^(n - 1)/(f*(n - 1))), x] + (-Si 
mp[b*d*(m/(f*(n - 1)))   Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1), x] 
, x] - Simp[b^2   Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; Free 
Q[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 0]
 

rule 4908
Int[Cos[(a_.) + (b_.)*(x_)]^(n_.)*Cot[(a_.) + (b_.)*(x_)]^(p_.)*((c_.) + (d 
_.)*(x_))^(m_.), x_Symbol] :> -Int[(c + d*x)^m*Cos[a + b*x]^n*Cot[a + b*x]^ 
(p - 2), x] + Int[(c + d*x)^m*Cos[a + b*x]^(n - 2)*Cot[a + b*x]^p, x] /; Fr 
eeQ[{a, b, c, d, m}, x] && IGtQ[n, 0] && IGtQ[p, 0]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(55\) vs. \(2(27)=54\).

Time = 0.49 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.70

method result size
parallelrisch \(-\frac {3}{8}-\ln \left (\sec \left (\frac {x}{2}\right )^{2}\right )+\ln \left (\tan \left (\frac {x}{2}\right )\right )+\frac {x \left (-3-2 \cos \left (x \right )+\cos \left (2 x \right )\right ) \cot \left (\frac {x}{2}\right )}{4}+\frac {\sec \left (\frac {x}{2}\right ) \csc \left (\frac {x}{2}\right ) x}{2}-\frac {3 x^{2}}{4}-\frac {\cos \left (2 x \right )}{8}\) \(56\)
risch \(-\frac {3 x^{2}}{4}+\frac {i \left (i+2 x \right ) {\mathrm e}^{2 i x}}{16}-\frac {i \left (-i+2 x \right ) {\mathrm e}^{-2 i x}}{16}-2 i x -\frac {2 i x}{{\mathrm e}^{2 i x}-1}+\ln \left ({\mathrm e}^{2 i x}-1\right )\) \(60\)
norman \(\frac {\tan \left (\frac {x}{2}\right )^{3}-\frac {x}{2}-\frac {3 x \tan \left (\frac {x}{2}\right )^{2}}{2}+\frac {3 x \tan \left (\frac {x}{2}\right )^{4}}{2}+\frac {x \tan \left (\frac {x}{2}\right )^{6}}{2}-\frac {3 x^{2} \tan \left (\frac {x}{2}\right )}{4}-\frac {3 x^{2} \tan \left (\frac {x}{2}\right )^{3}}{2}-\frac {3 \tan \left (\frac {x}{2}\right )^{5} x^{2}}{4}}{\left (1+\tan \left (\frac {x}{2}\right )^{2}\right )^{2} \tan \left (\frac {x}{2}\right )}-\ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )+\ln \left (\tan \left (\frac {x}{2}\right )\right )\) \(103\)

Input:

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

Output:

-3/8-ln(sec(1/2*x)^2)+ln(tan(1/2*x))+1/4*x*(-3-2*cos(x)+cos(2*x))*cot(1/2* 
x)+1/2*sec(1/2*x)*csc(1/2*x)*x-3/4*x^2-1/8*cos(2*x)
 

Fricas [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.36 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=\frac {4 \, x \cos \left (x\right )^{3} - 12 \, x \cos \left (x\right ) - {\left (6 \, x^{2} + 2 \, \cos \left (x\right )^{2} - 1\right )} \sin \left (x\right ) + 8 \, \log \left (\frac {1}{2} \, \sin \left (x\right )\right ) \sin \left (x\right )}{8 \, \sin \left (x\right )} \] Input:

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

Output:

1/8*(4*x*cos(x)^3 - 12*x*cos(x) - (6*x^2 + 2*cos(x)^2 - 1)*sin(x) + 8*log( 
1/2*sin(x))*sin(x))/sin(x)
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 507 vs. \(2 (32) = 64\).

Time = 0.56 (sec) , antiderivative size = 507, normalized size of antiderivative = 15.36 \[ \int x \cos ^2(x) \cot ^2(x) \, dx =\text {Too large to display} \] Input:

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

Output:

-3*x**2*tan(x/2)**5/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) - 6*x**2* 
tan(x/2)**3/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) - 3*x**2*tan(x/2) 
/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) + 2*x*tan(x/2)**6/(4*tan(x/2 
)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) + 6*x*tan(x/2)**4/(4*tan(x/2)**5 + 8*ta 
n(x/2)**3 + 4*tan(x/2)) - 6*x*tan(x/2)**2/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 
 4*tan(x/2)) - 2*x/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) - 4*log(ta 
n(x/2)**2 + 1)*tan(x/2)**5/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2)) - 
8*log(tan(x/2)**2 + 1)*tan(x/2)**3/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan( 
x/2)) - 4*log(tan(x/2)**2 + 1)*tan(x/2)/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4 
*tan(x/2)) + 4*log(tan(x/2))*tan(x/2)**5/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 
4*tan(x/2)) + 8*log(tan(x/2))*tan(x/2)**3/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 
 4*tan(x/2)) + 4*log(tan(x/2))*tan(x/2)/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4 
*tan(x/2)) + 4*tan(x/2)**3/(4*tan(x/2)**5 + 8*tan(x/2)**3 + 4*tan(x/2))
 

Maxima [F(-2)]

Exception generated. \[ \int x \cos ^2(x) \cot ^2(x) \, dx=\text {Exception raised: RuntimeError} \] Input:

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

Output:

Exception raised: RuntimeError >> ECL says: THROW: The catch RAT-ERR is un 
defined.
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 206 vs. \(2 (27) = 54\).

Time = 0.14 (sec) , antiderivative size = 206, normalized size of antiderivative = 6.24 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=-\frac {6 \, x^{2} \tan \left (\frac {1}{2} \, x\right )^{5} - 4 \, x \tan \left (\frac {1}{2} \, x\right )^{6} - 4 \, \log \left (\frac {16 \, \tan \left (\frac {1}{2} \, x\right )^{2}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{5} + 12 \, x^{2} \tan \left (\frac {1}{2} \, x\right )^{3} - 12 \, x \tan \left (\frac {1}{2} \, x\right )^{4} + \tan \left (\frac {1}{2} \, x\right )^{5} - 8 \, \log \left (\frac {16 \, \tan \left (\frac {1}{2} \, x\right )^{2}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{3} + 6 \, x^{2} \tan \left (\frac {1}{2} \, x\right ) + 12 \, x \tan \left (\frac {1}{2} \, x\right )^{2} - 6 \, \tan \left (\frac {1}{2} \, x\right )^{3} - 4 \, \log \left (\frac {16 \, \tan \left (\frac {1}{2} \, x\right )^{2}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right ) + 4 \, x + \tan \left (\frac {1}{2} \, x\right )}{8 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{5} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{3} + \tan \left (\frac {1}{2} \, x\right )\right )}} \] Input:

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

Output:

-1/8*(6*x^2*tan(1/2*x)^5 - 4*x*tan(1/2*x)^6 - 4*log(16*tan(1/2*x)^2/(tan(1 
/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan(1/2*x)^5 + 12*x^2*tan(1/2*x)^3 - 12*x*t 
an(1/2*x)^4 + tan(1/2*x)^5 - 8*log(16*tan(1/2*x)^2/(tan(1/2*x)^4 + 2*tan(1 
/2*x)^2 + 1))*tan(1/2*x)^3 + 6*x^2*tan(1/2*x) + 12*x*tan(1/2*x)^2 - 6*tan( 
1/2*x)^3 - 4*log(16*tan(1/2*x)^2/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan( 
1/2*x) + 4*x + tan(1/2*x))/(tan(1/2*x)^5 + 2*tan(1/2*x)^3 + tan(1/2*x))
 

Mupad [B] (verification not implemented)

Time = 0.37 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.70 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=\ln \left ({\mathrm {e}}^{x\,2{}\mathrm {i}}-1\right )-{\mathrm {e}}^{-x\,2{}\mathrm {i}}\,\left (\frac {1}{16}+\frac {x\,1{}\mathrm {i}}{8}\right )+{\mathrm {e}}^{x\,2{}\mathrm {i}}\,\left (-\frac {1}{16}+\frac {x\,1{}\mathrm {i}}{8}\right )-\frac {3\,x^2}{4}-x\,2{}\mathrm {i}-\frac {x\,2{}\mathrm {i}}{{\mathrm {e}}^{x\,2{}\mathrm {i}}-1} \] Input:

int((x*cos(x)^4)/sin(x)^2,x)
 

Output:

log(exp(x*2i) - 1) - x*2i - exp(-x*2i)*((x*1i)/8 + 1/16) + exp(x*2i)*((x*1 
i)/8 - 1/16) - (x*2i)/(exp(x*2i) - 1) - (3*x^2)/4
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 58, normalized size of antiderivative = 1.76 \[ \int x \cos ^2(x) \cot ^2(x) \, dx=\frac {-2 \cos \left (x \right ) \sin \left (x \right )^{2} x -4 \cos \left (x \right ) x -4 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )^{2}+1\right ) \sin \left (x \right )+4 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )\right ) \sin \left (x \right )+\sin \left (x \right )^{3}-3 \sin \left (x \right ) x^{2}-2 \sin \left (x \right )}{4 \sin \left (x \right )} \] Input:

int(x*cos(x)^4/sin(x)^2,x)
 

Output:

( - 2*cos(x)*sin(x)**2*x - 4*cos(x)*x - 4*log(tan(x/2)**2 + 1)*sin(x) + 4* 
log(tan(x/2))*sin(x) + sin(x)**3 - 3*sin(x)*x**2 - 2*sin(x))/(4*sin(x))