How is the derivitive of x*cosx*sinx 1/2*sin2x + xcos2x?

find f'(x) when f(x) = x * cos(x) * sin(x)

I tried using the product rule on xcosx and got:
(xcosx)’ = -xsinx + cosx
then I used the product rule to differentiate xcosx * sinx and got:
(xcosx * sinx)’ = (-x * sinx + cosx)(sinx) + (xcosx * cosx)
= -xsin^2(x) + sinx * cosx + xcos^2x

My testbook says the answer is (1/2) * sin(2x) + xcos(2x)

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.