Bayes' Theorem with multiple random variables I'm reviewing some notes regarding probability, and the section regarding Conditional Probability gives the following example:
$P(X,Y|Z)=\frac{P(Z|X,Y)P(X,Y)}{P(Z)}=\frac{P(Y,Z|X)P(X)}{P(Z)}$
The middle expression is clearly just the application of Bayes' Theorem, but I can't see how the third expression is equal to the second.  Can someone please clarify how the two are equal?

It is easy to follow the following argumentation
$$P(Z|X,Y)P(X,Y) = \frac{P(X,Y,Z)}{P(X,Y)}P(X,Y) = P(X,Y,Z)=\frac{P(X,Y,Z)}{P(X)}P(X)=P(Y,Z|X)P(X).$$
