Finding the density function $f_X$ from the distribution function Can someone help me find the density function $f_X$ for $X$ and hence find $E(X)$ and $Var(X)$ of the following distribution function $F_X$ given by:
$F_X(x)=\begin{cases} 
1-(1+x)e^{-x} & x>0 \\ 
0 & otherwise. 
\end{cases}$
$X$ is a continuous random variable.
From memory, do I have to integrate $1-(1+x)e^{-x}$ or something similar? I can't recall on what to do, I get mixed up with the range in which I must integrate these sort of things (I am not even sure if I must integrate it but I know that when going from the probability density function to the distribution function, I must integrate it).
 A: Differentiate the cumulative distribution function $F_X(x)$ to find $f_X(x)$.  
You will get $xe^{-x}$ (for $x\gt 0)$.
For $E(X)$, you need $\int_0^\infty x^2e^{-x}\,dx$. This is usually done using a couple of integrations by parts, but you know an antiderivative of $xe^{-x}$.
For the variance, using $E(X^2)-(E(X))^2$, you will need $\int_0^\infty x^3e^{-x}\,dx$. In principle this requires three integrations by parts, but in reality because of your work on \int_0^\infty x^2e^{-x}\,dx$, you will only need one. 
A: The variable $X$ follows a Gamma distribution $\Gamma(\alpha,\beta)$ with $\alpha=2,\beta=1$, i.e. $X\sim\Gamma(2,1)$.
So the mean and the variance are 
$$
\Bbb{E}(X)=\frac{\alpha}{\beta}=2\qquad \operatorname{Var}(X)=\frac{\alpha}{\beta^2}=2.
$$
If $X$ ha support $[0,\infty)$, X is memoryless with respect to $t$ if for any non-negative real numbers $t\ne 0 $ and $s$, we have
$$\Bbb{P}(X>t+s \mid X>t)=\Bbb{P}(X>s).$$
Call $G(t)=\Bbb{P}(X>s)=1-F(x)$ the survival function of $X$ (note that $G(t)$ is then monotonically decreasing). Then $X$ is memoryless if
$$
G(t+s)=G(t)G(s).
$$
In your case $X$ hasn't this property because
$$
(1+t+s)\ne (1+t)(1+s).
$$
