Moments of an exponential distribution Let $f_x(x)=\lambda e^{-\lambda x}$ , $x>0, \lambda >0$ , i need $\mathbb{E}[x^n]$.
I have the following:
\begin{align}
\mathbb{E}[x^n]
&=\int_{\mathbb{R}} x^n\cdot \lambda e^{-\lambda x} dx\\ &=\int_{0}^{\infty} x^n\cdot \lambda e^{-\lambda x}dx\\
&=x^n\cdot  (-e^{-\lambda x})\Big|_0^{\infty}+\int_0^{\infty} nx^{n-1}\cdot e^{-\lambda x} dx \\
&=[0-0]+\int_0^{\infty} nx^{n-1}\cdot e^{-\lambda x} dx\\
&= \frac{n}{\lambda}\int_0^{\infty}x^{n-1}\cdot\lambda e^{-\lambda x}dx\\
&=\frac{n}{\lambda}\cdot\mathbb{E}[x^{n-1}]
\end{align}
Following the result it seems clear that:
$\displaystyle \mathbb{E}[x^{n-1}]=\frac{n-1}{\lambda}\cdot\mathbb{E}[x^{n-2}]$,
and it seems to have the tendency of:
$\displaystyle \mathbb{E}[x^n]=\frac{n}{\lambda}\cdot \frac{n-1}{\lambda}\cdots=\frac{n!}{\lambda^n}$
Is there a way to test this by induction?
 A: There's more than one way to compute the moments of an exponential distribution, and a cute way is via differentiation under the integral sign. We start from the normalization condition: $$\mathbb{E}[1]=\int f_X(x)\,dx = \int_0^\infty \lambda e^{-\lambda x}\,dx=1$$
This rearranges to $\lambda^{-1}=\int_0^\infty e^{-\lambda x}\,dx$. If we differentiate both sides with respect to $\lambda$ (and take for granted we can do so!) we obtain
$$-\lambda^{-2}=-\int_0^\infty x e^{-\lambda x}\,dx\implies \mathbb{E}[X]=\int_0^\infty x\lambda e^{-\lambda x}\,dx=\frac{1}{\lambda}$$
If we instead differentiated twice before rearranging, we obtain
$$2\lambda^{-3}=\int_0^\infty x^2 e^{-\lambda x}\,dx\implies \mathbb{E}[X^2]=\int_0^\infty x^2 \lambda e^{-\lambda x}\,dx = \frac{2}{\lambda^2}$$
More generally, suppose we differentiate our integral representation of $\lambda^{-1}$ a total of $n$ times. Then we obtain
$$n!(-1)^n \lambda^{-n-1} = \int_0^\infty (-x)^n e^{-\lambda x}\,dx\implies \mathbb{E}[X^n]=\int_0^\infty x^n \lambda e^{-\lambda x}\,dx=\frac{n!}{\lambda^n}$$
which was the desired result. It should be noted, though, that there remains an implicit 'proof by induction' in the above; otherwise, the claim that the $n$th derivative indeed gives the result stated has no force. So one as usual needs to check the base case (here $n=0$) and the inductive step (show that validity for $n=k$ also implies validity for $n=k+1$).
