3

I seems to be stumped in this integral by parts problem. I have $$ \int (x^2+2x) \cos(x)\,dx $$ step 1- pick my $u , dv, du, v$ $$u=x^2+2x$$ $$du=(2x+2) \,dx$$ $$dv = \cos(x)$$ $$v= \sin(x) $$ step 2- apply my formula $uv - \int v \,du$ $$(x^2+2x)(\sin(x))-\int(\sin(x)(2x+2) \,dx$$ step 3 solve my integral(i think this is where im screwin up) note: just working with the right hand side of the formula. distribute the $2x+2$ to my $\sin(x)$ $$\int 2x\sin(x) + 2\sin x$$ factor out a $2$ $$-2\int x \sin(x)+\sin(x)\,dx$$ take the integral of $\sin(x)$, $-\cos(x)$ so thus far i would have $$(x^2+2x)(\sin(x))-2-\cos(x) - \int x\sin(x) \, dx$$ by using a simple substitution for the last integrand i would end up with $-\cos(x)$ so my final result is $$(x^2+2x)(\sin(x))-2-\cos(x)-\cos(x) $$ this is not the answer but can someone spot where i went wrong I simply cant see my mistake or "MISTAKES". Thanks in advance. Miguel

Pedro
  • 122,002
Miguel
  • 557
  • 7
  • 11
  • 20
  • 1
    thank you mike for the edit help. Still trying to get the LATEX syntax down correctly my apologies for the sloppiness. – Miguel Jun 02 '13 at 17:22

6 Answers6

2

The first integration by parts went fine. We now need $\int(2x+2)\sin x\,dx$. Use integration by parts again, $u=2x+2$, $dv=\sin x\,dx$.

Remark: In the OP, there is some casualness with notation. Such casualness often comes at a cost. Unpleasantly fussy people like me take off marks. And the probability of coming up with wrong answers increases.

There is a pattern in the integration by parts of things like $\int(x^2+2x)\cos x\,dx$, or $\int x^3 e^{-7x}\,dx$. One integratio by parts reduces the quadratic $x^2+2x$ to the linear $2x+2$. The next integration by parts reduces the linear $2x+2$ to the harmless constant $2$. Similarly, for $\int x^3 e^{-7x}\,dx$ it will take three integrations by parts to do the calculation.

André Nicolas
  • 507,029
  • forgive me im just an amateur. im trying to learn how to do this correctly. thanks for pointing out my casualness i'm trying to tidy up both my understanding and my notation. – Miguel Jun 02 '13 at 17:18
2

Multiple integration by parts is very error prone. Here is a notation that could help.

$\int f g =f g^{\uparrow} - f^\downarrow g^{\uparrow\uparrow}+ f^{\downarrow\downarrow}g^{\uparrow\uparrow\uparrow}- \int (f^{\downarrow\downarrow\downarrow} g^{\uparrow\uparrow\uparrow})$.

so

$\int (x^2+2x) \cos x =(x^2+2x) (\cos x)^{\uparrow} - (x^2+2x)^\downarrow (\cos x)^{\uparrow\uparrow}+ (x^2+2x)^{\downarrow\downarrow}(\cos x)^{\uparrow\uparrow\uparrow}- \int (x^2+2x)^{\downarrow\downarrow\downarrow} (\cos x)^{\uparrow\uparrow\uparrow}$

where up arrow mean integrate and down arrow means differentiate.

So you get

$\int (x^2+2x) \cos x =(x^2+2x) (\sin x) - (2x+2) (-\cos x)+ (2)(-\sin x)- \int (0)$

In short: you start with the polynomial and differentiate it repeatedly, the other part is integrated repeatedly.

That gives

$\int (x^2+2x) \cos x =(x^2+2x) \sin x + (2x+2) \cos x - 2\sin x+C$

More Description

Maesumi
  • 3,702
1

Your minus signs aren't always in the correct places. $$ \begin{align*} \int 2x\sin x+2\sin x~dx&=2\int x\sin x~dx+2\int\sin x~dx \\ &=2(\sin x-x\cos x)-2\cos x \\ &=2\sin x-2x\cos x-2\cos x \end{align*} $$ So when you take the negative of this you should just be left with $2(x+1)\cos x-2\sin x$. This is where your mistake is, coupled with the fact that I think you integrated $x\sin x$ incorrectly.

When you integrate it by parts you let $u=x$, and let $dv=\sin x~dx$, then $$ \begin{align*} \int x\sin x~dx&=-x\cos x-\int -\cos x~dx \\ &=-x\cos x+\sin x \end{align*} $$

Putting everything together we get $$ \begin{align*} \int (x^2+2x)\cos x~dx&=(x^2+2x)\sin x+2(x+1)\cos x-2\sin x \\ &=(x^2+2x-2)\sin x+2(x+1)\cos x \end{align*} $$ which is the correct answer.

Warren Moore
  • 3,931
1

Well, first of all, you've forgotten some rather crucial parentheses.

It's true that $$\begin{align}\int(x^2+2x)\cos x\,dx &= (x^2+2x)\sin x-2\int(x\sin x+\sin x)\,dx\\ &= (x^2+2x)\sin x-2\int x\sin x\,dx-2\int\sin x\,dx,\end{align}$$ and since $\int\sin x\,dx=-\cos x,$ then this can be rewritten as $$(x^2+2x)\sin x-2\int x\sin x\,dx-2(-\cos x)=(x^2+2x)\sin x+2\cos x-2\int x\sin x\,dx.$$

As for getting rid of your other integral, I'm not sure what "substitution" you performed, but it is in error. Use integration by parts once again to find $$\int x\sin x\,dx$$ and put that back into the above. (Don't forget to distribute the $-2$!)

