What's the difference between p(Z, X=x) and p(Z|X=x)? I'm trying to understand variational inference, and I've found resources that mention $p(Z, X=x)$, where $Z$ is a latent random variable and $X$ is the observed random variable. (Here is one such example)
Is there a difference between $p(Z, X=x)$ and $p(Z|X=x)$? Let's consider a simple example: $X$ is a random variable of MNIST handwritten digit images, and $Z$ is the random variable for the actual digit class (i.e. if x is a picture of a hand drawn 7, z is 7)

Joint probability $p(Z,X)$ is: what is the probability that someone has blue eyes $Z$ and red hair $X$.
Conditional probability $p(Z|X)$ is: what is the probability that someone with red hair $X$ has blue eyes $Z$.
With discrete data, in the first case to calculate the probability you would consider all the possible combinations of eye color and hair color, in the second case, you care only about people with red hair. This is what the definition says
$$
p(Z|X) = \frac{p(Z, X)}{p(X)}
$$
because you only “count” the cases where $X$ happens, you need to normalize (divide by) the probability of observing $X$. From the whole “pie” you cut off only the piece of size equal to $p(X)$ fraction of the $X$ side, so the piece is $p(X)$ smaller than the whole “pie”.
