# Integration by parts twice problem

So I have tried to do integration by parts on this problem: $h(x)=4*sin(x)-2$ and need to use the formula $$\int\ f(x)g(x)=f(x)G(x)- \int\ f'(x)G(x)dx$$

I got the result $-2*2sin(x)+cos(x)+c$ but when I take the derivative of this, it becomes $-sin(x)-4cos(x)$, which is not the original function $h(x)=4*sin(x)-2$.

Can someone see the problem in my steps below?

First of all, I assign $f(x)$, $g(x)$, $f'(x)$ and $G(x)$ with the following values/functions:

$f(x)=sin(x)-2$

$f'(x)=cos(x)$

$g(x)=4$

$G(x)=4x$

I now insert those into the formula mentioned above:

$$\int\ sin(x)-2*4=sin(x)-2*4x- \int\ cos(x)*4xdx$$

$cos(x)*4x$ becomes another integration by parts problem and I therefore have to assign some new values/functions for that:

$f(x)=x$

$f'(x)=1$

$g(x)=cos(x)$

$G(x)=sin(x)$

I now again use the formula for integration by parts mentioned above but within parentheses, while I keep the rest of the equation/calculation outside not touching it (I also put the 4 from $4x$ outside of this new integral to simplify):

$=sin(x)-2*4x-4*(x*sin(x)- \int\ 1*sin(x))$

$=sin(x)-2*4x-4*(x*sin(x)-1 \int\ sin(x))$

$=sin(x)-2*4x-4*(x*sin(x)+cos(x))$

$=sin(x)-2*4x-4x*sin(x)+cos(x)$

$-2*2sin(x)+cos(x)+c$

• You don't need to use parts at all. – Sean Roberson Feb 18 '18 at 15:43
• Be careful... is it $h(x)=4\sin(x)-2$ or $h(x)=4(\sin(x)-2)$? Anyway, using integration by parts here is like using grenades for killing flies. – the_candyman Feb 18 '18 at 15:44
• @SeanRoberson What?! How is that possible? – user164324 Feb 18 '18 at 15:44
• In fact, using parts is a remarkably unnatural way to proceed (as you need to use the integral of $\sin$/$\cos$ along the way anyway). – lulu Feb 18 '18 at 15:45
• Well, if IBP is the wrong way to go can someone explain me another method? I don't remember having learnt about other methods for this kind of problem.. – user164324 Feb 18 '18 at 15:48

$$\int (4\sin(x) - 2)\ dx = 4\int \sin(x)\ dx - 2\int \ dx$$
• How can it be the final answer when there is $dx$ twice? – user164324 Feb 18 '18 at 16:07
• It's not the final answer, do the maths: $$4\int \sin(x) \ dx = -4\cos(x) + C$$ $$-2\int \ dx = -2x + D$$ Being $C$ and $D$ two constants you can name them globally as $C$ or set them to be zero. Final result: $$-4\cos(x) -2x + \text{constant}$$ – Von Neumann Feb 18 '18 at 16:08
• Ok I get it now. However, the integral $\ dx \$ is just like taking the integral of 1, right? – user164324 Feb 18 '18 at 16:22
• Yes, $$\int \ dx \equiv \int 1 \ dx$$ – Von Neumann Feb 18 '18 at 16:23