3.1.1 Random Variables
In general, to analyze random experiments, we usually focus on some numerical aspects of the experiment. For example, in a soccer game we may be interested in the number of goals, shots, shots on goal, corners kicks, fouls, etc. If we consider an entire soccer match as a random experiment, then each of these numerical results gives some information about the outcome of the random experiment. These are examples of random variables. In a nutshell, a random variable is a realvalued variable whose value is determined by an underlying random experiment.
Let's look at an example.
Example
I toss a coin five times. This is a random experiment and the sample space can be written as $$S=\{TTTTT,TTTTH,... , HHHHH\}.$$ Note that here the sample space $S$ has $2^5=32$ elements. Suppose that in this experiment, we are interested in the number of heads. We can define a random variable $X$ whose value is the number of observed heads. The value of $X$ will be one of $0, 1,2,3,4$ or $5$ depending on the outcome of the random experiment.
In essence, a random variable is a realvalued function that assigns a numerical value to each possible outcome of the random experiment. For example, the random variable $X$ defined above assigns the value $0$ to the outcome $TTTTT$, the value $2$ to the outcome $THTHT$, and so on. Hence, the random variable $X$ is a function from the sample space $S$=$\{TTTTT$,$TTTTH$, $\cdots$ ,$HHHHH\}$ to the real numbers (for this particular random variable, the values are always integers between $0$ and $5$).
Random Variables:
A random variable $X$ is a function from the sample space to the real numbers.
$$X:S\rightarrow \mathbb{R}$$
We usually show random variables by capital letters such as $X$, $Y$, and $Z$. Since a random variable is a function, we can talk about its range. The range of a random variable $X$, shown by Range$(X)$ or $R_X$, is the set of possible values for $X$. In the above example, Range$(X)=R_X=\{0,1,2,3,4,5\}$.
The range of a random variable $X$, shown by Range$(X)$ or $R_X$, is the set of possible values of $X$.
Example
Find the range for each of the following random variables.
 I toss a coin $100$ times. Let $X$ be the number of heads I observe.
 I toss a coin until the first heads appears. Let $Y$ be the total number of coin tosses.
 The random variable $T$ is defined as the time (in hours) from now until the next earthquake occurs in a certain city.
 Solution

 The random variable $X$ can take any integer from $0$ to $100$, so $R_X=\{0,1,2,...,100\}$.
 The random variable $Y$ can take any positive integer, so $R_Y=\{1,2,3,...\}=\mathbb{N}$.
 The random variable $T$ can in theory get any nonnegative real number, so $R_T=[0,\infty)$.
