# Probability density problem

Suppose that the random variable $X$ is uniformly distributed on the interval $[0,1]$ (i.e. $X \sim U(0,1)$) and suppose that $$Z=min(2,2X^2+1)$$

(a) Explain why $Z$ does not have a density function.

(b) Find $\mathbf{E}Z$.

Hint: Use the fact that $\mathbf{E}Z=\int_\mathbf{R}{zdF_Z}$

Is $E(Z)=0.9428+2$? Thanks for helping.

• integrate 2x^2+1 from interval 0 to square root 1/2 , plus integrate 2 from interval square root 1/2 to 1 , as pdf of X is 1 – Wei Sheng Sep 24 '15 at 2:30
• Note that $\min(2,2X^2+1)$ cannot exceed 2 so its expectation also cannot exceed 2. – Glen_b Sep 24 '15 at 2:55
• Is the answer 0.94+0.58? – Wei Sheng Sep 24 '15 at 2:57
• @WeiSheng It would help if you could detail out your approach. – rightskewed Sep 24 '15 at 3:07
• Z= 2X^2+1 for interval [ 0, sqr(1/2) ] , Z= 2 for interval [sqr(1/2) ,1] E(Z)=E(2X^2+1)+E(2) is that correct ? – Wei Sheng Sep 24 '15 at 4:43

There are helpful comments above but I thought this question should have an answer as well.

Now, there are two ways to find the expectation of this random variables. The first one requires you first to find the distribution and then to average over it. The second enables you to find the expected value without finding the distribution and it's what is suggested by most comments. So let's do it both ways and verify the result.

First the "conventional" way. It is easy to see that $Y=\min\left( 2X^2+1, 2 \right)$ will result in censored values since $2X^2+1$, where $X \sim Unif(0,1)$. could very well exceed $2$. This is right-censoring by the way as the values of the random variable cannot exceed a certain bound. Thus the event $\left\{Y=2\right\}$ occurs if and only if $\left\{2X^2+1 \geq 2 \right\}$. Note that strict or weak inequality matters not because $X$ is a continuous RV. We then have

$$P\left(Y=2 \right)=P\left(2X^2+1 \geq 2 \right)=\left(X \geq \frac{1}{\sqrt{2}}\right)=1-\frac{1}{\sqrt{2}}$$

by the properties of the uniform distribution.

Then for the event $\left\{2X^2+1 \leq 2 \right\}$ and for $y \in \left(1,2\right)$ we may compute the CDF of $Y$ as follows

\begin{align} P\left( Y \leq y \ \cap \min\left( 2X^2+1, 2 \right) = 2X^2+1 \right) &= P\left(2X^2+1 \leq y\right) \\ &= P \left(X \leq \sqrt{\frac{y-1}{2}} \right) \\ &= \sqrt{\frac{y-1}{2}} \end{align}

And so the distribution of $Y$ is given by

$$f_Y(y) = \begin{cases} \frac{1}{2^{3/2} \sqrt{y-1}} & 1<y<2 \\ 1-\frac{1}{\sqrt{2}} & y=2 \end{cases}$$

This is a mixed continuous-discrete distribution as the event $\left\{Y=2\right\}$ has positive proability and this I believe answers the first question. Now, the expectation is given by

$$E(Y)=2 \left(1-\frac{1}{\sqrt{2}} \right) + \int_{1}^2 y \frac{1}{2^{3/2} \sqrt{y-1}} \mathrm{dy}$$

and integrating by parts, it is easy to see that the last expression equals $\sqrt{2}-\frac{\sqrt{2}}{3}$, hence the expectation equals $\sqrt{2}-\frac{\sqrt{2}}{3} +2 \left( 1-\frac{1}{\sqrt{2}} \right)$.

Here is what the density looks like in case you are curious (the plot was made in R). Notice the discontinuity at $2$.

   x<-runif(5000, 0, 1)
y <- ifelse(2*x^2+1<=2, 2*x^2+1,  2)
hist(y, prob = T)
curve(2^(-3/2)*(x-1)^(-1/2), add = T, col = "blue", xlim = c(1,1.9), lwd = 2)


Using the Law of unconscious statistician, one may arrive at the last result simply by writing

\begin{align} E\left(Y \right) = \int_0^{\frac{1}{\sqrt{2}}} \left(1+ 2x^2 \right)\ \mathrm{dx} + \int_{\frac{1}{\sqrt{2}}}^1 2 \ \mathrm{dx} \end{align}

where we have effectively split the expectation to account for each case. The result is the same and you get here way faster. Of course I find the long way a bit more instuctive. In an exam, however, definitely do it as fast as possible.

Hope this helps.