# Integration by Parts and the Constant of Integration [duplicate]

The constant of integration only seems to be used at the very end of integration by parts despite the use of integrals beforehand.

An example of this would be: $$\int x\sin(x)\ dx = x\int sin(x)\ dx - \int x'(\int sin(x)\ dx)\ dx$$ Ordinarily, the right side of the equation would be simplified to: $$x(-cos(x)) - \int-cos(x)\ dx$$ And further to: $$-x(cos(x)) + sin(x)$$ Then finally arranged and given the constant of integration: $$sin(x) - xcos(x)+ C$$

What I am confused about is why $C$ is only added at the very end of this instead of at each integral.

I would be more inclined to use try something more like this: $$x(-cos(x) +C_1) - \int -cos (x) + C_2\ dx$$ Which would simplify to: $$-x(cos(x) -C_1) - \int-cos(x)\ dx + \int C_2\ dx$$ And further to: $$-xcos(x) +C_1x +sin(x)+ C_3 + C_2x + C_4$$ Which finally arranges itself as: $$sin(x) - xcos(x) + C_5x + C_6$$ Where $C_5=C_1 + C_2$ and $C_6=C_3 + C_4$

I also feel I should probably mention I am a bit of an oblivious idiot so if the answer is completely obvious or my math is full of errors, I apologize.

## marked as duplicate by Zain Patel, Hans Engler, Claude Leibovici calculus StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 17 '16 at 4:10

• If you use $-\cos x+C_1$ in the first term, then you must use $\int (-\cos x+C_1)\,dx$ in the second integral. After you integrate, you will notice that the $C_1$'s cancel. The integration by parts formula, in brief, says $\int u\,dv=uv-\int v\,du$. If you use $-\cos x+C_1$ for $v$, when applying the formula you need to use that $v$ wherever $v$ occurs. – André Nicolas Jul 16 '16 at 23:58
• @AndréNicolas I see now, I got it mixed up in my head that for each use of $v$ there was its own individual $C$. – N.D.H. Jul 17 '16 at 0:18
• Another way of looking at it: it is a theorem that if you know a specific antiderivative of some function, then every antiderivative of that function differs from your specific one by an additive constant $C$. (This followed from the fact that only constant functions have zero derivative everywhere, which is itself a consequence of the mean value theorem, say.) So you can ignore the "constant of integration" throughout the entire procedure (setting it to $0$ each time, for instance), end up with a specific antiderivative, and then apply the theorem to add $+C$ to the end. – Greg Martin Jul 17 '16 at 1:20
• the integration by parts really says that $(uv)' = u'v+ v'u$, integrating both side on $[a,b]$ : $\int_a^b (u(x)v(x))' dx = u(b)v(b)-u(a)v(a)= \int_a^b u'(x) v(x) dx + \int_a^b u(x) v'(x) dx$ or $$\int_a^b u(x) v'(x) dx = u(b)v(b)-u(a)v(a) -\int_a^b u'(x) v(x) dx$$ with more constant added, you can rewrite it $((u+C)(v+D))' = u'(v+D)+ v'(u+C)$ that leads to $$\int_a^b (u(x)+C) v'(x) dx = (u(b)+C)(v(b)+D)-(u(a)+C)(v(a)+D) -\int_a^b u'(x) (v(x)+D) dx$$ – reuns Jul 17 '16 at 2:29

Great questions. Indeed you are right that constents need to be added along the way but as you'll see, the algebra works out that only one remains in the end.

$\int f(x)g'(x) dx$ = f(x) (g(x)+c) - $\int f'(x) (g(x)+c ) dx$

thus

$\int f(x)g'(x) dx$ = f(x)g(x) + cf(x) - ($\int f'(x)g(x)dx$ + $\int cf'(x) dx$)

since our c is a constant we have that

$\int f(x)g'(x) dx$ = f(x)g(x) + cf(x) - $\int f'(x)g(x)dx$ - cf(x)

and finally we have our desired result that:

$\int f(x)g'(x) dx$ = f(x)g(x) - $\int f'(x)g(x)dx$

note that your C1 and C2 are in fact the same as they are the constants that appear when taking the anti derivative of g'(x).

($int\ g'(x) dx$ = g(x) + C)

with respect to your C3 and C4, we can simply refer to the sum of the two as "c" which we add in the end of the integration.