Random Variables in a Uniform Probability Space Suppose that $\Omega = \{1,2,3,4,5,6\}$ is a uniform probability space. Now, let $X(\omega)$ and $Y(\omega)$, for  $\omega \in \Omega$, be random variables defined as:
$$\begin{array}{|c|c:6c|} \hline
~~~ \omega    & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline 
X(\omega) & 0 & 0 & 1 & 1 & 2 & 2 \\\hdashline 
Y(\omega) & 0 & 2 & 3 & 5 & 2 & 0 \\ \hline
\end{array}$$
How can we calculate: 
$$V=\mathsf L[Y\mid X] \\ W=\mathsf E[Y\mid X] \\ \mathsf E[(Y-V)^2] \\ \mathsf E[(Y-W)^2]$$ 
Here $\mathsf L[Y\mid X]$, the Linear Squares Estimate, and $\mathsf E[Y\mid X]$, the Conditional Expectation, are functions of $X$.
 A: $W$, the conditional expectation of $Y$ given $X$ will be a piecewise function partitioned on $X$'s enumeration.
$$\begin{align}W~=~& \mathsf E(Y\mid X) \\[2ex]~=~& \sum\limits_{\omega\in X^{-1}(X)} Y(\omega)\cdot\mathsf P^{Y\mid X}(\omega) & :~ \mathsf P^{Y\mid X}(\omega) \mathop{:=} \Pr(Y{=}Y(\omega)\mid X{=}X(\omega)) \\[2ex] =~& \tfrac 12\begin{cases}0 + 2 & : X=0 \\[1ex] 3 + 5 & : X=1 \\[1ex] 2 + 0 & :X = 2\end{cases} \\[2ex] \therefore~W ~=~& ~~\begin{cases}1 & : X=0 \\[1ex] 4 & : X=1 \\[1ex] 1 & :X = 2\end{cases}\end{align}$$
To add to the table:
$$\begin{array}{|c|c:6c|} \hline
~~~ \omega & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline 
X(\omega)  & 0 & 0 & 1 & 1 & 2 & 2 \\\hdashline 
Y(\omega)  & 0 & 2 & 3 & 5 & 2 & 0 \\ \hline
W(\omega)  & 1 & 1 & 4 & 4 & 1 & 1 \\ \hline 
\end{array}$$
Then we have that :
$$
\begin{align}
\mathsf E\big((Y-W)^2\big) ~=~& \mathsf E\Big(\mathsf E\big((Y-\mathsf E(Y\mid X))^2\mid X\big)\Big) & \textsf{why?}
\\[1ex] ~=~& \mathsf E\Big(\mathsf E\big(Y^2\mid X\big)-\mathsf E\big(Y\mid X\big)^2\Big) & \textsf{how?}
\\[1ex] ~=~ & \mathsf E(Y^2) - \mathsf E\big(\mathsf E(Y\mid X)^2\big)
\\[1ex] ~=~ & 
\\[1ex]\therefore \mathsf E\big((Y-W)^2\big) ~=~& 
\end{align}$$
( Or you can pull it straight from the table $\ddot\smile$ )

Can you complete and do similarly for $V=\mathsf L(Y\mid X)$ ?
