# Why is integration by parts derived as the following way?

## Deriving the integration by parts formula:

$$\frac{d}{dx}[f(x)g(x)] = f'(x)g(x)+f(x)g'(x)$$

$$f(x)g(x) =\int{f'(x)g(x)}\:dx + \int{f(x)g'(x)}\:dx$$

$$=>\int{f(x)g'(x)}\:dx =f(x)g(x) - \int{g(x)f'(x)}\:dx$$

$$OR$$ $$\frac{d}{dx}[uv] = vdu+udv$$

$$uv =\int{v}\:du + \int{u}\:dv$$

$$=>\int{u}\:dv = uv - \int{v}\:du$$

## My question:

In this step of deriving the integration by parts formula, $$uv =\int{v}\:du + \int{u}\:dv$$

$$=>\int{u}\:dv = uv - \int{v}\:du$$

Why is $$\int{v}\:du$$ subtracted from $$uv$$? In other words, I can subtract either integral from $$uv$$ in order to isolate either integral. So why can't I do the following? : $$uv =\int{v}\:du + \int{u}\:dv$$

$$=>\int{v}\:du = uv - \int{u}\:dv$$

When I then use this formula shown above, integrating something by parts will no longer work. See the example below:

$$\int{x}{sinx}\:dx$$

## Case 1

$$\int{x}{sinx}\:dx$$

Using:

$$\int{v}\:du = uv - \int{u}\:dv$$

$$u = x -> du = dx$$ $$dv = sinxdx -> v = -cosx$$

$$= -xcosx + \int{xsinx}\:dx$$

As you can see the integral on the right side is the same as the original, so it will keep repeating and never give the correct answer of -xcos(x) + sin(x) + C

## Case 2

$$\int{x}{sinx}\:dx$$

Using:

$$\int{v}\:du = uv - \int{u}\:dv$$ $$u = sinx -> du = cosxdx$$ $$dv = xdx -> v = 1/2(x^2)$$

Will lead no where close to the correct answer if computed ^

## So why doesn't arranging the form of the integration by parts formula make it no longer work?

If I used the original formula: uv - $$\int{v}\:du$$, then the integral in my example will lead to the correct answer. But if I use uv - $$\int{u}\:dv$$, then the formula no longer works, as shown above.

## Finally resolved:

$$\int{u}\:dv = uv - \int{v}\:du$$ $$<=>$$ $$\int{v}\:du = uv - \int{u}\:dv$$

but the final answer has to be adjusted slightly when using the altered formula in order to get the correct answer. The final answer has to be arranged because both formulas will always have the same $$u$$ and $$v$$ values such that one expression/integrand will represent the original integral given.

Normal formula: $$\int{u}\:dv = uv - \int{v}\:du$$

Original integral: $$\int{x}{sinx}\:dx$$

$$u = x -> du = dx$$ $$dv = sindx -> v = -cosx$$

$$\int{x}{sinx}\:dx= -xcosx + \int{cosx}\:dx$$

## $$= -xcosx + sinx + C$$

Altered formula: $$\int{v}\:du = uv - \int{u}\:dv$$

Original integral: $$\int{x}{sinx}\:dx$$

$$u = x -> du = dx$$ $$dv = sindx -> v = -cosx$$

$$\int{-cosx}\:dx = -xcosx - \int{xsinx}\:dx$$ $$\int{x}{sinx}\:dx= -xcosx + \int{cosx}\:dx$$

## $$= -xcosx + sinx + C$$

• It doesn't matter which you subtract: After all, just renaming $u \leftrightarrow v$ replaces one formula with the other. – Travis Willse Mar 17 '20 at 7:04
• I don't know if I did something wrong or confused by something, but in my example it does not work when you arrange the formula – user749176 Mar 17 '20 at 7:05
• My first assumption was that subtracting either integral from uv will still work, but I'm not sure if the example I put can still lead to the correct answer. – user749176 Mar 17 '20 at 7:06
• If you're convinced that it works one way, then just replace all of the $u$'s in your computations with $v$ and vice versa; that shows that it works the other way. – Travis Willse Mar 17 '20 at 7:06
• Do some examples that don't involve trig. functions first to see that it does work. Trig functions can be tricky as you sometimes need to invoke their periodicity to see that two expressions are equivalent. – postmortes Mar 17 '20 at 7:08

You're making a mistake in both of your other cases of determining the integral of different expressions. You have the original integral of

$$\int x\sin(x)dx = -x\cos x + \sin x + C \tag{1}\label{eq1A}$$

However, with $$u = x$$, you get $$du = dx$$. With $$v = \sin x$$, you have

\begin{aligned} \int vdu & = \int \sin(x)dx \\ & = x\sin x - \int x\cos x dx \\ & = -\cos x + C \end{aligned}\tag{2}\label{eq2A}

Also, with $$u = \sin(x)$$, you get $$du = \cos(x)dx$$. Along with $$v = x$$, you have

\begin{aligned} \int vdu & = \int x\cos(x)dx \\ & = x\sin x - \int \sin x dx \\ & = x\sin x + \cos x + C \end{aligned}\tag{3}\label{eq3A}

