3.3 \(\int \sin (x) (a \cos (x)+b \sin (x)) \, dx\)

Optimal. Leaf size=25 \[ \frac {1}{2} a \sin ^2(x)+\frac {b x}{2}-\frac {1}{2} b \sin (x) \cos (x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {3089, 2564, 30, 2635, 8} \[ \frac {1}{2} a \sin ^2(x)+\frac {b x}{2}-\frac {1}{2} b \sin (x) \cos (x) \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

(b*x)/2 - (b*Cos[x]*Sin[x])/2 + (a*Sin[x]^2)/2

Rule 8

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

Rule 30

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

Rule 2564

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 2635

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] && Integer
Q[2*n]

Rule 3089

Int[sin[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[sin[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.00, size = 25, normalized size = 1.00 \[ -\frac {1}{2} a \cos ^2(x)+\frac {b x}{2}-\frac {1}{4} b \sin (2 x) \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

(b*x)/2 - (a*Cos[x]^2)/2 - (b*Sin[2*x])/4

________________________________________________________________________________________

fricas [A]  time = 0.40, size = 19, normalized size = 0.76 \[ -\frac {1}{2} \, a \cos \relax (x)^{2} - \frac {1}{2} \, b \cos \relax (x) \sin \relax (x) + \frac {1}{2} \, b x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.17, size = 19, normalized size = 0.76 \[ \frac {1}{2} \, b x - \frac {1}{4} \, a \cos \left (2 \, x\right ) - \frac {1}{4} \, b \sin \left (2 \, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

1/2*b*x - 1/4*a*cos(2*x) - 1/4*b*sin(2*x)

________________________________________________________________________________________

maple [A]  time = 0.16, size = 21, normalized size = 0.84 \[ b \left (-\frac {\cos \relax (x ) \sin \relax (x )}{2}+\frac {x}{2}\right )-\frac {a \left (\cos ^{2}\relax (x )\right )}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)*(a*cos(x)+b*sin(x)),x)

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 21, normalized size = 0.84 \[ -\frac {1}{2} \, a \cos \relax (x)^{2} + \frac {1}{4} \, b {\left (2 \, x - \sin \left (2 \, x\right )\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.41, size = 19, normalized size = 0.76 \[ \frac {a\,{\sin \relax (x)}^2}{2}-\frac {b\,\cos \relax (x)\,\sin \relax (x)}{2}+\frac {b\,x}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)*(a*cos(x) + b*sin(x)),x)

[Out]

(a*sin(x)^2)/2 + (b*x)/2 - (b*cos(x)*sin(x))/2

________________________________________________________________________________________

sympy [A]  time = 0.16, size = 37, normalized size = 1.48 \[ - \frac {a \cos ^{2}{\relax (x )}}{2} + \frac {b x \sin ^{2}{\relax (x )}}{2} + \frac {b x \cos ^{2}{\relax (x )}}{2} - \frac {b \sin {\relax (x )} \cos {\relax (x )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)*(a*cos(x)+b*sin(x)),x)

[Out]

-a*cos(x)**2/2 + b*x*sin(x)**2/2 + b*x*cos(x)**2/2 - b*sin(x)*cos(x)/2

________________________________________________________________________________________