Finding the $ \int_0^\infty x^n \theta e^{-x\theta}dx$ Question ask to find the n-th moment of $ \theta e^{-x\theta} $ for x>0, and 0 elsewhere.
Which would be written as:  $ \int_0^\infty x^n \theta e^{-x\theta}dx$
Solving this problem, I attempted integrating by parts:
$-x^n  e^{-x\theta}+n\int_0^\infty x^{n-1} e^{-x\theta}dx$
Applying another integration by parts:
$-x^n  e^{-x\theta}-{n \over \theta} x^{n-1}  e^{-x\theta}+n(n-1)\int_0^\infty x^{n-2} e^{-x\theta}dx$
Seeing a pattern, I have:
$-e^{-x\theta}[x^n + {n\over\theta} x^{n-1}+...+{n!\over\theta^n}]_0^\infty$
I feel that I am either very close or completely wrong.
The inner bracket seems very familiar as well.
Any help is highly appreciated.
 A: As mentioned in the comments the expression you found simplifies to $\frac{n!}{\theta^n}$.
One can also proceed in such fashion,
Noticing that:
$$f(\theta)=\int_{0}^{\infty} e^{-\theta x}dx =\frac{1}{\theta}$$
So that,
$$f'(\theta)=\int_{0}^{\infty} -xe^{-\theta x} dx=\frac{-1}{\theta^2}$$
$$f''(\theta)=\int_{0}^{\infty} x^2e^{-\theta x}  dx=\frac{1(2)}{\theta^3}$$
Continuing in this fashion we see,
$$\int_{0}^{\infty} x^n e^{-\theta x} dx=\frac{n!}{\theta^{n+1}}$$
From which the result follows by multiplying both sides by $\theta$.
A: You can use the Gamma function
$$
\Gamma(z) = \int_0^{+\infty}{\rm d}x~ x^{z-1}e^{-x}
$$
So that
\begin{eqnarray}
I_n(\theta) &=& \int_0^{+\infty}{\rm d}x~\theta x^ne^{-\theta x} \stackrel{u=\theta x}{=} \frac{1}{\theta^n}\int_0^{+\infty}{\rm d}u ~x^u e^{-u} \\
&=& \frac{1}{\theta^n}\Gamma(n+1) = \frac{n!}{\theta^n}
\end{eqnarray}
A: In this case, the moment-generating function is a simple way to find all the moments:
$$ E[e^{tX}] = \int_0^{\infty} e^{tx} \theta e^{-\theta x} \, dx = \frac{\theta}{\theta-t}. $$
We can now find the $n$th moment from the coefficient of $t^n$:
$$ \frac{\theta}{\theta-t} = \frac{1}{1-t/\theta} = \sum_{n=0}^{\infty} \frac{1}{\theta^n}t^n. $$
The moment-generating function is an exponential generating function for the moments, so
$$ E[X^n] = \frac{n!}{\theta^n}. $$
