Can you help me solve these integrals? I need to solve two integrals:
1.) 
$$ \int_0^\infty {xne^{n\theta-nx}}dx $$
2.) $$ \int_0^\infty {x^2ne^{n\theta-nx}}dx $$
n and $\theta$ are constants.
 A: Or guess that the (indefinite) integral will be $p(x)e^{n\theta-nx}$ for some polynomial $p$ with $\text{deg }p \leq 2$. Find the derivative of $p(x)e^{n\theta-nx}$, and determine the polynomials coeffiecients by comparing to your integrand.
A: HINT: Use partial integration ($\int_a^b uv' dx=[uv]_a^b-\int_a^bu'v dx$) and the fact that $x'=1$ (at least for problem 1)
A: 1)
using integration by parts.
$$\int_0^\infty {xne^{n\theta-nx}}dx=\left [ -xe^{n\theta-nx} \right ]_0^\infty + \int_0^\infty e^{n\theta-nx} dx$$
Here, $e^{-x}$ goes to zero quicker than $x$ to $\infty$. So you are just left with the integral, which is:
$$\left [ -\frac{e^{n\theta-nx}}{n} \right ]_0^\infty=\frac{e^{n\theta}}{n}$$
2)
left as an exercise ;) but it's exactly the same! Just do integration by parts twice.
A: It is useful to remember that
$$ \Gamma(n+1) = \int_{0}^{+\infty} x^n\,e^{-x}\,dx = n!, $$
so, through the substitution $x=y/n$, we get that the first integral is equal to $e^{n\theta}/n$ and the second integral is equal to $2e^{n\theta}/n^2$.
