Integrating $\int x\sin x dx$ Could someone outline the step-by-step approach for the following indefinite integral?
$$\int x\sin x \ dx$$
I know the solution is $\sin(x)-x\cos(x)$, but cannot see how one would go about step-wise solving for it in a logical manner that does not include arbitrary guessing (even with intelligent guessing) of terms to use.
Thanks a bunch.

To find
(abusing notation viciously)
$F(x) = \int x f(x) dx$,
look at
$g(x) = x\int f(x) dx
$.
By the product rule,
$g'(x)
=xf(x)+\int f(x) dx$,
so
$xf(x) = g'(x)-\int f(x) dx$.
Integrating,
$\int xf(x) dx
=g(x)-\int \int f(x)dx
$.
If $f(x) = \sin(x)$,
then
$\int f(x) dx = -\cos(x)
$
and
$g(x) = -x\cos(x)
$
and
$\int \int f(x) dx = -\sin(x)
$
so
$\int x\sin(x) dx
=-x\cos(x)+\sin(x)
$.
This, of course,
is just integration by parts
in a weird setting.
