# Thread: differentiating trig function xsinx+cosx

1. ## differentiating trig function xsinx+cosx

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?

2. Originally Posted by flashylightsmeow

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

$\displaystyle sinxcosx-sinx$
First tell me how did you get this? Explain a bit.

3. ok, so i treated $\displaystyle xsinx$ as a composite function s(r(x)) where s(x)=....wait a minute...ffs I have to use the product rule don't I? so I get $\displaystyle xcosx+sinx-sinx=xcosx$!! Thank you!

4. Now you got it right. Silly mistake is a very bad habit; try to get rid of it....

5. Ugh, I know, I have a maths exam coming up and I keep making these stupid mistakes. How do you get rid of them though? Practise?

6. Yes. And also concentration. You don't need solve numerous problems each day. Just make sure one thing: whatever you do, you do it correctly.

7. Thanks Sambit. Will try and apply myself more!