# Density function and expectation of a random variable

Random variable $X$ has exponential distribution $\mathcal E(\lambda)$ with probability $0.3$, and distribution given by density function $f_2(x)=\frac{1}{2}e^{-|x+1|},\forall x\in\mathbb R$ with probability $0.7$. Find density (density function) and expectation of a random variable $X$.

First, I don't understand why are we given probabilities $0.3$ and $0.7$?

Density function of an exponential distribution is given by $f(x)=\lambda e^{-\lambda x},x\ge 0,\lambda>0$. This is the density function for the first case. Expectation of $X$ for the first case is $$E(X)=\int_0^{+\infty}x\lambda e^{-\lambda x}dx=-\frac{1}{\lambda}$$

In the second case, we are already given the density function $f_2(x)$. $$|x+1| = \begin{cases} x+1, & x+1\ge 0, & x\ge -1\\ -(x+1), & x+1< 0, & x<-1 \end{cases}$$ $$f_2(x) = \begin{cases} \frac{1}{2}e^{x+1}, & x<-1 \\ \frac{1}{2}e^{-(x+1)}, & x\ge -1 \end{cases}$$

Now, I am not sure how to set limits of integration for evalution of expectation. $$E(X)=\int_{-\infty}^{-1}\frac{1}{2}xe^{x+1}dx+\int_{-1}^{+\infty}\frac{1}{2}xe^{-(x+1)}dx=-1+0=-1$$

Is this correct?

• This is a mixed random variable...
– PiE
May 12 '17 at 23:12
• @PMF, Could you elaborate on that? May 12 '17 at 23:13
• It looks like you have the right work for the expectation in the $f_2$ case. Now you just add $0.3 \lambda + 0.7(-1)$. May 12 '17 at 23:16
• I mean a "mixture" distribution...
– PiE
May 12 '17 at 23:24
• @PMF, Do you mean that my solution is not correct? May 12 '17 at 23:25

This is a mixture distribution (If I'm understanding your question correctly).

$$f_1(x) = \lambda e^{-\lambda x}$$

and

$$f_2(x) = \frac{e^{-\left| x+1\right| }}{2}$$.

Then, the density function is

$$g(x) = 0.3 f_1(x) + 0.7 f_2(x) = 0.3 \lambda e^{-\lambda x} + 0.7\frac{e^{-\left| x+1\right| }}{2}$$.

To calculate $E(X)$, we follow first principles noting the respective domains of support, so we get:

$$E(X) = 0.3 \int_0^{\infty}x\lambda e^{-\lambda x} + 0.7 \int_{-\infty}^{\infty} x \frac{e^{-\left| x+1\right| }}{2}=\frac{0.3}{\lambda }-0.7$$

• Thanks, everything is clear. May 13 '17 at 0:15
• In the last integral, you have forgotten to multiply the function with $x$. May 13 '17 at 0:22
• Thanks for catching the typo.
– PiE
May 13 '17 at 0:25