3.146 \(\int \cot (\frac{x}{2}) \cot (x) \, dx\)

Optimal. Leaf size=12 \[ -x-\cot \left (\frac{x}{2}\right ) \]

[Out]

-x - Cot[x/2]

________________________________________________________________________________________

Rubi [A]  time = 0.0304232, antiderivative size = 12, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 9, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.333, Rules used = {12, 453, 203} \[ -x-\cot \left (\frac{x}{2}\right ) \]

Antiderivative was successfully verified.

[In]

Int[Cot[x/2]*Cot[x],x]

[Out]

-x - Cot[x/2]

Rule 12

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

Rule 453

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(c*(e*x)^(m
+ 1)*(a + b*x^n)^(p + 1))/(a*e*(m + 1)), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 203

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

Rubi steps

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

Mathematica [A]  time = 0.0128978, size = 12, normalized size = 1. \[ -x-\cot \left (\frac{x}{2}\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[x/2]*Cot[x],x]

[Out]

-x - Cot[x/2]

________________________________________________________________________________________

Maple [A]  time = 0.044, size = 11, normalized size = 0.9 \begin{align*} -x-\cot \left ({\frac{x}{2}} \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/sin(x)/tan(1/2*x),x)

[Out]

-x-cot(1/2*x)

________________________________________________________________________________________

Maxima [B]  time = 0.951178, size = 55, normalized size = 4.58 \begin{align*} -\frac{x \cos \left (x\right )^{2} + x \sin \left (x\right )^{2} - 2 \, x \cos \left (x\right ) + x + 2 \, \sin \left (x\right )}{\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/tan(1/2*x),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.70271, size = 43, normalized size = 3.58 \begin{align*} -\frac{x \tan \left (\frac{1}{2} \, x\right ) + 1}{\tan \left (\frac{1}{2} \, x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/tan(1/2*x),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/tan(1/2*x),x)

[Out]

Integral(cos(x)/(sin(x)*tan(x/2)), x)

________________________________________________________________________________________

Giac [A]  time = 1.11236, size = 24, normalized size = 2. \begin{align*} -x - \frac{1}{2 \, \tan \left (\frac{1}{4} \, x\right )} + \frac{1}{2} \, \tan \left (\frac{1}{4} \, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/sin(x)/tan(1/2*x),x, algorithm="giac")

[Out]

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