# How exactly does integration by parts work?

Integration by parts can be considered as the inverse method of differentiation using the product rule. With the product rule we have: d(fg)/dx = f(dg/dx) + g*(df/dx) where f and g are functions of x. Now lets say we want to integrate a function of the form f*(dg/dx) where f and dg/dx are functions of x. (e.g. xsin(x) -> f=x , dg/dx = sin(x)). We can rearrange the product rule equation above so that we obtain f(dg/dx) = d(fg)/dx - g(df/dx). If we integrate both sides with respect to x we obtain: integral [d(fg)/dx] = fg as the integral of the differential of a function is the function itself. integral[g*(df/dx)] where g is the integral of the function dg/dx and df/dx is the differential of the function f. Thus, integral[f*(dg/dx)] = fg - integral[g(df/dx)] For full understanding, differentiate x*(-cos(x)) using the product rule. Now using the expression you obtain find an expression for the integral of x*sin(x). Referring to the equation for integration by parts, consider where each term in your expression comes from.  