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$.
- Calculate $\mathrm E(X)$.
- 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?
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.
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)$.