# Finding PDF involving absolute value

I'm trying to solve the following question: Given an exponential R.V. X with rate parameter $\lambda > 0$, find the PDF of $V=|X-\lambda|$.

In order to find the PDF, I would like to use the CDF method (i.e. finding the CDF and then taking the derivative to obtain the PDF). I realize this function is not one to one on the range between 0 and $2\lambda$, so the CDF should be broken into three parts: $0>w$, $0<w<2\lambda$ and $2\lambda<w$. For $0<w<2\lambda$, $Pr(|X-\lambda| < w)$ = $Pr(-w+\lambda < x < w+\lambda)$, and then I think I want to do the double integral of $\int_0^\infty\int_{-w+\lambda}^{w+\lambda}\lambda e^{-\lambda x}dx$, with the function being integrated there being the exponential distribution pdf. After getting this, I should be able to take the derivative and get the PDF for $0<w<2\lambda$, right? (For the record, I get $\lambda e^{-\lambda ^2 - \lambda w} - \lambda e^{-\lambda ^2+\lambda w}$ when i try this; its possible i'm wrong though!)

For the last part, I believe the bounds are $2\lambda <w<\infty$, so i want to do this integral: $\int_0^\infty\int_{2\lambda}^{\infty}\lambda e^{-\lambda x}dx$, but i'm not really sure about this at all.

I understand there are probably more efficient ways of solving this, but I'm specifically trying to do it using the CDF method!

-

You have done most of the analysis, so I will be to a great extent repeating what you know. We want to find an expression for $\Pr(V\le w)$.

In general, $V\le w$ iff $|X-\lambda| \le w$ iff $X-\lambda\le w$ and $X-\lambda\ge -w$, that is, iff $$\lambda-w \le X\le \lambda+w.$$

There are three cases to consider, (i) $w\le 0$; (ii) $0\lt w\le \lambda$; and (ii) $w \gt \lambda$.

Case (i): This is trivial: if $w\le 0$ then $\Pr(V\le w)=0$.

Case (ii): We want $\Pr(X\le \lambda+w)-\Pr(X\lt \lambda -w)$. This is $$(1-e^{-\lambda(\lambda+w)})-(1-e^{-\lambda(\lambda-w)}).$$ There is some immediate simplification, to $e^{-\lambda(\lambda-w)}-e^{-\lambda(\lambda+w)}$, and there are various alternate ways to rewrite things, by introducing the hyperbolic sine.

Case (iii): This one is easier. We simply want $\Pr(X\le \lambda+w)$. For $w\ge -lambda$, this is $$1-e^{-\lambda(\lambda+w)}.$$

We could have set up the calculations using integrals, but since we already know that $F_X(x)=1-e^{-\lambda x}$ (when $x\gt 0$) there is no need to do that.

Now that we have the cdf of $V$, it is straightforward to find the density. For $w\le 0$, we have $f_V(w)=0$. For $0\lt w\lt \lambda$, we have $f_V(w)=\lambda e^{-\lambda(\lambda-w)}+\lambda e^{-\lambda(\lambda+w)}$. Finally, for $w\gt \lambda$ we have $f_V(w)=\lambda e^{-\lambda(\lambda+w)}$.

Remark: Suppose that we did not have a nice expression for the cdf of $X$. That happens, for example, with the normal, and a number of other distributions. We could still find the density function by setting up our probabilities as integrals, and differentiating under the integral sign.

-
Thank you so much! I really appreciate the help - you made everything much clearer! – JenK Nov 29 '12 at 5:51

You are on the right track, but there are a few things that need corrected. First, you do not need to be taking double integrals here. Lets look at each interval one at a time. Let $W=|X-\lambda|$. To find the CDF of $W$ we divide the positive real line into three segments. To find the right intervals, it helps to draw a graph of the function $f(X)=|X-\lambda|$.

1) Since $|X-\lambda|\geq0$ it is clear that $P(|X-\lambda|\leq w)=0$ for $w<0$.

2) For $0\leq w< \lambda$, $P(|X-\lambda|\leq w)=P(-w+\lambda\leq X\leq w+\lambda)$ as you correctly stated. But this probability is given by the integral

$$\int_{-w+\lambda}^{w+\lambda}\lambda e^{-\lambda x}dx=e^{\lambda w-\lambda^2}-e^{-\lambda w - w\lambda^2}$$

3) If $\lambda\leq w$, then $-w+\lambda\leq 0$ and $P(-w+\lambda\leq X\leq w+\lambda)=P(0\leq X\leq w+\lambda)$ since $X\geq 0$. This probability is given by the integral

$$\int_{0}^{w+\lambda}\lambda e^{-\lambda x}dx=1-e^{-\lambda w - \lambda^2}$$

Edit: Now we can correctly combine cases 1-3 to get the CDF, which we can differentiate to get the PDF.

$$F_{W}(w)= \begin{cases} 0 &\mbox{if } w<0 \\e^{\lambda w-\lambda^2}-e^{-\lambda w - w\lambda^2} &\mbox{if } 0\leq w < \lambda \\1-e^{-\lambda w - \lambda^2} &\mbox{if } \lambda\leq w \end{cases}$$

-
I think I lost you at the end, where you get your result for $\lambda < w$... should it not be the result you got in step 3.)? The way it is currently set up, if we consider $\lambda = 1$ and $w = \infty$, we get $2-e^2-0$, which is not one! – JenK Nov 29 '12 at 5:50
Oops! Fixed. Thinking about an issue that doesn't apply here. Thanks @JenK. – caburke Nov 29 '12 at 15:36