1

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

So I just the integration by parts: $\int f(x) \cdot 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?)

or

$ 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.

4 Answers4

2

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.

Cameron Buie
  • 102,994
1

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) $$

Jean-Sébastien
  • 4,623
  • 1
  • 17
  • 39
0

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

Cameron Buie
  • 102,994
Dominik
  • 14,396
0

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.

Cameron Buie
  • 102,994
dayar
  • 1,240