Say we have an equation with the product of two subjects in the form f(x) = u(x)v(x).
Differentiating is simple, we would just multiply the differential* of u(x) by v(x) and add the differential of v(x) times by u(x). i.e f'(x) = u'(x)v(x)+v'(x)u(x).
Now, integrating is slight trickier. It can involve more than one step. We again have an equation of the product of two subjects. But this time, we write it as f(x) = u(x)v'(x). To find the integral we first need to differentiate u(x) and integrate v'(x). This will give us the following relevant terms (v'(x) is now not needed):
u(x)
u'(x)
v(x)
The integral is:
∫ f(x) dx = u(x)v(x) - ∫ v(x)u'(x) dx.
The last term which I have bolded and underlined is the term you need to reduce to a single subject of x e.g. x or x2 not xcos(x) to make it easily integratable. To do this, you need to choose which part is your u(x) and which your v'(x) These may take two of three times of repeating the same integration by parts but you should nomrally get there.
*Note: I am denoting differentials as f'(x), known as prime.