We are asked to perform `int xsinxdx` using integration by parts.
The concept of integration by parts comes from taking the derivative of a product. Recall that the derivative of a product is not the product of the derivatives. Instead, given differentiable functions f and g, `d/(dx)(fg)=f'g+fg'`
Suppose we were to integrate both sides:
`int d/(dx)(fg)dx=int gf'+int fg'`
The left hand side is fg by the definition of an antiderivative. Then subtracting we get
`int fg'=fg-int gf'`
Let f=x, df=dx and g=-cosx
`int (xsinx)dx=x(-cosx)-int (-cosx)dx`
`=-xcosx + sinx +C` where C is the constant of integration.
The difficult part is deciding on, or finding, the appropriate functions f and g. Note that letting f=sinx, df=cosx dx, g=x, dg=dx will not work, as the resulting integral is as hard or harder than the original. One basic tip is to choose f such that f' is simpler than f.
Another hint, though not always applicable, is to choose f such that it comes before g in this list of functions: logarithmic, inverse trigonometric, algebraic, trigonometric, exponential. In this problem, we choose f to be algebraic and g to be trigonometric.
Integrating by parts will not always work, and occasionally you might have to do multiple applications of integration by parts to get to an integral you can do.