Probability and Random Variables
Next year: Joint: and, Conditional: if
Concepts
- Utility and Probability
- Random Variables
- Relationships between Random Variables
Utility and Probability
Utility indicates preference
Consider events \(A\) and \(B\):
Probability indicates plausibility
Indicates \(A\) is preferable to \(B\)
\(U(A) > U(B)\)
\(U(A) = U(B)\)
Indicates indifference between \(A\) and \(B\)
Indicates \(A\) is more plausible (or likely) than \(B\)
\(P(A) > P(B)\)
\(P(A) = P(B)\)
Indicates \(A\) is equally as plausible (or equally likely) as \(B\)
What is a Random Variable?
R.V. \(X\)
Vocabulary/Notation
| Term | Definition | Coinflip Example |
|---|
\(\text{Bernoulli}(0.6)\)
support(\(X\))
All the values that \(X\) can take
\(\{h, t\}\) or \(\{0,1\}\)
\(x \in X\)
Distribution
Maps each value in the support to a real number indicating its probability
\(P(X=1) = 0.6\)
\(P(X=0) = 0.4\)
\(P(X)\) is a table
| X | P(X) |
|---|---|
| 0 | 0.4 |
| 1 | 0.6 |
Expectation
First moment of the random variable, "mean"
\(E[X]\)
\[E[X] = \sum_{x \in X} x P(x)\]
\(=0.5\)
"Binary random variable"
Change back to Bernoullli(0.5) - this is a coinflip after all, also make sure the mean is consistent
Vocabulary/Notation
| Term | Definition | Coinflip Example | Uniform Example |
|---|
\(\text{Bernoulli}(0.5)\)
\(\mathcal{U}(0,1)\)
support(\(X\))
All the values that \(X\) can take
\(\{h, t\}\) or \(\{0,1\}\)
\([0,1]\)
\(x \in X\)
\(X \in [0,1]\)
Distribution
Maps each value in the support to a real number indicating its probability
\(P(X=1) = 0.5\)
\(P(X=0) = 0.5\)
\(P(X)\) is a table
| X | P(X) |
|---|---|
| 0 | 0.5 |
| 1 | 0.5 |
- Discrete: PMF
- Continuous: PDF
\(p(x) = \begin{cases} 1 \text{ if } x \in [0, 1] \\ 0 \text{ o.w.} \end{cases}\)
\(P(X=1) = \)
\(P(X \in [a, b]) = \int_a^b p(x) dx\)
\(0\)
Expectation
First moment of the random variable, "mean"
\(E[X]\)
\[E[X] = \sum_{x \in X} x P(x)\]
\(=0.5\)
\[E[X] = \int_{x \in X} x p(x) dx\]
\(=0.5\)
Distributions of related R.V.s
Joint Distribution
Conditional Distribution
Marginal Distribution
\(P(X,Y,Z)\)
\(P(X \mid Y,Z)\)
\(P(X)\) \(P(Y)\) \(P(Z)\)


(Distribution - valued function)
| X | P(X|Y=1, Z=1) |
| 0 | 0.84 |
| 1 | 0.16 |
Joint: and, Conditional: if, add more cases to conditional
Distributions of related R.V.s
Joint Distribution
Conditional Distribution
Marginal Distribution
\(P(X,Y,Z)\)
\(P(X \mid Y,Z)\)
\(P(X)\) \(P(Y)\) \(P(Z)\)
3 Rules
(Burrito-level)
(Gourmet Level: Axioms of Probability)
1)
a) \(0 \leq P(X \mid Y) \leq 1\)
b) \(\sum_{x \in X} P(x \mid Y) = 1\)
2) "Law of total probability"
\[P(X) = \sum_{y \in Y} P(X, y)\]
3) Definition of Conditional Probability
\[P(X \mid Y) = \frac{P(X, Y)}{P(Y)}\]
Joint \(\rightarrow\) Marginal
Joint + Marginal \(\rightarrow\) Conditional
Marginal + Conditional \(\rightarrow\) Joint
\[P(X, Y) = P(X | Y) \, P(Y)\]

