Please read my comments, all answers are wrong (I have showed contradiction)

Can someone respond to my comments under Graham Kemp's Answer? I think he made a mistake...

Let's look at the following problem:

We choose a point $Y$ on pencil of length 1, S.T $Y\sim \operatorname{Uni}(0,1)$

We break the pencil at that point, choose one of the 2 parts in equal probability (1/2), S.T $X$ is the length of the part we chose. ie the length of the other part is $1-X$.

  1. Calculate $\mathrm E(X)$.
  2. Calculate $\operatorname{Var}(X)$.

For (1) I found that:

The probability for $Y=X$ is $1/2$ while the probability for $Y=1-X$ is also $1/2$. So, the probability for $X=Y$ is $1/2$ while the probability for $X=1-Y$ is also $1/2$.

ie: $E[X]=X*P(X)=1/2 * Y + 1/2 * (1-Y) = 1/2$

But where am I supposed to use the given fact that: $Y\sim \operatorname{Uni}(0,1)$ I don't seem to use this anywhere which indicated I did something wrong.

For (2) I know, $\operatorname{Var}(X)=\mathrm E(X^2)-\mathrm E(X)^2$ But How to Continue from here?


Solution 1:

But where am I supposed to use the given fact that: $Y∼Uni(0,1) $

You could do this. $$\begin{align}f_X(x) ~&=~ \mathsf P({X=Y})~f_Y(x)+\mathsf P({X=1-Y})~f_Y(1-x)\\&=~\tfrac 12\cdot \mathbf 1_{x\in[0..1]}+\tfrac 12\cdot \mathbf 1_{1-x\in[0..1]}\\&=~\mathbf 1_{x\in[0..1]}\end{align}$$

Therefore the distribution for $X$ is known.


I don't seem to use this anywhere which indicated I did something wrong.

No. You were okay. The expectation of $Y$ is cancelled so there is no need to use it here.

$$\begin{align}\mathsf E(X) ~&=~ \mathsf P({X=Y})~\mathsf E(Y)+\mathsf P({X=1-Y})~\mathsf E(1-Y)\\&=~\tfrac 12\mathsf E(Y)+\tfrac12(1-\mathsf E(Y))\\&=~\tfrac12\end{align}$$

However, this cancellation does not happen when you do likewise for the expectation of the square.

$$\begin{align}\mathsf E(X^2) ~&=~ \mathsf P({X=Y})~\mathsf E(Y^2)+\mathsf P({X=1-Y})~\mathsf E((1-Y)^2)\\&=~\tfrac12~\mathsf E(Y^2)+\tfrac 12~\mathsf E(1-2Y+Y^2)\\&=~\tfrac 12-\mathsf E(Y)+\mathsf E(Y^2)\end{align}$$

So here you can use the fact: $Y\sim\mathcal U[0..1]$, and so find $\mathsf{Var}(X)$.

Solution 2:

Since $0 \leq x \leq 1$ and $p(x)$ is uniform, then $p(x)=1$.

$E[X]=\int_0^1 x p(x) dx$

$= \int_0^1 x dx $

$= \frac{1}{2}$.

$Var[X] = \int_0^1 (x -\mu)^2 p(x) dx $

$= \int_0^1 (x-\frac{1}{2})^2 dx $

$= \frac{1}{12}$

Solution 3:

You can do like this:-

$$\mathbb{E}[X]=\mathbb{E}(\mathbb{E}(X|Y))$$

Then this is nothing but:-

$$\int_{0}^{1}(yP(X=y)+(1-y)P(X=1-y))\,dy=\int_{0}^{1}\frac{1}{2}\,dy=\frac{1}{2}$$

The variance is also calculated in a similar way.

$$Var(X)=\mathbb{E}(Var(X|Y))+Var(\mathbb{E}(X|Y))$$

We have:-

$$Var(X|Y=y)=E((X-\frac{1}{2})^{2}|Y=y))=\frac{1}{2}(y-\frac{1}{2})^{2}+(1-y-\frac{1}{2})^{2}\frac{1}{2}=(y-\frac{1}{2})^{2}$$

So $\mathbb{E}(Var(X|Y))=\mathbb{E}((Y-\frac12)^2)=\int_{0}^{1}(y-\frac{1}{2})^{2}\,dy=\frac{1}{12}$.

And $\mathbb{E}(X|Y)=\frac{1}{2}$

So $Var(\mathbb{E}(X|Y))=Var(\frac{1}{2})=0$ (As variance of a constant is $0$).

So you have your answer as $$Var(X)=\frac{1}{12}$$.

You can remember these two formulae . They can be really useful .

$$Var(X)=\mathbb{E}(Var(X|Y))+Var(\mathbb{E}(X|Y))$$

And

$$\mathbb{E}[X]=\mathbb{E}(\mathbb{E}(X|Y))$$