Calculating the density of the conditional distribution of $Z$ given $X=0$ or $1$ Let $Z$ be a random variable with continuous distribution having density $f_Z$ which is zero
outside the interval $[0, 1]$ 
Let $X$ and $Y$ be two random variables, independent given $Z$,
satisfying
$P(X = 1|Z = z) = z = 1−P(X = 0|Z = z) and P(Y = 1|Z = z) = z =1−P(Y = 0|Z = z)$.
a) Calculate the density of the conditional distribution of $Z$ given $X = 0$ and the density of the conditional distribution given $X = 1$.
b) Calculate the conditional probabilities $P(Y = 1|X = 0)$ and $P(Y = 1|X = 1)$
For part a), my idea is to use Bayes Formula but I do not know how to calculate $P(X=0)$ and $P(Z=z)$ as we only have $P(X=1 or 0 |Z=z)$
Any help much appreciated!
 A: I'll use $p$ to denote densities (so e.g. $p(z) = f_Z(z)$).
As you mentioned, by Bayes' theorem we have $$ p(z | x = 0) = \frac{ p(x=0 | z) p(z) }{p(x=0)} = \frac{(1-z)p(z)}{p(x=0)}. $$
One way to compute the constant factor is to note that the left side (and thus, the right side) must be equal to $1$ when integrating over $z\in [0,1].$ This gives $$p(x=0) = \int^1_0 (1-z) p(z) dz = 1 - \mu_Z.$$
A more direct approach is to apply the law of total probability:
$$p(x=0) = \int^1_0 p(x=0, z) dz = \int^1_0 p(x=0|z) p(z) dz = \int^1_0 (1-z) p(z) dz = 1-\mu_Z.$$
Thus, we have the conditional density $$p(z|x=0) = \frac{(1-z)p(z)}{1-\mu_Z}.$$
Through a similar computation, verify for yourself that 
$$ p(z|x=1) = \frac{zp(z)}{\mu_Z}.$$
For part b, again we can use Bayes' theorem to start:
$$p(y=1| x=0) = \frac{p(y=1, x=0)}{p(x=0)}.$$
The denominator we have already computed above, $p(x=0) = 1-\mu_Z.$ The numerator needs to be calculated using the law of total probability:
$$ p(y=1, x=0) = \int^1_0 p(y=1, x=0 | z) p(z) dz.$$
Since $X$ and $Y$ are independent given $Z,$ we have 
$$ p(y=1,x=0) = \int^1_0 z(1-z) p(z) dz = \mu_Z - \mathbb{E}[Z^2]$$ and therefore, 
$$ p(y=1|x=0) = \frac{\mu_Z - \mathbb{E}[Z^2]}{1-\mu_Z}.$$
You can compute $p(y=1|x=1)$ in a similar way. 
