Lecture 1. F) Random Variables
Random variables
To finish, we connect probability spaces to random variables. In practice, we'll often use random variables rather than probability spaces. A random variable is a (Borel measurable) function [math]X:S →\mathcal{R}[/math]. In other words, a random variable maps an element [math]s[/math] from [math]S[/math] to a real number.
In coin tossing,
[math]X:\left\{ Heads,Tails\right\}→\mathcal{R}[/math], given by
[math]X\left(s\right)=\begin{cases} 1, & if\,s=Heads\\ 0, & if\,s=Tails \end{cases}.[/math]
Basically, a random variable maps experimental outcomes to numbers. It allows us to step away from the sample space, which would be cumbersome to work with in many applications. Random variables are related to probability spaces. In fact, we can summarize random variable (r.v.) [math]X[/math] as the probability space [math]\left(S_{X},\mathcal{B}_{X},P_{X}\right)[/math], where
- [math]S_{X} = \mathcal{R}[/math]
- [math]\mathcal{B}_{X} = \mathcal{B\left(R\right)}[/math]
- [math]P_{X} = P\left(X^{-1}\right)[/math]
The first two statements are definitional. The third identity states that the probability function of [math]X[/math] can be written as a function of the original probability function [math]P\left(\cdot\right)[/math]. To see that we can indeed make this identity work, in the coin tossing example, apply the third equality w.r.t. the element ‘Heads’:
[math]P_{X}\left(1\right)=P\left(X^{-1}\left(1\right)\right)=P\left(\left\{ s\in S:X\left(s\right)=1\right\} \right).[/math]
This is a bit tricky the first time, but in the end, all we have done is make [math]P_{X}()[/math] be a function of real numbers rather than elements from the sample space.
Usually, we ask about the probability of a random variable equalling a specific number, or falling in a given set. The way we formally address this question is to map back to the original probability function, and verify how many elements correspond to the number in question, via function [math]X[/math]. In continuous cases, say where [math]X[/math] refers to height, we can write [math]P_{X}[/math] as
[math]P_{X}\left(A\right)=P_{X}\left(X\in A\right)=P\left(X^{-1}\left(A\right)\right)=P\left(\left\{ s\in S:X\left(s\right)\in A\right\} \right)[/math] where [math]A[/math] is a set belonging to [math]\mathcal{B\left(\mathcal{R}\right)}.[/math] Notice also that the inverse function of the r.v. can be a correspondence, s.t. it maps onto several elements of the Borel [math]\sigma[/math]-algebra.
Random variables thus connect probabilities of elements of the sample space with probabilities of sets in the real numbers. For simplicity, we often write [math]P\left(X=1\right)[/math] and [math]P\left(X\in A\right)[/math] rather than [math]P_{X}\left(X=1\right)[/math] and [math]P_{X}\left(X\in A\right)[/math]. Finally, rather than expressing probabilities as functions of sets, which would be tedious, we usually define probabilities for random variables with cumulative distribution functions.
Cumulative Distribution Function
A cumulative distribution function (c.d.f.) of a random variable [math]X[/math] is the function [math]F_{X}:\mathcal{R}\rightarrow\left[0,1\right][/math], given by
[math]F_{X}\left(x\right)=P_{X}\left(\left(-\infty,x\right]\right)=P\left(X\leq x\right),\,x\in\mathcal{R}.[/math]
So, the c.d.f. provides the probability of the value of a random variable falling below a scalar [math]x[/math]. It is relatively easy to write the example of coin tossing in c.d.f.
Remember that we use random variable
[math]X\left(s\right)=\begin{cases} 1, & if\,s=Heads\\ 0, & if\,s=Tails \end{cases}[/math],
so that
[math]F_{X}\left(x\right)=\begin{cases} 0, & if\,x\lt 0\\ \frac{1}{2}, & if\,0\leq x\lt 1\\ 1, & if\,x\geq1 \end{cases}[/math]
As a final, quick side-note, [math]F_{X}[/math] is simply a function’s name. We could have called it simply [math]F[/math], [math]G[/math] or something else. We sometimes underscript the function with the variable it refers to, because often we end up using multiple c.d.f.s.