# How is the derivative of $x\cos x\sin x$ $\frac12\sin2x + x\cos2x$?

Find $$f'(x)$$ when $$f(x) = x\cos(x) \sin(x)$$

I tried using the product rule on $$x\cos x$$ and got: $$(x\cos x)' = -x\sin x + \cos x$$ then I used the product rule to differentiate $$x\cos x\sin x$$ and got: $$(x\cos x \sin x)' = (-x \sin x + \cos x)\sin x+ (x\cos x \cos x)= -x\sin^2x+ \sin x \cos x + x\cos^2x$$ My testbook says the answer is $$\frac12\sin2x+ x\cos2x$$

Can someone please explain how to achieve the answer shown in my textbook? I am new to calc and trig, and I'm very confused. Any help is appreciated.

• A tip: when "I got this but my textbook got that", if trigonometry is involved, there's probably an identity that shows your book agrees with you. (Two in this case.) It happens all the time. – J.G. May 30 at 18:45

You're right. Use,

$$2\sin x\cos x = \sin(2x)$$

and

$$\cos^2x-\sin^2x= \cos(2x)$$

So that,

$$x(\cos^2x-\sin^2x) + \sin x \cos x = x\cos(2x) + \frac{1}{2}\sin(2x)$$

• thank you, I was unaware of the first rule. – nokia2008 Jun 4 at 18:30

The two answers are equivalent: $$-x\sin^2x+\sin x\cos x+x\cos^2x=x(\cos^2x-\sin^2x)+\frac12\sin2x=x\cos2x+\frac12\sin2x$$