What is the explanation of this expected value result? Given $X \sim Uni(0,1)$, and $Z = \mathbb{I} \{a < x < 1\}$, $Y = \mathbb{I} \{0 < x < b\}$
for the parameters $0 < a < b < 1$. And we know that $Y$ and $Z$ are dependent.
So basically what I can understand from this, is that $Z = 1$ if $a < x < 1$, otherwise $Z = 0$.
And the same for $Y$, as $Y = 1$ if $0 < x < b$, otherwise $Y = 0$
I need to find $E[Y|Z]$. The answer for this is the following, although I don't understand almost anything out of it:
For $Z = 1$:
$$P(y = 0|z = 1) = \frac{P(y = 0, z = 1)}{P(z = 1)} = \frac{1-b}{1-a}$$
$$P(y = 1|z = 1) = \frac{P(y = 1, z = 1)}{P(z = 1)} = \frac{b-a}{1-a}$$
$$P(Z = 1) = 1-a$$
for $Z = 0$:
$$P(y = 0|z = 0) = \frac{P(y = 1, z = 0)}{P(z = 0)} = \frac{a}{a} = 1$$
$$P(Z = 0) = a$$
Finally:
$$E[Y|Z] = E[Y|Z = z] * P(Z = z) = P(Y = 1| Z = 1) * P(Z = 1) + P(Y = 1|Z = 0)*P(Z = 0) = \frac{b-a}{1-a} a + 1 (1-a)$$
Can someone please help me understand how did we get to the final formula? why is $P(y = 0, z = 1) = 1 - b$  and why is $P(z = 1) = 1 - a$ ?
N

If $U \sim \mathrm{Unif}(c, d)$ and $c<u_1<u_2<d$, then
$$ P(u_1<U<u_2)=\frac{u_2-u_1}{d-c} $$
[Sketch it; it's just the area of a rectangle.]
To answer your questions:

why is P(y=0,z=1)=1−b ?

Because $Y=0, Z=1$ is equivalent to $X>b$ and $a<X<1$, i.e. $b<X<1$.

and why is P(z=1)=1−a ?

Because $Z=1$ is equivalent to $a<X<1$.