As you can see, the integrals used in both \eqref{eq2A} or \eqref{eq3A} don't match that in \eqref{eq1A}. Thus, there's no reason to expect the resulting expressions to match either, and they don't as you can see.

• ? The formula I'm testing is uv - integral of udv. In either case of my example of choosing different expressions for u, the answer will not be correct as shown in my example – user749176 Mar 17 '20 at 7:11
• there is no du in my formula, I used the terms u, v, dv – user749176 Mar 17 '20 at 7:15
• @Jtheconstant You don't show all of the details of your first example, but consider your second one. Your original integral is $\int x\sin x dx = -x\cos x + \sin x + C$. However, in the second case, like I showed in my ($3$), the LHS is $\int x \cos x dx$, you get that $\int x \cos x dx = x\sin x + \cos x + C$. This is different from your original integral result, but note you are determining a different integral. The result is correct for the second integral. As for your statement "there is no du in my formula", well your LHS is $\int vdu$, so you are using $du$. – John Omielan Mar 17 '20 at 7:20
• For u = x, v=sinx, dv= cosxdx, I differentiated v, didn't integrate it because the formula I used was uv - the integral of udv. So dv must contain the dx term, hence dv is the derivative of v not the integral of v. – user749176 Mar 17 '20 at 7:27
• @Jtheconstant With your "First case fixed:" section, you have the LHS being $\int vdu = \int (-\cos x)dx = -\sin x + C$. This means, with your RHS, you now have $-\sin x + C = -x\cos x - \int x\sin x dx \implies \int x\sin x dx = -x\cos x + \sin x + C$, as you stated was correct. Note you made a mistake with the sign as it should be $- \int x\sin x dx$ instead of $+ \int x\sin x dx$. – John Omielan Mar 17 '20 at 8:54

Let's play it through with your first "incorrect" example.

Actually it is correct, but it does not help you to solve the integral you would like to find.

• $$u=x, v = \sin x$$
• $$\Rightarrow \int u\;dv = \int x\;d(\sin x)= \int x\cos x\; dx = x\sin x + \cos x (+ c)$$

Hence, ignoring the constant of integration, you get

$$x\sin x = uv = \int u\;dv + \int v\; du = x\sin x + \cos x - \cos x = x\sin x$$ So, it is correct but does not solve your problem. Similarly, for your second "incorrect" case.

Getting back to the original integral:

$$\int \underbrace{x}_{u} \underbrace{\sin x\;dx}_{dv}$$

So, setting $$\boxed{u=x}$$ you have $$\boxed{dv=\sin x dx} \Rightarrow \boxed{v= -\cos x}$$. Hence, simply setting $$v=\sin x$$ instead and expecting to get a correct result for the integral does not work.

• For your answer: xsinx+cosx(+c), I think it is incorrect because it seems like the integration by parts formula you used is wrong. It seems like you used the product rule in the integration by parts formula. Shouldn't it be uv - the integral of vdu? – user749176 Mar 17 '20 at 7:44
• You can verify the correctness of an antiderivative by differentiation. You have $(x\sin x + \cos x)' = x\cos x$. – trancelocation Mar 17 '20 at 7:47
• @Jtheconstant : Have you checked the last part of my answer? There you can see that setting $v=\sin x$ while $u=x$ leads to something different than the integral you would like to calculate. – trancelocation Mar 17 '20 at 7:48

Sorry but your question is immaterial.

$$\int u\,dv=uv-\int v\,du$$

rather than

$$\int v\,du=uv-\int u\,dv.$$

Notice that these are completely equivalent by swapping the roles of $$u$$ and $$v$$.

$$u=x,\\dv=\sin x\,dx=-d\cos x$$ and

$$\int x\sin x\,dx=-x\cos x+\int\cos x\,dx=-x\cos x+\sin x+c.$$

Your confusion comes from the fact that there are two ways to apply the by-parts method, integrating one of the factors or the other. After integration, you differentiate the other factor. Depending on the cases, this can lead to a simplification or not.

For a product like $$x\sin x$$, it is possible to integrate both factors, but $$x\to\dfrac{x^2}2$$ brings no simplification, whereas integrating $$\sin x$$ will result in $$x\to1$$.

Integration by parts is not a symmetrical process. It is a matter of experience to choose the right factor.

A last word:

Sometimes its pays to consider a virtual factor $$1$$ and integrate on it,

$$\int f(x)\,dx=\int 1\cdot f(x)\,dx=x\,f(x)-\int x\,f'(x)\,dx.$$

• I know that both are equivalent, but when I do an example as shown in my question using this altered formula, the answer is wrong as shown – user749176 Mar 17 '20 at 8:51
• "altered" as in: uv - the integral of udv, instead of the original formula: uv - the integral of vdu. – user749176 Mar 17 '20 at 8:54
• And your solution to the integral is correct, but that is using the original formula. When I use the altered formula, it gives the wrong answer – user749176 Mar 17 '20 at 8:54
• @Jtheconstant: see my update. – Yves Daoust Mar 17 '20 at 9:00
• So if integration by parts is not a symmetrical process, the altered formula will give a different answer from the original formula? – user749176 Mar 17 '20 at 9:06