Proving conditional independence I have the following problem:
Three random variables have the following joint distribution:
$$
P(X,Y,Z) = P(X)P(Y|X)P(Z|Y)
$$
Show that $X$ and $Z$ are conditionally independent given $Y$.
The solution that I have been given is:
$$
P(X)P(Y|X)P(Z|Y) = \frac{P(X)P(Y|X)P(Z|Y)}{P(Y)} = \frac{P(X,Y)}{P(Y)}P(Z|Y) = P(X|Y)P(Z|Y)
$$
But no explanation was given for how each of these steps where reached - is anyone able to elaborate on this?
 A: $\newcommand{\P}{\operatorname{\mathcal P}}$
The solution should be
$$\begin{align}\because \P(X,Y,Z) & = \P(X)\P(Y\mid X)\P(Z\mid Y) \\ \P(X, Z\mid Y) & = \frac{\P(X,Y,Z)}{\P(Y)} \\ & =\frac{\P(X)\P(Y\mid X)\P(Z\mid Y)}{\P(Y)} \\ & = \frac{\P(X)\P(Y\mid X)}{\P(Y)}\P(Z\mid Y) \\ & = \P(X\mid Y)\P(Z\mid Y) \\ \therefore X\bot Z \mid Y\end{align}$$

You have been given: $$\because \P(X,Y,Z) = \P(X)\P(Y\mid X)\P(Z\mid Y) \tag{1}$$
Now, by definition of conditional probability: $$\P(X,Z\mid Y) = \dfrac{\P (X, Y, Z)}{\P(Y)} \tag{2}$$
By substitution (1) into (2): $$\P(X,Z\mid Y) = \dfrac{\P(X)\P(Y\mid X)\P(Z\mid Y)}{\P(Y)}\tag{3}$$
A trivial rearrangement of (3) shows that: $$\P(X,Z\mid Y) = \dfrac{\P(X)\P(Y\mid X)}{\P(Y)}\P(Z\mid Y) \tag{4}$$
Now, again by definition (or Bayes' rule): $$\dfrac{\P(X)\P(Y\mid X)}{\P(Y)}=\P(X\mid Y) \tag{5}$$
So substitution of (5) into (4) yields: $$\P(X,Z\mid Y)= \P(X\mid Y)\P(Z\mid Y)\tag{6}$$
This is the sufficient and necessary requirement for conditional independence.
 $$\P(X,Z\mid Y)= \P(X\mid Y)\P(Z\mid Y) \iff X \bot Z \mid Y \tag{7}$$
Which was to be shown.
$$\therefore X\bot Z \mid Y \mathbb{\tag{QED}}$$
