Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$$ \int x\cos(x) dx $$

So I just the integration by parts: $\int f(x) . g'(x) dx = f(x)g(x) - \int f'(x) \cdot g(x) dx $

$f(x) = x$ and $g'(x) = \cos(x)$, we get:

$$ x \cos(x) dx = x\sin(x) - \int 1 \cdot \sin(x)dx$$

Here is where the problem starts. I am in doubt as to whether which of the following answer (if any) are correct:

$ x \cos(x) dx = x\sin(x) - -x\cos(x)dx$ (does $1$ turn into $x$?, and if not, why not?)


$ x \cos(x) dx = x\sin(x) - - \cos(x)dx$

$ x \cos(x) dx = x\sin(x) + \cos(x)dx$

$ x\sin(x) = 0$? Which must be totally incorrect. Please help me out.

share|cite|improve this question
Your first equality is incorrect, the $1$ does not turn into a $x$, simply because it is a $1$ who multiplies a $\sin$. Your next two are what you need to do, but your third one is wrong, you seem to have simplified $x\cos(x)-\cos(x)$ to $0$ – Jean-Sébastien Nov 26 '12 at 19:16
But isn't the integral of 1 x? – Jijbentlekker Nov 26 '12 at 19:17
See answer underneath – Jean-Sébastien Nov 26 '12 at 19:21
Oh, nevermind, the 1 would only turn into an $x$ if it was a subtraction or addition, right? – Jijbentlekker Nov 26 '12 at 19:22
Note that you can typeset $sin$ and $cos$ with $ "\"sin$. this gives a better result $sin(x)$ compared to $\sin(x)$ – Jean-Sébastien Nov 26 '12 at 19:27
up vote 0 down vote accepted

Your first couple of steps are correct. Why are you hesitating? Just do the last integral so that your answer becomes $$\int x\cos(x)\text{d}x = x\sin(x) + \cos(x) +C .$$ Why do you think this is wrong? You can always take its derivative to check your answer.

share|cite|improve this answer

Integration by parts is definitely the right idea, here. You must be cautious, though, that you don't drop one of the integrations (which I'll deal with in a moment), and that you don't leave any extra differential terms lying about after you've integrated--as you did when you concluded that $\int\sin x\,dx=-\cos x\,dx$ in your second proposed answer (the $dx$ on the right should not be there).

Now, you've got $$x\cos x\,dx=x\sin x-\int 1\cdot \sin x\,dx,$$ which is very similar looking to what integration by parts should give you, but if you compare this to the general formula, you'll see that you've lost an integration! You should have $$\int x\cos x\,dx=x\sin x-\int 1\cdot \sin x\,dx,$$ or, since $1\cdot\sin x=\sin x$ and you know how to take the indefinite integral of $\sin x$, we get $$\int x\cos x\,dx=x\sin x+\cos x+C.$$ This is similar to the second answer you suggested, but that integration sign on the left-hand side makes a big difference!

For more on how we need to treat differential terms, see the first part of this answer.

share|cite|improve this answer

You need to be careful not to do $$ \int f(x)g(x)dx=\int f(x)dx\int g(x) dx. $$ This equality is wrong in most case. Just take $f=g=1$. This is why the $1$ does not turn into a $x$. Using the formula you provide, you get $$ \int x\cos(x)dx=x\sin(x)-\int \sin(x)dx=x\sin(x)- (-\cos(x))=x\sin(x)+\cos(x) $$

share|cite|improve this answer

$x \sin(x)+\cos(x)$ is the right answer. See here.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.