Hi there, I'm having a conflict with the book I'm using.

The question is asking to differentiate

$\displaystyle {x}sin{x}+cos{x}$

I use the chain rule for the first term and the sum rule for the whole expression to get

$\displaystyle sinxcosx-sinx$

my book however states the answer is

$\displaystyle sinx-xcosx-sinx=xcosx$

What am I doing wrong?