- Law of total probability, Bayes's rule
Random variables

**Claim (Law of total probability):** If *B*_{1}, *B*_{2}, …, *B*_{n} are mutually exclusive and ∪*B*_{i} = *S*, then *P**r*(*A*)=∑*P**r*(*A*|*B*_{i})*P**r*(*B*_{i}).

**Proof:** Use third axiom to write *P*(*A*)=∑*P**r*(*A* ∩ *B*_{i}); use defn. of *P**r*(*A*|*B*_{i}) to conclude *P**r*(*A* ∩ *B*_{i})=*P**r*(*A*|*B*_{i})*P**r*(*B*_{i})

**Claim (Bayes's rule):** *P**r*(*A*|*B*)=*P**r*(*B*|*A*)*P**r*(*A*)/*P**r*(*B*).

**Proof:** Follows directly from definition of *P**r*(*A*|*B*) and *P**r*(*B*|*A*).

**Alternate form:** *P**r*(*A*|*B*)=*P**r*(*B*|*A*)*P**r*(*A*)/∑*P**r*(*B*|*A*_{i})*P**r*(*A*_{i})

Usually used with *A*_{1} = *A* and $A_2 = \bar{A}$.

**Definition:** A (real-valued) **Random variable** *X* on a sample space *S* is a function *X* : *S* → ℝ.

**Definition:** If *f* : ℝ → ℝ is any function and *f* is a random variable, then we write *f*(*X*) to denote the random variable *f*(*X*):*S* → ℝ given by *f*(*X*)(*s*)=*f*(*X*(*s*)). Examples: *s**i**n*(*X*), *X*^{2}, *X* + *Y* and *X**Y* are all random variables. (*X* + *Y*)(*s*)=*X*(*s*)+*Y*(*s*).

**Definition:** If *X* is a random variable, then *E*(*X*)=∑_{s ∈ S}*X*(*s*)*P**r*({*s*}).

**Lemma:** This definition is equivalent to *E*′(*X*)=∑_{x ∈ ℝ}*x**P**r*(*X* = *x*).

**Proof:** To get from *E* to *E*′, group all of the terms that have the same *X* value. Details in lecture slides.

**Definition:** The probability density function (or probability distribution function) of a random variable *X* is the function *P**D**F*_{X} : ℝ → ℝ given by *P**D**F*_{X}(*x*)=*P**r*(*X* = *x*).

**Definition:** The cumulative distribution function of *X* is given by *C**D**F*_{X}(*x*)=*P**r*(*X* ≤ *x*).