not on exam
Distributions of related R.V.s
Joint Distribution
Conditional Distribution
Marginal Distribution
\(P(X,Y,Z)\)
\(P(X \mid Y,Z)\)
\(P(X)\) \(P(Y)\) \(P(Z)\)
3 Rules
1)
a) \(0 \leq P(X \mid Y) \leq 1\)
b) \(\sum_{x \in X} P(x \mid Y) = 1\)
2) "Law of total probability"
\[P(X) = \sum_{y \in Y} P(X, y)\]
3) Definition of Conditional Probability
\[P(X \mid Y) = \frac{P(X, Y)}{P(Y)}\]
Joint \(\rightarrow\) Marginal
Joint + Marginal \(\rightarrow\) Conditional
Marginal + Conditional \(\rightarrow\) Joint
\[P(X, Y) = P(X | Y) \, P(Y)\]

Naive Inference
Three Random Variables: \(A\), \(B\), \(C\) (Works for any number)
Want to find \(P(\underbrace{A=a}_\text{query} \mid \underbrace{B=b}_\text{evidence})\)
- Determine the joint distribution \(P(A, B, C)\).
- Marginalize over hidden and query variables to get \[P(A=a, B=b) = \sum_c P(A=a, B=b, C=c)\] and
\[P(B=b) = \sum_{a, c} P(A=a, B=b, C=c)\] - \(P(A=a \mid B=b) = \frac{P(A=a, B=b)}{P(B=b)}\)
\(C\) is a "hidden variable"
(Book introduces unnormalized "factors", but process is the same.)
Consider putting this after the break
Break
- \(P \in \{0,1\}\): Powder Day
- \(C \in \{0,1\}\): Pass Clear
- 1 in 5 days is a powder day
- The pass is clear 8 in 10 days
- If it is a powder day, there is a 50% chance the pass is blocked
- Write out the joint probability distribution for P and C.
- Suppose it is a non-powder day, what is the probability that the pass is blocked?
1)
a) \(0 \leq P(X \mid Y) \leq 1\)
b) \(\sum_{x \in X} P(x \mid Y) = 1\)
2) \(P(X) = \sum_{y \in Y} P(X, y)\)
3) \(P(X \mid Y) = \frac{P(X, Y)}{P(Y)}\)
\(P(X, Y) = P(X | Y) \, P(Y)\)
Revise this example - don't use P as a variable, use a more interesting final question: Maybe give a different conditional and ask for what is currently given
Bayes Rule
- Know: \(P(B \mid A)\), \(P(A)\), \(P(B)\)
- Want: \(P(A \mid B)\)
Definitions: Conditional Expectation and Independence
Definition: \(X\) and \(Y\) are independent iff \(P(X, Y) = P(X)\, P(Y)\)
Definition: \(X\) and \(Y\) are conditionally independent given \(Z\) iff \(P(X, Y \mid Z) = P(X \mid Z)\, P(Y \mid Z)\)
Definition: The conditional expectation of \(X\) given \(Y\) is \[E[X \mid Y] = \sum_x x\,P(X=x \mid Y) \] (function from values of \(Y\) to expectations of \(X\))
Concepts
- Utility and Probability
- Random Variables
- Relationships between Random Variables
Rules for Continuous RVs
1)
a) \(0 \leq P(X \mid Y) \leq 1\)
b) \(\sum_{x \in X} P(x \mid Y) = 1\)
2) \(P(X) = \sum_{y \in Y} P(X, y)\)
3) \(P(X \mid Y) = \frac{P(X, Y)}{P(Y)}\)
\(P(X, Y) = P(X \mid Y) \, P(Y)\)
1)
Discrete
Continuous
\[\int_X p(x | Y) \, dx = 1\]
2) \[p(X) = \int_{Y} p(X, y) dy\]
3) \(p(X \mid Y) = \frac{p(X, Y)}{p(Y)}\)
\(p(X, Y) = p(X \mid Y) \, p(Y)\)
\(0 \leq p(X \mid Y)\)
Multivariate Gaussian Distribution
Joint Distribution
Conditional Distribution
Marginal Distribution
020 Probability and Random Variables
By Zachary Sunberg
020 Probability and Random Variables
- 545