Confusion with conditional probabilities

61 Views Asked by At

This should be really simple but feels like I'm missing something.

Consider that we have random variables that influence each other as per $z \rightarrow x \rightarrow y$. Then $y$ is independent of $z$ conditional on $x$. Namely we get:

$$\begin{align} p(y|x, z) &= p(y|x) \\ \frac{p(y, x, z)}{p(x, z)} &= \frac{p(y, x)}{p(x)} \end{align} $$ if we integrate out $x$ from the two sides we get: $$\begin{align} \frac{p(y, z)}{p(z)} &= p(y)=p(y|z) \end{align} $$ which seems to suggest that $y$ and $z$ are independent of each other, which doesn't make sense as surely knowing the value of $z$ tells us something about the distribution of $y$. Am I doing something wrong with my integrating out step?