Here is the explanation for what we were doing in the last section.
Random Variables and Probability Distributions (Google Doc)