Solved – the difference between sample space and random variable

definitionintuitionmathematical-statisticsrandom variableterminology

I was going through this article and, on this page, I encountered the definition of a random variable and a sample space. According to this page:

A random variable is a set of possible values from a random experiment.

It then takes the example of flipping a coin, defines $Heads=0$ and $Tails=1$, and says that $X = \{0, 1\}$ is a random variable.

Next, it defines sample space as

A random variable's set of values is the sample space.

It then takes the example of throwing a dice, and states that the sample space is $\{1, 2, 3, 4, 5, 6\}$.

So, both terms are defined to be a set of outcomes for an experiment and, as a result, I got confused and couldn't differentiate between them.

What is the difference between sample space and random variable?

I've consulted WIkipedia too and although I can understood the article on Sample Space but the article on Random Variable appears too technical and I couldn't comprehend it.

Best Answer

From statistical inference by Casella and Berger,

Definition 1.1.1 The set, $S$, of all possible outcomes of a particular experiment is called the sample space for the experiment.

So sample space can be thought of as all possible observations one could make from a particular experiment. A sample space for a coin toss is a set $\{H, T\}$; a sample space for rolling a six-sided die is a set $\{1, 2, 3, 4, 5, 6\}$.

Definition 1.4.1 A random variable is a function from a sample space $S$ into the real numbers

so random variable can be thought of as a function. The notation used for random variable is an uppercase letter. So if we have a random variable that maps sample space to real numbers, we have $$X: S \to \mathbb{R}$$

No one really expresses random variables this way; instead, it's often denoted as $X$.

If that random variable $X$ is a set of possible values from a random experiment, then $$X: S \to S$$ so random variable is an identity function.