# Show that x and y are independent in this joint distribution

Given that the joint probability Pr(w,x,y,z) over four variables factorizes as
$Pr(w,x,y,z) = Pr(w) Pr(z|y) Pr(y|x,w)Pr(x)$
show that x is independent of w by showing that Pr(x,w) = Pr(x)Pr(w).

Attempt: if we simply assume Pr(x,w) = Pr(x)Pr(w), then:
\begin{align} Pr(w,x,y,z) &= Pr(w) Pr(z|y) Pr(y|x,w) Pr(x)\\ &\stackrel{?}= Pr(x,w) Pr(z|y) Pr(y|x,w)\\ &\stackrel{?}= Pr(z|y) Pr(w,x,y) \end{align}

But can we say the last line equals Pr(w,x,y,z)? I think this problem can be solved by simply applying Bayes' rule several times, but I can't seem to wrap my head around it.

\begin{align} Pr(x,w) &= \iint Pr(w,x,y,z)\,dydz \\ &= \iint Pr(w)Pr(z|y)Pr(y|x,w)Pr(x)\,dydz \\ &= Pr(w)Pr(x) \iint Pr(z|y)Pr(y|x,w)\,dydz \\ &= Pr(w)Pr(x) \end{align}