Product rule involves taking the derivative of function which are multiples of two (or more) functions, in the form f(x)=g(x)*h(x)f(x)=g(x)⋅h(x). The product rule is
d/dx f(x)=(d/dx g(x))*h(x)+g(x)*(d/dx h(x))ddxf(x)=(ddxg(x))⋅h(x)+g(x)⋅(ddxh(x)) .
Applying it to our function,
f(x)=(x-e^x)(cosx+2sinx)f(x)=(x−ex)(cosx+2sinx)
We have
d/dx f(x)=(d/dx (x-e^x))(cosx+2sinx)+ (x-e^x)(d/dx(cosx+2sinx))ddxf(x)=(ddx(x−ex))(cosx+2sinx)+(x−ex)(ddx(cosx+2sinx)) .
Additionally we need to use the linearity of the derivation, that
d/dx(a*f(x)+b*g(x))=a*(d/dx f(x))+b*(d/dx g(x))ddx(a⋅f(x)+b⋅g(x))=a⋅(ddxf(x))+b⋅(ddxg(x)) .
Applying this we have
d/dx f(x)=(d/dx (x)-d/dx (e^x))(cosx+2sinx)+ (x-e^x)(d/dx(cosx)+2*d/dx (sinx))ddxf(x)=(ddx(x)−ddx(ex))(cosx+2sinx)+(x−ex)(ddx(cosx)+2⋅ddx(sinx)) .
We need to do the individual derivatives of these functions, we use
d/dx x^n= n*x^{n-1}ddxxn=n⋅xn−1 d/dx e^x=e^xddxex=ex
d/dx sin x= cos xddxsinx=cosx d/dx cos x= - sin xddxcosx=−sinx .
Now we have
d/dx f(x)=(1*x^0-e^x)(cosx+2sinx)+ (x-e^x)(-sinx+2cosx)ddxf(x)=(1⋅x0−ex)(cosx+2sinx)+(x−ex)(−sinx+2cosx) .
d/dx f(x)=(1-e^x)(cosx+2sinx)+ (x-e^x)(-sinx+2cosx)ddxf(x)=(1−ex)(cosx+2sinx)+(x−ex)(−sinx+2cosx)
At this point we just neaten a bit
d/dx f(x)=(cosx+2sinx)-e^x(cosx+2sinx)+ x(-sinx+2*cosx)+e^x(sinx-2cosx)ddxf(x)=(cosx+2sinx)−ex(cosx+2sinx)+x(−sinx+2⋅cosx)+ex(sinx−2cosx)
d/dx f(x)=cosx+2sinx-e^xcosx-2 e^xsinx- xsinx+2xcosx+e^x sinx-2e^xcosxddxf(x)=cosx+2sinx−excosx−2exsinx−xsinx+2xcosx+exsinx−2excosx
d/dx f(x)=cosx+2sinx-3e^xcosx-e^xsinx- xsinx+2xcosxddxf(x)=cosx+2sinx−3excosx−exsinx−xsinx+2xcosx