[Math] Density function with absolute value

probability

Let $X$ be a random variable distributed with the following density function:

$$f(x)=\frac{1}{2} \exp(-|x-\theta|) \>.$$

Calculate: $$F(t)=\mathbb P[X\leq t], \mathbb E[X] , \mathrm{Var}[X]$$

I have problems calculating $F(t)$ because of the absolute value. I'm doing it by case statements but it just doesn't get me to the right answer.
So it gets to this:
$$
\int_{-\infty}^\infty\frac{1}{2} \exp(-|x-\theta|)\,\mathrm dx $$

Best Answer

The first approach we take, though correct, is not the best one, and we later describe a better approach.

Suppose first that $x \ge \theta$. By symmetry, the probability that $X\le \theta$ is $\frac{1}{2}$. So if $x\ge \theta$, then $$P(X\le x)= \frac{1}{2}+\int_{\theta}^x \frac{1}{2}e^{-(t-\theta)}\,dt.$$ The integration can be done by pulling out the $e^\theta$, but I prefer to make the substitution $u=t-\theta$. The integral becomes $$\int_{u=0}^{x+\theta} \frac{1}{2}e^{-u}du,$$ which evaluates to $$\frac{1}{2}(1-e^{-(x-\theta}).$$ Adding the $\frac{1}{2}$ for the probability that $X\le \theta$, we find that for $x\ge\theta$, $F_X(x)=1-\frac{1}{2}e^{-(x-\theta)}.$

For $x<\theta$, we need to find $$\int_{-\infty}^x \frac{1}{2}e^{t-\theta}dt.$$ The integration is straightforward. We get that $F_X(x)=\frac{1}{2}e^{x-\theta}$ whenever $x <\theta$. We could go on the find the mean and variance by similar calculations, but will now change approach.

Another approach: The $\theta$ is a nuisance. Let's get rid of it. So let $Y=X-\theta$. Then $P(Y\le y)=P(X\le y-\theta)$. This is $$\int_{-\infty}^{y-\theta} \frac{1}{2}e^{-|t-\theta|}dt.$$ Make the change of variable $w=t-\theta$. We find that our integral is $$\int_{w=-\infty}^y \frac{1}{2}e^{-|w|}dw.$$ What this shows is the intuitively obvious fact that $Y$ has a distribution of the same family as the one for $X$, except that now the parameter is $0$. We could now repeat our integration work, with less risk of error. But that would be a waste of space, so instead we go on to find the expectation of $X$.

Since $X=Y+\theta$, we have $E(X)=E(Y)+\theta$. On the assumption that this expectation exists, by symmetry $E(Y)=0$, and therefore $E(X)=\theta$.

Next we deal with $\text{Var}(X)$. Since $X=Y+\theta$, the variance of $X$ is the same as the variance of $Y$. So we need to find $$\int_{-\infty}^\infty \frac{1}{2}w^2e^{-|w|}dw.$$ By symmetry, this is twice the integral from $0$ to $\infty$, so we want $$\int_0^\infty w^2e^{-w}dw.$$ Integration by parts (twice) handles this problem. To start, let $u=w^2$, and let $dv=e^{-w}dw$. After a little while, you should find that the variance of $Y$, and hence of $X$, is $2$.

Remark: You can also find the mean and variance of $X$ by working directly with the original density function of $X$, and making an immediate substitution for $x-\theta$. But defining the new random variable $Y$ is in my view a more "probabilistic" approach.

Your distribution is a special case of the Laplace distribution, which in addition to a location parameter $\theta$, has a scale parameter $b$. The probability density function is $$\frac{1}{2b}e^{-\frac{|x-\theta|}{b}}.$$