Side Note: You're a bit sloppy with your use of the differential notation (the $d$s). See the first part of this answer for discussion of that, and (the rest for some further discussion of integration by parts). As a brief upshot, for example, when we put $u=x^2+2x,$ we can say immediately that $$\frac{du}{dx}=2x+2,$$ whence "multiplying by $dx$" gives us $$du=(2x+2)\,dx.$$ This is not the same as $2x+2dx$. Also, we'll never have non-paired differential terms like you had in $dv=\cos x$. It would be appropriate to say $$\frac{dv}{dx}=\cos x$$ or $$dv=\cos x\,dx,$$ though. Taking such care allows us to directly rewrite $$\begin{align}\int(x^2+2x)\cos x\,dx &= \int u\,dv\\ &\overset{*}{=} uv-\int v\,du\\ &= (x^2+2x)\sin x-\int(\sin x)(2x+2)\,dx\\ &= (x^2+2x)\sin x-2\int(x\sin x+\sin x)\,dx,\end{align}$$ where the $\overset{*}{=}$ is simply an application of integration by parts.

Cameron Buie
  • 102,994
1

By using integration by parts we get :

taking $x^2+2x $ as first function and cosx as second function we get :

I = $(x^2+2x).\int(cosx)dx -\int (d(x^2+2x).\int(cosx)dx$ = $(x^2+2x).sinx -\int[ (2x+2) sinx $

Again using integration by parts : first function 2x+2 and second as sinx. we get

= $(x^2+2x).sinx -[(2x+2) (-cosx) - \int 2. \int sinx dx$

= $(x^2+2x).sinx + (2x+2) (cosx) + \int 2. (-cosx) $

= $(x^2+2x).sinx + (2x+2) (cosx) - 2 \int (cosx) $

=$(x^2+2x).sinx + (2x+2) (cosx) - 2 sinx + C $

Sachin
  • 9,896
  • 16
  • 91
  • 182
0

As already mentioned, you're missing some parentheses and have jumbled up some minus signs.

Now let's totally disregard your real question and advocate a different way of integrating...

You are looking for $\int (x^2+2x)\sin(x)\,dx=y$. This is equivalent to solving $y'=(x^2+2x)\sin(x)$ which just happens to be a non-homogeneous linear differential equation with constant coefficients whose non-homogeneous part is the solution of a homogeneous linear DE with const. coeffs. All this means is that the method of undetermined coefficients applies. We are guaranteed that $y=(Ax^2+Bx+C)\sin(x)+(Dx^2+Ex+F)\cos(x)$ (plus a constant).

$y'=$ $$=(2Ax+B)\sin(x)+(Ax^2+Bx+C)\cos(x)+(2Dx+E)\cos(x)-(Dx^2+Ex+F)\sin(x)$$ $$=(-Dx^2+(2A-E)x+(B-F))\sin(x)+(Ax^2+(B+2D)x+(C+E))\cos(x)$$

But $y'=(1x^2+2x+0)\sin(x)+(0x^2+0x+0)\cos(x)$. So $-D=1$, $2A-E=2$, $B-F=0$, $A=0$, $B+2D=0$, and $C+E=0$.

Therefore, $D=-1$ and so $B=-2D=2$ and thus $F=B=2$. $A=0$ and so $E=2A-2=-2$ and thus $C=-E=2$.

$$y = (2x+2)\sin(x)+(-x^2-2x+2)\cos(x)+\mathrm{const.}$$

It's still a little work, but I'd rather differentiate and solve some easy linear equations rather than do integration by parts twice.

Anytime you are integrating something whose derivatives sort of "loop back on themselves" or "eventually disappear" this technique will work. [So it works for things like linear combinations of stuff like $x^\ell e^{kx} \cos \mathrm{\;or\;} \sin(ax)$]

Bill Cook
  • 29,244