# Find the pdf , distribution function of $X$ and $E[(X-2)^2]$

I 'll be very grateful if you can help me , here is the question :

When a person sends an email, the probability that there is an attachment is 0.5. If there is an attachment then the size of the file is exponentially distributed with mean 5 kbytes. Let $$X$$ denote the size of the attachment received . Find the probability density function, distribution function of $$X$$ and $$E[(X-2)^2]$$.

Can you solve this question , i 'll try to understand it by your answers. There are some parts that i don't understand, and i think i can understand them by looking at the answers. Thank you so much.

Denote $$Z$$ a Bernoulli random variable with $$p = \frac12$$ and $$Y$$ an exponential random variable with parameter $$\lambda = \frac15$$ which represent the size of an attachment if there is one. The two variables are supposed to be independent, then the size of the attachment received is given by $$X = ZY$$.

Therefore, we have \begin{align*} t\geq 0, \mathbb{P}(X \leq t) &= \mathbb{P}(ZY \leq t) \\ &= \mathbb{P}(ZY \leq t, Z=0) + \mathbb{P}(ZY \leq t, Z=1)\\ &= \frac{1}{2}(1 + \mathbb{P}(Y \leq t))\\ &= \frac{1}{2}(1 + 1 - \exp(-t/5))\\ &= 1 - \frac12\exp(-t/5))\\ \end{align*} In the second equality we used the independance. So the density function is $$f(x) = \frac{1}{10}\exp(-x/5)1_{x\geq0}$$

• Thank you so much, did you mapped that there is an attachment to $Z=1$ and not attachment to $Z=0$ so $(Z=0) . (Y) = 0$ since $t$ is always bigger than $0$ it is $1$ . Am i right on these . and i am confused about $X = ZY$ . When we cross the random variables do we get the probability of their product ? Thank you really much . – Ahmet Yusuf Yahşi Apr 16 at 22:55

Let $$A$$ be the event that there is an attachment to the email message. Then, $$X$$ is equal to $$Z$$ with probability $$0.5$$ and is zero with probability $$0.5$$. In other words, $$X$$ is a mixture of a point mass at zero and a continuous $$Z$$ with an exponential-like density. Distribution function of $$X = 1_{A}Z$$ is:

$$P(X \le x) = P( Z\le x|A)P(A)+ P( X\le x|A^c)P(A^c)= \\ 0.5(1-e^{-\lambda x}) + 0.5 = 1-0.5e^{-\lambda x}, \text{ where } \lambda=1/5.$$

Then, $$EX = \int_0^\infty P(X>x)dx= \int_0^\infty 0.5e^{-\lambda x}dx = 0.5/\lambda=2.5$$. Note that $$X=0$$ with probability $$0.5$$ so that value doesn't contribute to the mean. Note that the continuous part of X has density $$0.5 \lambda e^{-\lambda x}$$, and hence $$VX=0.5/\lambda^2=12.5$$.

Furthermore, $$E(X-2) = EX-2=0.5$$ and $$E(X-2)^2 = EX^2-4EX+4= VX + (EX)^2 - 4EX+4 = 12.75.$$

• I think i got it now. Thank you so much :D – Ahmet Yusuf Yahşi Apr 16 at 23:16
• Oh i 've just realised . I wasn't know that, thank you i 've did it now :D – Ahmet Yusuf Yahşi Apr 16 at 23:21