The probability mass function of a pair of discrete random variables is the function . The conditional mass function of given is the function . Thus the mass function (left-hand plot) computes probabilities of intersections, while the conditional mass function (right-hand plot) computes conditional probabilities. For each value, the slice through the conditional mass function at that value gives the distribution of when assumes the value . The mean of this distribution is the conditional expectation of given , . The weighted average of the conditional expectations, with the weights given by the probability that , is the expected value of .
You can reverse the roles of and to obtain the conditional mass function of given and the conditional expectation of given .