\(\int (-\cos ^2(x)+\sin ^2(x)) \, dx\) [839]

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

Optimal result

Integrand size = 11, antiderivative size = 6 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\cos (x) \sin (x) \]

[Out]

-cos(x)*sin(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {2715, 8} \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=\sin (x) (-\cos (x)) \]

[In]

Int[-Cos[x]^2 + Sin[x]^2,x]

[Out]

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

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

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

Rubi steps \begin{align*} \text {integral}& = -\int \cos ^2(x) \, dx+\int \sin ^2(x) \, dx \\ & = -\cos (x) \sin (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.33 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\frac {1}{2} \sin (2 x) \]

[In]

Integrate[-Cos[x]^2 + Sin[x]^2,x]

[Out]

-1/2*Sin[2*x]

Maple [A] (verified)

Time = 0.52 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.17

method result size
default \(-\cos \left (x \right ) \sin \left (x \right )\) \(7\)
risch \(-\frac {\sin \left (2 x \right )}{2}\) \(7\)
parallelrisch \(-\frac {\sin \left (2 x \right )}{2}\) \(7\)
parts \(-\cos \left (x \right ) \sin \left (x \right )\) \(7\)

[In]

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

[Out]

-cos(x)*sin(x)

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\cos \left (x\right ) \sin \left (x\right ) \]

[In]

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

[Out]

-cos(x)*sin(x)

Sympy [A] (verification not implemented)

Time = 0.02 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.17 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=- \sin {\left (x \right )} \cos {\left (x \right )} \]

[In]

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

[Out]

-sin(x)*cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\frac {1}{2} \, \sin \left (2 \, x\right ) \]

[In]

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

[Out]

-1/2*sin(2*x)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\frac {1}{2} \, \sin \left (2 \, x\right ) \]

[In]

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

[Out]

-1/2*sin(2*x)

Mupad [B] (verification not implemented)

Time = 26.15 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \left (-\cos ^2(x)+\sin ^2(x)\right ) \, dx=-\frac {\sin \left (2\,x\right )}{2} \]

[In]

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

[Out]

-sin(2*x)/2