Computing the integral $\int(x-ab)x^{a-1}e^{-\frac{x}{b}}dx$ Can someone justify to me why 
$\int(x-ab)x^{a-1}e^{-\frac{x}{b}}dx = -bx^ae^{-\frac{x}{b}}$?
WolframAlpha gives the answer but does not explain why. I'm absolutely new to this kind of integration. Thanks!
 A: Hint: using the product rule, differentiate $-bx^{a}e^{\frac{-x}{b}}$. What do you get? In other words, take a look at your integrand. Expanding out, we find: 
$$(x-ab)x^{a-1}e^{-\frac{x}{b}} = x^{a}e^{\frac{-x}{b}} - abx^{a-1}e^{-\frac{x}{b}}$$
We can then rewrite this as:
$$(x-ab)x^{a-1}e^{-\frac{x}{b}} = x^{a}\cdot(-b)\cdot\frac{d}{dx}[e^{\frac{-x}{b}}] + e^{\frac{-x}{b}}\cdot\frac{d}{dx}[-bx^{a}] = \frac{d}{x}[-bx^{a}e^{\frac{-x}{b}}]$$
(Hopefully, this does not seem like a glib answer... I am trying to hint you towards recognizing that your integrand looks a lot like the derivative of some function $f(x)$, and computing the integral of $f'(x)$ is always nice! :) )
A: The right hand side is the antiderivative of the integrand. By the way since you have an indefinite integral there should be a constant of integration on the RHS.
We can expand:
\begin{align}
\int (x-ab)x^{a-1}e^{-\frac{x}{b}}\ \mathrm{d}x&=\int x^ae^{-\frac{x}{b}}\ \mathrm{d}x+\int ax^{a-1}(-be^{-\frac{x}{b}})\ \mathrm{d}x\\
&\equiv\mathcal{I}+\mathcal{II}
\end{align}
and use integration by parts for $\mathcal{II}$ 
\begin{equation}
\mathcal{II}=-bx^ae^{-\frac{x}{b}}-\int x^ae^{-\frac{x}{b}}\ \mathrm{d}x+c
\end{equation}where  c is the constant of integration. Then we have
\begin{equation}
\mathcal{I}+\mathcal{II}=-bx^ae^{-\frac{x}{b}}+c
\end{equation}which is what your right hand side is.
Of course, if you can identify the antiderivative which is what the answer before mine is trying to get at then you get your result straightaway.
A: $$\int(x-ab)x^(a-1)e^{- \frac {x}{b}}=\int x^ae^{-\frac{x}{b}}dx-ab\int x^(a-1)e^{- \frac {x}{b}} $$
On the RHS intgrate the first integrand by parts with $e^{- \frac{x}{b}}$ as first function and $x^a$ as second function to get
$$-x^abe^{-\frac {x}{b}}+ab\int x^(a-1)e^{- \frac {x}{b}}$$
Substituting the value of the above integrand in the first equation we can eliminate the second integrand to get the required answer.
